How to do arccontinue using a script?

 From:  Michael Gibson
10929.2 In reply to 10929.1 
Hi Brian, the ArcContinue factory relies on the first point having an object snap set on it which can only be done by having the point supplied by a pointpicker.

re:
> And what would be the correct type of point?

It needs to be a "PickedPoint" object which is generated by the pointpicker and has additional data such as a list of object snaps.


> Can pointpicker() be used, without picking a point?

Sorry no it can't.


> Can the line tangent be obtained by script, and fed into arccontinue?

Unfortunately no, the arccontinue factory is only set up to get the tangent from an osnap on a picked point object.

So to do it in your script without using a picked point, the script would need to do the calculation itself.

There's a solution explained here:
https://www.emathzone.com/tutorials/geometry/equation-of-a-circle-given-two-points-and-tangent-line.html

or also here:
https://www.youtube.com/watch?v=nRAT0cyp74o

The way it's done in the arc continue factory goes like this:

Goal - calculate a circle given a point (PointA), the unit tangent of the circle at that point (TangentA) and a second point that the circle goes through (PointB).

First form a coordinate frame with the tangent as the x axis.

Get a vector between PointA and PointB as a second vector to cross with the unit tangent to get a plane normal.

Get a Y axis by crossing the normal with the xaxis.

Now the coordinate frame is formed with origin at PointA with xaxis being TangentA and the Y axis from the last step.

Get a 2D point B2D in the plane using B2D.x = frame.distancex( PointB ), B2D.y = frame.distancey( PointB ).

Then the calculation of the radius goes like this:

code:
	// The equation for a circle is (x - xcen) ^ 2 + (y - ycen) ^ 2 = radius ^ 2
	// The first circle point is at the origin, and the xaxis is tangent to the circle.
	// Since the xaxis is tangent, xcen = 0, and ycen = +/- radius.
	// Substituting in gives:
	//
	// x ^ 2 + (y - radius) ^ 2 = radius ^ 2
	//
	// Expanding, and moving the right side over to the left:
	// x ^ 2 + y ^ 2 - 2 * y * radius + radius ^ 2 - radius ^ 2 = 0
	//
	// The squared radius terms cancel out:
	// x ^ 2 + y ^ 2 - 2 * y * radius = 0
	//
	// Solving for radius:
	// 2 * y * radius = x ^ 2 + y ^ 2;
	// radius = (x ^ 2 + y ^ 2) / (2 * y)

	Radius = ((B2D.x * B2D.x) + (B2D.y * B2D.y)) / (2.0 * B2D.y);

	// The circle's origin is radius distance along the original frame's y axis.


- Michael