Message 1 of 13
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am trying to learn how to draw perpendicular lines on Polyline with arc segments by dividing the polyline's length into 15 times in C#.
The length of each drawn Line is = 10.0 units.
Thanks in adnace.
I tried coding it this way and I don't know how to draw the perpendicular lines.
public static void PerpendicularLines()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
using (Transaction tr = db.TransactionManager.StartTransaction())
{
PromptEntityOptions op = new PromptEntityOptions("\nSelect polyline :");
op.SetRejectMessage("Must be Polyline");
op.AddAllowedClass(typeof(Polyline), true);
op.AllowNone = false;
PromptEntityResult s = ed.GetEntity(op);
if (s.Status == PromptStatus.OK)
{
Polyline ent = (Polyline)tr.GetObject(s.ObjectId, OpenMode.ForRead);
Line drawLine = new Line();
double length = ent.Length;
double gap = length / 15.0;
double dis = gap;
int run = ((int)gap);
for (int i = 0; i < run; i++)
{
Point3d p1 = ent.GetPointAtDist(dis);
Vector3d ang = ent.GetFirstDerivative(ent.GetParameterAtPoint(p1));
// I lost here and don't know how to create the lines ...
dis = dis + gap;
}
}
tr.Commit();
}
}
Solved! Go to Solution.