New API module: Show

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
DeepSOIC
Posts: 6293
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

New API module: Show

Postby DeepSOIC » Sun Oct 02, 2016 2:45 pm

That module was created when I was making visibility automation for Sketcher.
It is now used from Sketcher, a little bit from PartDesign, a little bit from Part Extrude, and also from Part Attachment Editor.

The main feature of the module is TempoVis class. It is a class to do some temporary changes to 3d view scene when starting to edit something, and then undo the changes when finished editing.

For usage example, see console dumps when editing a sketch.

Here are some of the methods available:
* hide(feture_or_list): hides feature. Equivalent to feature.ViewObject.hide(), except that the original visibility is remembered by tempovis so that it can be restored (that is the main overall purpose of TempoVis).
* show(feture_or_list): similar to hide()
* hideAllDependent(feature): hides all objects that depend on feature, except for containers. Useful to soft-block user from making dependency loops (but user can still unhide an object manually). And to simply unclutter the view.
* modifyVPProperty(feature_or_list, prop_name, new_value): modifies any property of viewprovider of an object (e.g., useful for making an object transpatenr temporarily).
* setUnpickable(feature_or_list): NEW! makes feature transparent to clicks (it becomes unselectable, and it is possible to select things under it)
* saveCamera()
* restore(): undo all changes made via TempoVis. Automatically called when TempoVis object is deleted, but I suggest to call it manually anyway.

The module is coded in Python. This makes it a bit inconvenient to use from C++.