Since I have to do this task couple of times now and in the future a script would make it easier.
I already got this far (create some lines and put them in a list, but I fail selecting the one line where all the intersections are on)
#include "GetObjects.js"
//Set vareables
var i;
i=0;
var linelength;
linelength=50;
var linelist = moi.geometryDatabase.createObjectList();
//Will draw a line with the given coordinates
function drawLine(x1,x2,y1,y2)
{
var linefactory = moi.command.createFactory( "line" );
linefactory.setInput( 0, moi.vectorMath.createPoint( x1, y1, 0 ) );
linefactory.setInput( 1, moi.vectorMath.createPoint( x2, y2, 0 ) );
var objlist = linefactory.calculate();
var line = objlist.item(0);
moi.geometryDatabase.addObject( line );
return line;
}
for ( var j=0; j < 17; j++ )
{
linelist.addObject(drawLine(i,i,0,linelength));
i=i+10;
}
//works fine until here
//Will do the intersection
function DoIntersect()
{
var objectpicker = moi.ui.createObjectPicker();
//objectpicker.min = 2;
if ( !GetObjects( objectpicker ) )
return;
linelist.addObject(objectpicker);
var factory = moi.command.createFactory( 'intersect' );
factory.setInput( 0, linelist.objects );
factory.commit();
}
DoIntersect();
for the corresponding .htm file I just copied the content of the intersect.htm
It works so far that MoI asks me to pick objects for the intersection. I assume that the lines created by the scipt are in the linelist, so I just select the one line that crosses all the created lines. But that fails in the errormessage attached

|