Scripting

 From:  dune1982
7238.43 In reply to 7238.42 
Ok I will try it with the fuction. But isn't there a return blabla missing in the function?

But isn't there a way to add an object to a list. In this case if var cyl1 = factory.getCreatedObjects(); creates the objectlist cyl1 so I could just add the next cylinder to the list cyl1

In my mind i would do cyl1.addObject(factory.getCreatedObjects()); in the factory for the next cylinder, but then I would add a list to a list which is not possible.

I made it this way now, as there are only two objects

/*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();
cyl1.addObject( cyl1.item(0) );


/*cyl1 plus cyl2*/
moi.geometryDatabase.deselectAll();
factory = moi.command.createFactory( 'booleanunion' );
factory.setInput( 0, cyl1 );
factory.update();
factory.commit();

EDITED: 5 May 2015 by DUNE1982