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
|
||||
|
||||
Change Layout from GUI
Hi, I used the Layout-tool for the positioning of objects in 2 different scenarios.
Now I want to change the Layout from a button in a user GUI. I managed to do this with views and groups, but for the layouts it seems to be a bit more complicated... any ideas... ?
__________________
kind regards Nico. |
#2
|
||||
|
||||
Change View from user GUI
OK, the change of views worked in 4.3 , in 4.5 it does not.
I tried the following on the onpress of a button in a user GUI: flystop(); treenode curview = node("/Tools/OrthoViews/1", model()); executefsnode(curview,curview,0,0,0); repaintall(); What the code should do is change the view to the first captured view, but it does not work? What did I do wrong?
__________________
kind regards Nico. |
#3
|
||||
|
||||
That is the code I am using, which is working:
// SET THE VIEW TO THE CAPTURED VIEW (DON'T FORGET THAT THE GUI NEEDS A palettewindow ATTRIBUTE) // STOP THE FLY PATH flystop(); // POINTER TO CURRENT VIEW treenode curview = node("/Tools/OrthoViews/1",model()); // SET THE VIEW executefsnode(curview,curview,0,0,0); // SCREENREFESH repaintall(); I guess what is missing is the palettwindow attribute at the GUI. See my comment. Add a node called palettewindow under the GUI e.g. behind windowtitle. Build Rebind Object Attributes and the color of the node should turn to blue color. Hopefully everything is working afterwards.
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions." |
The Following User Says Thank You to Tom David For This Useful Post: | ||
Nico Zahn (12-24-2009) |
#4
|
||||
|
||||
Hi Tom, you are right (as most of the time), when I add a palletwindow node to the gui, it is working. Thank you.
Any ideas of how to change the Layout from a user-GUI??
__________________
kind regards Nico. |
#5
|
|||
|
|||
setLayout
Here's the code for a user command (eg. 'setLayout') that accepts the name of the layout as a parameter and sets the positions and sizes etc. You can then call this from whatever GUI mechanism you use to select it - button press etc.. You can also use it at the start of a scenario in the experimenter.
Code:
string layoutname=parstr(1); for (int r=content(model());r>1;r--){ treenode layout=node(concat(">Layouts/",layoutname),rank(model(),r)); if (objectexists(layout)){ for (int n=content(layout);n>0;n--){ setnodenum(rank(node(">spatial", rank(model(),r)), n), getnodenum(rank(layout,n))); } } forobjecttreeunder(rank(model(),r)){ treenode layout=node(concat(">Layouts/",layoutname),a); if (objectexists(layout)){ for (int n=content(layout);n>0;n--){ setnodenum(rank(node(">spatial", a), n), getnodenum(rank(layout,n))); } } } } |
The Following 2 Users Say Thank You to Jason Lightfoot For This Useful Post: | ||
RalfGruber (12-26-2009) |
Thread | Thread Starter | Forum | Replies | Last Post |
Change truck shape | Jamie Santa Ana | Container Terminal (CT) Library | 3 | 10-16-2009 11:03 AM |
Change shape on Rack??? | Lars-Olof Leven | Q&A | 1 | 10-07-2009 11:59 AM |
How to change color when full? | Jamie Santa Ana | Q&A | 2 | 09-23-2009 06:00 PM |
State doesnt change on Combiner | Stephan Korte | Q&A | 2 | 08-14-2009 05:18 AM |
Change Flexsim keyboard shortcut | AlanZhang | Q&A | 1 | 12-03-2008 02:41 PM |