auto naming function

 From:  Michael Gibson
5701.6 In reply to 5701.4 
Hi Nos, here are some scripts for the other ones:


> Case: toggle visibillity of construction elements
> 1. select the object, press the shortcut and the construction elements will be hidden or shown

script: /* Toggle hide/show of generators of selected objects */ var objs = moi.geometryDatabase.getSelectedObjects(); for ( var i = 0; i < objs.length; ++i ) { var parents = objs.item(i).getHistoryParents(); if ( parents.length == 0 ) continue; parents.setProperty( 'hidden', !parents.item(0).hidden ); }

> Case: toggle visibillity of object
> 1. select a construction element, press the shortcut and the object will be hidden or shown

script: /* Toggle hide/show of descendents of selected objects */ var objs = moi.geometryDatabase.getSelectedObjects(); for ( var i = 0; i < objs.length; ++i ) { var children = objs.item(i).getHistoryChildren(); if ( children.length == 0 ) continue; children.setProperty( 'hidden', !children.item(0).hidden ); }


These methods will only be able to figure things out where the history mechanism is still active though, like if you do an extrusion there is still a history relation from the curve to extruded result, but if you then do some other operations like a boolean on the extrusion it won't be able to keep the history connected.


Hope these help,

- Michael

EDITED: 17 Feb 2013 by MICHAEL GIBSON