Hi nos,
> Yes its always the last object. So if the script would find the object automatically its even better.
> So I only could perform a construction command, press the shortcut and the newly created object
> gets the name of the construction elements striped from the ending.
Give this one a try:
script: /* Apply selected object name to last generated object */ var name = ''; var gd = moi.geometryDatabase; var objs = gd.getSelectedObjects(); for ( var i = 0; i < objs.length; ++i ) { var obj = objs.item(i); var thisname = obj.name; if ( thisname.length > 3 && thisname.charAt(thisname.length-3) == '.' ) { name = thisname.substr( 0, thisname.length-3 ); break; } } if ( name != '' ) { gd.selectLastCreated( true ); gd.getSelectedObjects().setProperty( 'name', name ); }
This way this should work is say you a profile and a path curve both named Pipe.CE. Then you create a sweep from these curves - now with those curves selected, run this script and that should then make the sweep have the name Pipe, it will just look for a name in the current selection with a period and any 2 letters after it and if it finds that it will name the last generated object to be that name with the last 3 letters stripped off.
- Michael
|