Hi Brent
You can use virtual plane to get the points, see quick example,
Im using existing line for test but you can create LineSegment3d
or CircularArc3d for your polyline segments instead, but way would be the same:
[CommandMethod("ldiv")]
public void testLineDivisions()
{
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
PromptEntityOptions peo = new PromptEntityOptions("\nSelect a Line: ");
peo.SetRejectMessage("Only a Line !");
peo.AddAllowedClass(typeof(Line), false);
PromptEntityResult per = ed.GetEntity(peo);
if (per.Status != PromptStatus.OK) return;
ObjectId lid = per.ObjectId;
PromptDoubleOptions pdo = new PromptDoubleOptions("\nEnter step: ");
pdo.AllowNone = true;
pdo.UseDefaultValue = true;
pdo.DefaultValue = 1.0;
PromptDoubleResult res;
res = ed.GetDouble(pdo);
if (res.Status != PromptStatus.OK) return;
double step = res.Value;
ed.WriteMessage("\nStep entered:\t{0}\n", step);
Point3d pt;
Point3d tmp;
using (Transaction tr = db.TransactionManager.StartOpenCloseTransaction())
{
Entity ent = tr.GetObject(lid, OpenMode.ForWrite) as Entity;
if (ent == null) return;
Line ln = ent as Line;
if (ln == null) return;
Line3d lc = new Line3d(new Point3d(0, 0, 0), new Point3d(10, 0, 1));// current line
Line3d lx = new Line3d(new Point3d(0, 0, 0), new Point3d(10, 0, 0));// line along x axis
Plane plan = new Plane();
int i = 0;
for (double d = 0.1; d < 1.0; d += 0.1)
{
pt = lx.EvaluatePoint(d);
plan = new Plane(pt, Vector3d.XAxis);
tmp = plan.IntersectWith(lc)[0];// get intersection point between the line and virtual plane
ed.WriteMessage("\nPoint Number: {0}\tPoint: {1:f3}\n", i + 1, tmp);
i++;
}
lc.Dispose();
lx.Dispose();
}
}
_____________________________________
C6309D9E0751D165D0934D0621DFF27919