ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Tips and Tricks
Downloads

Tips and Tricks Share helpful modeling ideas

  #1  
Old 08-22-2007
Brenton King's Avatar
Brenton King Brenton King is offline
Flexsim Technical Support
 
Join Date: Jul 2007
Posts: 44
Downloads: 60
Uploads: 5
Thanks: 10
Thanked 41 Times in 15 Posts
Rep Power: 271
Brenton King is a name known to allBrenton King is a name known to allBrenton King is a name known to allBrenton King is a name known to allBrenton King is a name known to allBrenton King is a name known to all
Default How to select all objects of a class in your model

If you need to select all of your processors or network nodes or conveyors or any other class of objects in your model you can paste the following code into your script window. All you will need to change is the name of the class that is in quotes. (examples: Processor, Conveyor) This code is great because you can name your objects whatever you want but they won't hide from this code.


Code:
 
forobjecttreeunder(model())
{
if(comparetext("NetworkNode", getname(first(classes(a)))))
{
switch_selected(a, 1);
}
else
{
switch_selected(a, 0);
}
}
The Following 2 Users Say Thank You to Brenton King For This Useful Post:
shivrash (04-03-2008)
  #2  
Old 08-23-2007
Tom David's Avatar
Tom David Tom David is offline
Flexsim User
 
Join Date: Aug 2007
Location: Schwaebisch Gmuend, Germany
Posts: 430
Downloads: 157
Uploads: 47
Thanks: 486
Thanked 450 Times in 233 Posts
Rep Power: 520
Tom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant future
Default

And if you like to do anything with the selected objects you could do something with the following code:

Code:
 
// FOR ALL SELECTED (RED) OBJECTS IN MODEL
forobjecttreeunder(model())
{
//IF OBJECT IS SELECTED AND IF IT IS AN OBJECT
if(and(switch_selected(a,-1),eq(4,getdatatype(a))))
{
//SHOW A SCREEN MESSAGE WITH THE NAME
msg(getname(a),getname(a));
}
}
My code is boring, because it only shows the names of the objects, but you can do exciting things if you like .

Have fun with it.
tom the (A)tom
The Following User Says Thank You to Tom David For This Useful Post:
shivrash (04-03-2008)
  #3  
Old 04-03-2008
shivrash shivrash is offline
Flexsim User
 
Join Date: Aug 2007
Posts: 43
Downloads: 9
Uploads: 0
Thanks: 37
Thanked 2 Times in 1 Post
Rep Power: 158
shivrash is on a distinguished road
Default

Quote:
Originally Posted by Brenton King View Post
If you need to select all of your processors or network nodes or conveyors or any other class of objects in your model you can paste the following code into your script window. All you will need to change is the name of the class that is in quotes. (examples: Processor, Conveyor) This code is great because you can name your objects whatever you want but they won't hide from this code.


Code:
 
forobjecttreeunder(model())
{
if(comparetext("NetworkNode", getname(first(classes(a)))))
{
switch_selected(a, 1);
}
else
{
switch_selected(a, 0);
}
}
Hey thanx 4 da code...

But where do i paste it? In my model, I have got 27 processor and 30 queues whose properties I would like to change in one step..Does pasting this code select all 27 proc. and 30queues ? If yes, then where shall i paste this code?
  #4  
Old 04-03-2008
Tom David's Avatar
Tom David Tom David is offline
Flexsim User
 
Join Date: Aug 2007
Location: Schwaebisch Gmuend, Germany
Posts: 430
Downloads: 157
Uploads: 47
Thanks: 486
Thanked 450 Times in 233 Posts
Rep Power: 520
Tom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant future
Default

You can use the Script window to do the job.
You can find it under /View/Script Window in the menu.
Or use the Speedbutton Script between Persp and Control.

Good success.

P.S.: There is also a user command in the download section under Custom User Commands "select group" which you might find useful.
And there is a thread under Gripes and Goodies "about "no select" and "show parameter window from side bar"" which I guess is also interesting for you. See my post "Manipulate selected (red) objects ".
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions."

Last edited by Tom David; 04-03-2008 at 11:31 PM. Reason: More information
The Following User Says Thank You to Tom David For This Useful Post:
Cliff King (04-04-2008)



All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.