PDA

View Full Version : How to hide VisualTool object?


AlanZhang
09-07-2007, 04:10 PM
I would like to hide VisualTool object dynamically. Is there any way to do it?

I found that the Show 3D Shape under General tab of Properties Window won't work for VisualTool, although it works for other objects such as Queue, Processor ect. The command switch_hideshape() won't work for VisualTool since basically it does the same thing as the Show 3D Shape under General Tab.

Thanks.

Alan

Paul Toone
09-07-2007, 04:32 PM
Alan,

It should work just fine, unless I am not understanding your problem. I have attached a small model that hides/shows the 3-D shape every 5 seconds; it was done with a message loop that sends a new message every 5 seconds.

If this is not what you are talking about, please help clarify the issue so we can help.

Or, you could attach your model to a reply message and we can look at your model and see if we can't figure out whats going on.

Thanks,

Paul Toone
Flexsim Support

AlanZhang
09-10-2007, 10:05 AM
Paul,

Thanks for your answer. When the visual tool uses imported shape, the switch_hideshape() won't work. Sorry I forgot mentioning that in the above post. Please see the attached model. Is it a intended behavior in Flexsim? Any solution?

Thanks,
Alan

Paul Toone
09-11-2007, 02:49 PM
I've been working on this the past couple days and I can't find a way to hide a visual tool when it is an imported shape. I've checked with our developers and they have said there is just no way to hide a visual tool when it has an imported shape as it's object. Sorry I don't have a better answer for you.

I will continue to work on this and inform you if I find a solution to your question. Thanks for you patience.

AlanZhang
09-11-2007, 05:40 PM
Thanks, Paul. At least I know I should not try to find an answer in the document any more.

Alan

Paul Toone
09-17-2007, 04:54 PM
Alan,

I have found out a little bit more information on the question you asked. The VisualTool manages the "hideshape" switch internally. In other words, it executes switch_hideshape() in its internal OnDraw event to switch the display of its 3D shape on/off based on the current "Minimum Magnification" and "Maximum Distance" values assigned to the VisualTool. Therefore it doesn't do any good to execute switch_hideshape() as a modeler because the object is continually switching it's shape the way it wants it.

Here are a few alternative ways I came up with to dynamically hide a Visual Tool's "Imported Shape" using code.

1. USE A DIFFERENT OBJECT:
You can use an object besides the VisualTool to display the imported shape, and then switch_hideshape() can be used to hide the 3D
shape. Ex - Use a processor insetead of a visual tool.

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)," _ ");

I hope this helps out a little bit more to answer why the switch_hideshape command didn't work for you on the visual tool.

Thanks,

Paul Toone

AlanZhang
09-18-2007, 11:22 AM
Thank you Paul. Using the method setting maximum distance to zero works well. I really appreciate your help. I suggest we put this into Flexsim Tips. :-)

Alan