Hi Michael,
Is it possible to do an Arccontinue arc, from the end of a line segment curve, to pointA, using a script?
Given:
TopView planar geometry, z=0.
1. lineBC segment from pointB to pointC, to which the Arccontinue is to be tangent. (lineBC is at 12 degrees from the vertical.)
2. PointB, which is the start point of the Arccontinue.
(The raw ptB is at ( 2, 1, 0 ).)
3. PointA, which is the end point of the Arccontinue.
(The raw ptA is at ( 1, 2, 0 ).)
4. The radius has a known value. (not needed.)
5. The center of the arc is unknown. (It could be calculated...)
Normally, Pointpicker is used to select pointB, and the tangent of the line segment is picked up by MoI, to complete the arccontinue arc.
Can Arccontinue be scripted?
Using lineBC.getStartPt() does not seem to pick up the tangent of lineBC. (???)
And what would be the correct type of point?
(ptB, ptObjB, or pointB (item(0)), or pointB.pt ???)
code:
var ptA = moi.vectorMath.createPoint( 1, 2, 0 );
var factory = moi.command.createFactory( 'point' );
factory.setInput( 0, ptA );
var ptObjA = factory.calculate();
if ( !ptObjA )
return false;
var pointA = ptObjA.item(0);
moi.geometryDatabase.addObject( pointA ); // Point A.
var ptB = moi.vectorMath.createPoint( 2, 1, 0 );
var factory = moi.command.createFactory( 'point' );
factory.setInput( 0, ptB );
var ptObjB = factory.calculate();
if ( !ptObjB )
return false;
var pointB = ptObjB.item(0);
moi.geometryDatabase.addObject( pointB ); // Point B.
var ptC = moi.vectorMath.createPoint( 2.212557, 0, 0 );
var factory = moi.command.createFactory( 'point' );
factory.setInput( 0, ptC );
var ptObjC = factory.calculate();
if ( !ptObjC )
return false;
var pointC = ptObjC.item(0);
moi.geometryDatabase.addObject( pointC1 ); // Point C.
var linefactory = moi.command.createFactory( 'line' );
linefactory.setInput( 0, pointB.pt );
linefactory.setInput( 1, pointC.pt );
var lineobj = linefactory.calculate();
if ( !lineobj || lineobj.length != 1 )
return false;
var lineBC = lineobj.item(0);
moi.geometryDatabase.addObject( lineBC );
// The above 4 code sections are working well.
/*
// Various permutations of the following code do not work, so far:
// var start = lineBC.getStartPt();
// var pointfactory = moi.command.createFactory( 'point' );
// pointfactory.setInput( 0, start );
// pointfactory.commit(); // should be point B again.
var startptObj = pointfactory.calculate();
var startpointB = startptObj.item(0);
moi.geometryDatabase.addObject( startpointB );
// Create point object from curve end pt. (= C)
// This is one input for Arc > Continue, arc to point D.
var pointfactory = moi.command.createFactory( 'point' );
pointfactory.setInput( 0, lineBC.getEndPt() );
var endpt = pointfactory.calculate();
// Get startPt of lineBC, and also endPt.
var startPt = lineBC.getStartPt();
var endPt = lineBC.getEndPt();
*/
// Create arcAB, using arcontinue, from B to A.
var arcfactory = moi.command.createFactory( 'arccontinue' );
// arcfactory.setInput( 0, startpoint );
// arcfactory.setInput( 1, pointA );
// arcfactory.setInput( 0, startpointObj );
// arcfactory.setInput( 1, pointA );
arcfactory.setInput( 0, startpointB.pt );
arcfactory.setInput( 1, pointA.pt );
var arcObjAB = arcfactory.calculate();
if ( !arcObjAB || arcObjAB.length != 1 )
return false;
var arcAB = arcObjAB.item(0);
moi.geometryDatabase.addObject( arcAB );
Can pointpicker() be used, without picking a point?
Can the line tangent be obtained by script, and fed into arccontinue?
As a last resort, the Unknown CenterPt could be calculated, and then a 2point arc could be done.
Thankyou,
- Brian
The arccontinue, done manually with pointpicker(), ends up at 66 degrees.