Small Feature Wish

 From:  Kiril
3756.13 In reply to 3756.9 
The script works perfectly Michael, also thanks for taking the time to explain the procedure of adding buttons.

I've managed to implement the buttons I wanted:

I did make an attempt at combining Join and Rebuild in a single click, thinking that I could stuff the "DoRebuild()" and "DoJoin()" functions together in a new function Joinrebuild.js
and call that as a command - but did not work out - so left click = Join & Right click = Rebuild.

In the spirit of learning and trying to understand MoI scripting I analyzed your script and annotated its working with comments - first for myself and now for anyone else interested:

Get all curves in the workspace, store them in the array 'crvs'.
var crvs = moi.geometryDatabase.getObjects().getCurves(); 

Look at each curve in the scene, incrementally, where curvs.length refers to the number of curves in the array 'crvs'.:
for ( var i = 0; i < crvs.length; ++i ){	

Get the item(which itself is an array) in the array 'crvs' in position 'i''(a digit set by the previous declaration)(array entries are numbered from 0, so i=0 makes sense).
var crv = crvs.item(i); 

Assuming a compound curve is a single entry in the 'crvs' array, look at the 'SubObjects' property of that curve(an array) - specifically its 'length' or number of entries.Since a compound path will contain multiple sub-curves/"[..]objects" we would expect length to be>1 - in this case select it.
if ( crv.getSubObjects().length > 1 ) crv.selected = true; }



EDITED: 15 Sep 2010 by KIRIL

Image Attachments:
Size: 20.8 KB, Downloaded: 48 times, Dimensions: 505x92px