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 07-17-2008
Gavin Douglas Gavin Douglas is offline
Flexsim User
 
Join Date: Feb 2008
Posts: 65
Downloads: 1
Uploads: 0
Thanks: 27
Thanked 1 Time in 1 Post
Rep Power: 152
Gavin Douglas is on a distinguished road
Default Need A Script

Hello,

I'm looking to write a script that will scroll through X objects in the tree and disable "show connections." I know you can do this globally and locally through the GUI but I want to control X as I am building a very large model. Any help? I'm new to scrip writing. Also, how to execute the script?

Thanks
__________________
"A bird is an instrument working according to mathematical law, which is within the capacity of man to reproduce." -Leonardo da Vinci, 1502
  #2  
Old 07-17-2008
Alex Christensen Alex Christensen is offline
Flexsim Technical Support
 
Join Date: Nov 2007
Location: Provo, UT
Posts: 96
Downloads: 41
Uploads: 8
Thanks: 29
Thanked 141 Times in 56 Posts
Rep Power: 298
Alex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to behold
Default

put this in a script window:
Code:
forobjecttreeunder(model())
{
    if(switch_selected(a,-1))
    {
        if(switch_hideconnectors(a,-1))
        {
            switch_hideconnectors(a,0);
        }
        else
        {
            switch_hideconnectors(a,1);
        }
    }
}
It will switch showing the connections on all the selected (red) objects.
The Following User Says Thank You to Alex Christensen For This Useful Post:
Gavin Douglas (07-17-2008)
  #3  
Old 07-17-2008
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default Script example

Also, you can manage groups of objects through the "Groups" option in the sidebar instead of manually selecting them each time. Bear in mind that Alex's code toggle's the connector setting so you probably don't want to mix those switched on with those that aren't.
The Following User Says Thank You to Jason Lightfoot For This Useful Post:
Gavin Douglas (07-17-2008)
  #4  
Old 07-18-2008
Anthony Johnson's Avatar
Anthony Johnson Anthony Johnson is offline
Manager of Product Development
 
Join Date: Jul 2007
Posts: 440
Downloads: 86
Uploads: 4
Thanks: 171
Thanked 899 Times in 288 Posts
Rep Power: 735
Anthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond repute
Default

Gavin,
If you didn't already know, there is a button in the ortho view's side panel that already does what Alex's script does. It's at Edit Selected Objects | Switches | Toggle Ports. This option, however, will sync the toggles of the selected objects, whereas Alex's flips each one so they're not necessarily synchronized. You can use the Groups panel in conjunction with this option to get what you need.


Thread Thread Starter Forum Replies Last Post
InputBox in Flexsim script AlanZhang User Development 1 04-08-2015 05:08 AM
Dynamic script generation: Good Example with a User Command Naresh Yamani Tips and Tricks 2 05-16-2008 06:54 PM


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.