ATTENTIONThis 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 |
|
Downloads |
Tips and Tricks Share helpful modeling ideas |
#1
|
||||
|
||||
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
|
||||
|
||||
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)); } } 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
|
|||
|
|||
Quote:
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
|
||||
|
||||
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) |