Drawing Order

Drawing Order

hao_zhou
Not applicable
17 Views
2 Replies
Message 1 of 3

Drawing Order

hao_zhou
Not applicable

[ FlexSim 19.0.0 ]

Assume I have a machine. I draw a box (12 gl triangles) around the machine with grey transparent color {0.5f, 0.5f, 0.5f, 0.5f} through mesh API. I test it, it is transparent and I can see any objects behind it. The problem is that the machine has a few moving mechanical parts, the moving parts' treenodes are directly under the machine's treenode in the FlexSim tree. These moving parts are not visible. Is there a way of making these parts visible through the transparent surface.

0 Likes
Accepted solutions (1)
18 Views
2 Replies
Replies (2)
Message 2 of 3

philboboADSK
Autodesk
Autodesk
Accepted solution

Rather than putting your code in the OnDraw trigger of the main object, you can put it in an OnDraw trigger of a surrogate object component. This will cause it to draw after the main object's content.

  1. Right-click the object and select Edit > Animations... to open the Animations and Components window.
  2. Press the + button to add a new surrogate object component.
  3. In the tree view, navigate to that component and explicitly create an OnDraw node within its object data.
  4. Give that OnDraw node string data, toggle it as FlexScript, and paste your draw code into it.
  5. Execute the following script for the surrogate object component so that OnDraw is fired for it:
treenode Object1 = Model.find("MainObj>visual/drawsurrogate/Object1");

set(drawflags(Object1),get(drawflags(Object1)) &~ DRAW_FLAG_NO_ON_DRAW); 

See the attached sample model. draw-order.fsm

17549-transparent-box.png



Phil BoBo
Sr. Manager, Software Development
Message 3 of 3

hao_zhou
Not applicable

Thanks for the solution Phil. I really appreciate it.

0 Likes