Alternative way to enter construction line mode
All  1-2  3-5

Previous
Next
 From:  immortalx
7395.3 
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.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
7395.4 In reply to 7395.3 
Hi immortalx,

> 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.

Right before the call to pointfactory.commit(), put in this:

code:
        pointfactory.update();
	var output = pointfactory.getCreatedObjects();
	output.setProperty( 'name', 'ConstructionPt' );


That should then make the generated points have an object name of 'ConstructionPt'. If you want to set a style it's a bit more involved, the property you set is the styleIndex which is an integer value of the index of the style to use. To get the style index you'd need to call:

var style = moi.geometryDatabase.findStyle( 'stylename', true /*CreateIfNotFound*/ );
var index = style.index;

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  immortalx
7395.5 
Thanks again Michael, this worked like a charm!
I'm amazed at how flexible MoI is in customizing the tools and the interface!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-2  3-5