Hi, I am editing a model through Matlab and struggling with understanding seemingly basic functions through doxygen.
I added wrap objects, but I want to hide the objects so the geometries do not show when viewing the model in OpenSim. I know I can manually hide them in the OpenSim GUI, but I would like to streamline it through Matlab.
I checked doxygen and found that "Appearance" is listed as a property under OpenSim::WrapObject, but I am having difficulty understanding how to access the "visible" property.
My guess was to use the function "set_Appearance(const Appearance & value)" to access "visible", but am not having any luck.
Any help or tips on understanding how to use doxygen as a reference for scripting would be greatly appreciated.
Toggle object visibility through Matlab API
- Hangil Lee
- Posts: 5
- Joined: Tue Jul 24, 2018 3:32 am
- Ayman Habib
- Posts: 2252
- Joined: Fri Apr 01, 2005 12:24 pm
Re: Toggle object visibility through Matlab API
Hello,
You're on the right track. "Appearance" is an object that has methods to set visibility () so you should call to get a reference to the Appearance of the WrapObject and then call set_visible on the returned Appearance.
Always a good idea to refer to the Doxygen documentation for your specific version for the list of available methods or use methodsview in Matlab.
Hope this helps,
-Ayman
You're on the right track. "Appearance" is an object that has methods to set visibility (
Code: Select all
set_visible
Code: Select all
upd_Appearance()
Always a good idea to refer to the Doxygen documentation for your specific version for the list of available methods or use methodsview in Matlab.
Hope this helps,
-Ayman
- Hangil Lee
- Posts: 5
- Joined: Tue Jul 24, 2018 3:32 am
Re: Toggle object visibility through Matlab API
Thank you for the quick reply! Using upd_Appearance() to create a reference worked perfectly.
In this case, would there be a way to implement set_Appearance() instead? Or in general is it better practice to use upd_ to set parameters.
In this case, would there be a way to implement set_Appearance() instead? Or in general is it better practice to use upd_ to set parameters.
- Ayman Habib
- Posts: 2252
- Joined: Fri Apr 01, 2005 12:24 pm
Re: Toggle object visibility through Matlab API
Hi Hangil,
Generally the API uses "upd_*" methods to get a writable reference to existing objects that will be modified. Using "upd_" methods when modifying an object makes sure that downstream side-effects take place in orderly fashion.
Using "set_Appearance" method here will also work but you're making a new Appearance object, populating it then copying all properties when in fact all you want to do is change one property value of an existing Appearance object.
Hope this helps,
-Ayman
Generally the API uses "upd_*" methods to get a writable reference to existing objects that will be modified. Using "upd_" methods when modifying an object makes sure that downstream side-effects take place in orderly fashion.
Using "set_Appearance" method here will also work but you're making a new Appearance object, populating it then copying all properties when in fact all you want to do is change one property value of an existing Appearance object.
Hope this helps,
-Ayman
- Hangil Lee
- Posts: 5
- Joined: Tue Jul 24, 2018 3:32 am
Re: Toggle object visibility through Matlab API
Ah that makes sense. Thank you for the kind explanation!