MoI discussion forum
MoI discussion forum

Full Version: script to

Show messages: All  1  2-3

From: Michael Gibson
14 Sep   [#2] In reply to [#1]
Hi Hadrien,

re:
> Does anyone has information regarding the use of the rectangle factory and fillet factory ?

There is an option in the rectangle factory for making rounded corners, it's easier to use that instead of filleting.

Here's an example:

code:
function CreateRectangle( frame, width, height, radius )
{
	var rect_factory = moi.command.createFactory( 'rectangle' );

	rect_factory.setInput( 0, frame ); /* Coordinate frame with base point + x/y axes. */
	/* Input 1 can contain a corner point instead of width/height */
	rect_factory.setInput( 2, width );
	rect_factory.setInput( 3, height );
	rect_factory.setInput( 4, radius != 0.0 ); /* false = not rounded, true = rounded.
	/* Input 5 can contain a point for the rounded corner to go through instead of numeric radius value */
	rect_factory.setInput( 6, radius );

	var result_list = rect_factory.calculate();
	rect_factory.cancel();

	if ( result_list.length == 0 )
		return null;

	return result_list.item(0);
}

function TestRectangle()
{
	var frame = moi.vectorMath.createTopFrame();
	var width = 5;
	var height = 10;
	var radius = 1;

	var rect = CreateRectangle( frame, width, height, radius );

	if ( rect )
	{
		moi.geometryDatabase.addObject( rect );
	}
}

TestRectangle();


Hope that helps! - Michael
From: hadri1
27 Sep   [#3] In reply to [#2]
Thanks Michael.
It worked perfectly !




Hadrien

Image Attachments:
pipeR_pic.png 


Show messages: All  1  2-3