Hi,
There is a lack of information to respond to your request.
What exactly are the input data?
AutoCAD manages the arc polyline segments with the bulge concept. The bulge of a segment is equal to the tangent of the quarter of the angle of the arc (IOW, the arc sagitta divided by half of the chord).
Here is an example that reproduces the behavior of the _PLINE native command by computing the bulge so that the arc is tangent to the previous segment.
[CommandMethod("Test")]
public void Test()
{
Document doc = AcAp.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
// prompt for first point
var options = new PromptPointOptions("\nFirst point: ");
var result = ed.GetPoint(options);
if (result.Status != PromptStatus.OK)
return;
var pt1 = result.Value;
// prompt for second point
options.Message = "\nSecond point: ";
options.BasePoint = pt1;
options.UseBasePoint = true;
result = ed.GetPoint(options);
if (result.Status != PromptStatus.OK)
return;
var pt2 = result.Value;
// prompt for third point
options.Message = "\nThird point: ";
options.BasePoint = pt2;
result = ed.GetPoint(options);
if (result.Status != PromptStatus.OK)
return;
var pt3 = result.Value;
// convert points to 2d points
var plane = new Plane(Point3d.Origin, Vector3d.ZAxis);
var p1 = pt1.Convert2d(plane);
var p2 = pt2.Convert2d(plane);
var p3 = pt3.Convert2d(plane);
// compute the bulge of the second segment
var angle1 = p1.GetVectorTo(p2).Angle;
var angle2 = p2.GetVectorTo(p3).Angle;
var bulge = Math.Tan((angle2 - angle1) / 2.0);
// add the polyline to the current space
using (Transaction tr = db.TransactionManager.StartTransaction())
{
var curSpace = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
using (var pline = new Polyline())
{
pline.AddVertexAt(0, p1, 0.0, 0.0, 0.0);
pline.AddVertexAt(1, p2, bulge, 0.0, 0.0);
pline.AddVertexAt(2, p3, 0.0, 0.0, 0.0);
pline.TransformBy(ed.CurrentUserCoordinateSystem);
curSpace.AppendEntity(pline);
tr.AddNewlyCreatedDBObject(pline, true);
}
tr.Commit();
}
}