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 |
|
Downloads |
Tips and Tricks Share helpful modeling ideas |
#1
|
||||
|
||||
How to dynamically show/hide the imported 3D shape assigned to a VisualTool
First of all, you need to understand that the VisualTool manages the "hideshape" switch internally. In other words, it calls the switch_hideshape() command in its internal OnPreDraw event to switch the display of its 3D shape on/off based on the current "Minimum Magnification" and "Maximum Distance" values chosen by the modeler for the VisualTool. Therefore it doesn't do any good to execute switch_hideshape() as a modeler because the object is continually switching it back to how it wants it.
Here are a few alternative ways to dynamically hide a VisualTool's "Imported Shape" using code. 1. USE A DIFFERENT OBJECT: The easiest thing to do is use an object besides the VisualTool, then the switch_hideshape() command will be effective in hiding the 3D shape of the object. Using a BasicFR object is suggested because it has very little overhead, doesn't have any shape factors (i.e. offsets), and has a good default size of 1 X 1 X 1. 2. SET MAXIMUM DISTANCE TO ZERO: setvarnum(object, "viewdistance", 0); 3. RENAMING THE 3D FILE REFERENCE: setnodestr(shape(object), " _ "); buildall(); 4. SET THE SHAPE INDEX TO ZERO: setnodenum(shapeindex(object), 0); setnodename(shape(object)," _ "); Four options are listed for educational purposes, but it is suggested that you use option 1 or 2. Last edited by Cliff King; 09-18-2007 at 04:15 PM. |