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 12-22-2009
Nico Zahn's Avatar
Nico Zahn Nico Zahn is offline
Flexsim User
 
Join Date: Sep 2007
Location: Bingen am Rhein, Germany
Posts: 179
Downloads: 19
Uploads: 4
Thanks: 66
Thanked 60 Times in 32 Posts
Rep Power: 201
Nico Zahn has a spectacular aura aboutNico Zahn has a spectacular aura about
Default 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  
Old 12-22-2009
Nico Zahn's Avatar
Nico Zahn Nico Zahn is offline
Flexsim User
 
Join Date: Sep 2007
Location: Bingen am Rhein, Germany
Posts: 179
Downloads: 19
Uploads: 4
Thanks: 66
Thanked 60 Times in 32 Posts
Rep Power: 201
Nico Zahn has a spectacular aura aboutNico Zahn has a spectacular aura about
Default 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  
Old 12-23-2009
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

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  
Old 12-24-2009
Nico Zahn's Avatar
Nico Zahn Nico Zahn is offline
Flexsim User
 
Join Date: Sep 2007
Location: Bingen am Rhein, Germany
Posts: 179
Downloads: 19
Uploads: 4
Thanks: 66
Thanked 60 Times in 32 Posts
Rep Power: 201
Nico Zahn has a spectacular aura aboutNico Zahn has a spectacular aura about
Default

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  
Old 12-24-2009
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 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


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.