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 > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 08-11-2010
Gi Cha Gi Cha is offline
Flexsim User
 
Join Date: Jun 2010
Posts: 8
Downloads: 11
Uploads: 0
Thanks: 15
Thanked 0 Times in 0 Posts
Rep Power: 0
Gi Cha is on a distinguished road
Default 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?)
  #2  
Old 08-11-2010
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

switch_selected()
The Following 2 Users Say Thank You to Phil BoBo For This Useful Post:
Sebastian Hemmann (08-11-2010)
  #3  
Old 08-11-2010
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

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  
Old 08-12-2010
Gi Cha Gi Cha is offline
Flexsim User
 
Join Date: Jun 2010
Posts: 8
Downloads: 11
Uploads: 0
Thanks: 15
Thanked 0 Times in 0 Posts
Rep Power: 0
Gi Cha is on a distinguished road
Default

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


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.