I am new to AutoCAD plugin programming and C#. I’m trying to place points along a polyline in C# for a function I am writing, and I need to know when the point is being placed, is it on a curved portion, and what is the angle between the tangent lines on either end of the curved portion. A single polyline might have multiple curves, but will always have tangents between them.
My current function, without the additional functionality, takes a polyline input from modelspace and uses GetPointAtDist to calculate points along the polyline at set intervals. I’m not really sure where to start to get that additional info I need. I thought maybe I could build lines and curves along the polyline so that I could assign each segment/curve a variable but that seems inefficient.
Mick Sullivan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
You can get tangency vector then You can get angles between vectors
Point3d p0 = axis.GetPointAtDist(d0);
Vector3d v0 = axis.GetFirstDerivative(p0);
Point3d px = axis.GetPointAtDist(curentDist);
Vector3d v = axis.GetFirstDerivative(px);
double angle = v.GetAngleTo(v0);
2
To get the components of a Polyline, use Polyline.GetGeCurve(), this will return a CompositeCurve3d (AcGeCompositeCurve3d), which is a container of component curves that are connected end-to-end.
0