- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to draw a line which starts from user insertion point with an angle (180 deg) of length x,
and wanted to draw another lines on both the end points vertical down with an angle (270 deg ) of length x on both sides
please help me whats gone wrong with my code
Thanks in Advance ;;
double angle = 180;
double length = 50;
double angle1 = 270;
double length1 = 10;
BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
BlockTableRecord btr = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
PromptPointOptions ppo = new PromptPointOptions("Please Specify the Point");
PromptPointResult ppr = ed.GetPoint(ppo);
if (ppr.Status != PromptStatus.OK)
return;
Point3d startPt = ppr.Value;
Point3d endPt = new Point3d(startPt.X + Math.Cos(angle) * length, startPt.Y + Math.Sin(angle) * length, 0);
Line l1 = new Line(startPt, endPt);
btr.AppendEntity(l1);
tr.AddNewlyCreatedDBObject(l1, true);
//Secondline
Point3d endPt2 = new Point3d(endPt.X + Math.Cos(angle1) * length1, endPt.Y + Math.Sin(angle1) * length1, 0);
Line l2 = new Line(endPt, endPt2);
btr.AppendEntity(l2);
//Thirdline
Point3d endPt3 = new Point3d(endPt.X + Math.Cos(angle1) * length1 , endPt.Y + Math.Sin(angle1) * length1 , 0);
Line l3 = new Line(startPt, endPt3);
btr.AppendEntity(l3);
tr.Commit();
Solved! Go to Solution.
