Hi Michael,
I was impressed how fast you where able to deliver such a well crafted script yesterday.
I was about to post another update of my threadmaking script but after I looked at your code I started to rewrite it. I like the elegant (but undocumented) factory.getCreatedObjects() solution you used here.
My simple test script, boolean diffs two cylinders and then another one from the result. Unfortunately the second boolean diff doesn't work therefore I assume object variables generated by sweep or boolean diff must be extracted differently. But how? Thanks for your help.
code:
/*make cylinder 1*/
frame = moi.vectorMath.createTopFrame();
frame.origin = moi.vectorMath.createPoint( 0, 0, 0 );
factory = moi.command.createFactory( 'cylinder' );
factory.setInput( 1, frame );
factory.setInput( 3, 30 );
factory.setInput( 4, moi.vectorMath.createPoint( 0, 0, 60 ) );
factory.update();
var cyl1 = factory.getCreatedObjects();
factory.commit();
/*make cylinder 2*/
frame = moi.vectorMath.createTopFrame();
frame.origin = moi.vectorMath.createPoint( 0, 0, 0 );
factory = moi.command.createFactory( 'cylinder' );
factory.setInput( 1, frame );
factory.setInput( 3, 60 );
factory.setInput( 4, moi.vectorMath.createPoint( 0, 0, 30 ) );
factory.update();
var cyl2 = factory.getCreatedObjects();
factory.commit();
moi.ui.alert("Before first Diff");
/*cyl2 minus cyl1*/
moi.geometryDatabase.deselectAll();
factory = moi.command.createFactory( 'booleandifference' );
factory.setInput( 0, cyl2 );
factory.setInput( 1, cyl1 );
factory.setInput( 2, false );
factory.update();
var result = factory.getCreatedObjects(); //result doesn't work in the next diff
factory.commit();
/*make cylinder 3*/
frame = moi.vectorMath.createTopFrame();
frame.origin = moi.vectorMath.createPoint( 25, 0, 0 );
factory = moi.command.createFactory( 'cylinder' );
factory.setInput( 1, frame );
factory.setInput( 3, 30 );
factory.setInput( 4, moi.vectorMath.createPoint( 25, 0, 30 ) );
factory.update();
var cyl3 = factory.getCreatedObjects();
factory.commit();
moi.geometryDatabase.selectAll();
moi.view.resetAll();
moi.ui.alert("Before second Diff");
/*result minus cyl3*/
moi.geometryDatabase.deselectAll();
factory = moi.command.createFactory( 'booleandifference' );
factory.setInput( 0, result );
factory.setInput( 1, cyl3 );
factory.setInput( 2, false );
factory.commit();
|