Loft factory question

 From:  Martin (MARTIN3D)
5493.16 In reply to 5493.15 
Hi Michael,

I'm actually quite happy with the way scripting MoI works right now. When I use it in the same way as I would do things manually i.e. just use .commit() and a .selectAll() / .invertSelection() / deselectAll() combo to put things into the next factory I already can do anything I want. It just requires careful planning and keeping track of whats selected and whats not.

If in the next beta the .update() / getCreatedObjects() / .cancel() combo works for sweeps and booleans using variables will make scripting even easier because I can use object.selected = true; or objectlist.setProperty('selected', true);


And if its just for easier coding I can already have that with an external Javascript file.
Your line example could already be as simple as

code:
#include "scriptLibrary.js"
drawLine( pt(0,0,0), pt(10,10,0) );


by using an external scriptLibrary.js file:
code:
function pt(x, y, z) {
	var pt = moi.vectorMath.createPoint( x, y, z );
	return pt;
}

function drawLine(pt1, pt2) {
	var factory = moi.command.createFactory( "line" );
	factory.setInput( 0, pt1 );
	factory.setInput( 1, pt2 );
	factory.commit();
}


or a circle:
code:
function pt(x, y, z) {
	var pt = moi.vectorMath.createPoint( x, y, z );
	return pt;
}

function drawCircle(orientation, center, radius) {
	switch (orientation) {
	case "Top":
		var frame = moi.vectorMath.createTopFrame();
		break;
	case "Front":
		var frame = moi.vectorMath.createFrontFrame();
		break;
	case "Right":
		var frame = moi.vectorMath.createRightFrame();
		break;
}
	
	frame.origin = center;
	var factory = moi.command.createFactory( 'circle' );
	factory.setInput( 1, frame );
	factory.setInput( 3, radius );
	factory.commit();
}

drawCircle("Front", pt(0,0,0), 100);


I can see many factories simplyfied like this and not neccessarily a need for an additional simplyfied scripting layer that would break backwards compatibility.