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 |
#1
|
|||
|
|||
Command to "select" an object?
What is the command to "select" an object? (highlight in red)
I'm trying to reference an object so that I can duplicate it using duplicateselected(). is there a script command to select an object already existing in the model? (ie. without shift-clicking on it?) |
#3
|
||||
|
||||
I like to add some code I find useful if you speak about selected (red) objects.
Code:
// SELECT ALL NetworkNodes IN MODEL forobjecttreeunder(model()) { if(comparetext("NetworkNode", getname(first(classes(a))))) { switch_selected(a, 1); } else { switch_selected(a, 0); } } 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), getdatatype(a) == 4)) { // SHOW A SCREEN MESSAGE WITH THE NAME msg(getname(a),getname(a)); } }
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions." |
The Following 3 Users Say Thank You to Tom David For This Useful Post: | ||
Steven Hamoen (08-12-2010) |
#4
|
|||
|
|||
Thanks!
FYI. duplicateselected() takes a very long time to create the 2nd object. I guess it wouldn't matter if you were only duplicating a few items, but I was trying to duplicate a few thousand. createinstance(obj class, obj location) works significantly faster. |
Thread | Thread Starter | Forum | Replies | Last Post |
a question about the command "getitemtype" | Vic Li | Q&A | 2 | 10-04-2008 11:47 PM |
Is it possible one object comprised of the function of "combiner" and "separetor"? | Vic Li | Q&A | 1 | 08-19-2008 04:41 AM |
is there a command opposite to "destroyobject" which create a object? | KelvinHo | Q&A | 3 | 07-03-2008 08:09 AM |
Does the "loaduserlibrary" command has a flaw? | Steven Hamoen | Q&A | 1 | 06-03-2008 02:47 PM |
about "no select" and "show parameter window from side bar" | qin tian | Gripes and Goodies | 3 | 03-21-2008 08:10 AM |