Parametric design in MoI?

 From:  Karsten (KMRQUS)
7713.77 In reply to 7713.76 
Hi Max,

I have made some experiments with your code and have some problems with the frames. The following code fragment works, but with frames not. Have you any idea what I'm doing wrong?

// Line
function Line()
{
// this.size = [60,20];
// this.addInput("Start","frame"); //<------
// this.addInput("End","frame"); //<------
this.addInput("x1","number");
this.addInput("y1","number");
this.addInput("z1","number");
this.addInput("x2","number");
this.addInput("y2","number");
this.addInput("z2","number");
this.addOutput("Out","objectlist");
// this.properties = { radius:0 };
}

Line.title = "Line";
Line.desc = "Line";

Line.prototype.onExecute = function()
{
// var start = this.getInputData(0, moi.VectorMath.createFrame()); //<--------
// var end = this.getInputData(1, moi.VectorMath.createFrame()); //<-------
this.properties.x1 = this.getInputData(0, this.properties.x1);
this.properties.y1 = this.getInputData(1, this.properties.y1);
this.properties.z1 = this.getInputData(2, this.properties.z1);
this.properties.x2 = this.getInputData(3, this.properties.x1);
this.properties.y2 = this.getInputData(4, this.properties.y2);
this.properties.z2 = this.getInputData(5, this.properties.z2);
var start = moi.vectorMath.createPoint();
var end = moi.vectorMath.createPoint();
start.x = this.properties.x1;
start.y = this.properties.y1;
start.z = this.properties.z1;
end.x = this.properties.x2;
end.y = this.properties.y2;
end.z = this.properties.z2;
var factory = moi.command.createFactory( 'line' );
factory.setInput(0, start);
factory.setInput(1, end);
var output = factory.calculate();
// factory.update();
// LineFactory.commit();
this.setOutputData(0, output);
factory.cancel();
}
LiteGraph.registerNodeType("Factories/Line", Line);


Please, keep on coding:-)

Thanks a lot!
Karsten


Attachments: