Thank you Michael, that is an awesome trick! It will take a bit getting used to entering the constraint first, but it is almost what I needed!
Yesterday I found another solution by combining the line and point scripts into one and just cancelling the creation of the line at the end of the script:
code: #include "GetPoint.js"
function ConstructionPoint()
{
var ui = moi.ui;
var pointpicker = ui.createPointPicker();
if ( !GetPoint( pointpicker ) )
return;
ui.beginUIUpdate();
ui.hideUI( 'StartPrompt' );
ui.showUI( 'EndPrompt' );
ui.endUIUpdate();
var linefactory = moi.command.createFactory( 'line' );
linefactory.setInput( 0, pointpicker.pt );
pointpicker.bindBasePt( linefactory.getInput(0) );
pointpicker.bindResultPt( linefactory.getInput(1) );
ui.bindUIToInput( 'bothsides', 'value', linefactory.getInput(2) );
if ( !GetPoint( pointpicker ) )
return;
//part of Point script here
var pointfactory = moi.command.createFactory( 'point' );
pointfactory.setInput( 0, pointpicker.pt );
pointfactory.commit();
//Abort line creation
linefactory.cancel();
}
ConstructionPoint();
This works wonderfully and adds a point at the typed in distance constraint. The only problem is that I'm left with a bunch of "orphaned" point objects. I'm wondering if it's possible to create those points with a specific style or object-name through that script, so that selecting and deleting them is easier.
|