I tried to set Polyline.StartPoint to new position (Point3d):
Polyline.StartPoint = myNewPoint3d;
I have "not implemented" exception.
Also, I tried to do it as:
var seg0 = acEnt.GetLineSegmentAt(0);
seg0.Set(newPoint3d(0, 0, 0), seg0.EndPoint);
It doesn't work also.
I can do it as:
acEnt.SetPointAt(0, my2dPoint);
But it's 2D point, not 3d
Of course I can remove polyline and create it again, but...
How to set start point correctly for 3d point?
Pavel
Solved! Go to Solution.
Solved by Hallex. Go to Solution.
Here is a quick and dirty snip you will be use as framework,
change to your suit
[CommandMethod("SPT")] public void chageStartPoint() { PromptEntityOptions peo = new PromptEntityOptions("\nSelect a segment where to add a vertex: "); peo.SetRejectMessage("\nIncorrect entity"); peo.AllowNone = false; peo.AllowObjectOnLockedLayer = false; peo.AddAllowedClass(typeof(Polyline), true); PromptEntityResult per = ed.GetEntity(peo); if (per.Status == PromptStatus.OK) { ObjectId id = per.ObjectId; try { using (Transaction tr = db.TransactionManager.StartTransaction()) { Polyline pline = tr.GetObject(id, OpenMode.ForRead, false) as Polyline; if (pline != null) { pline.UpgradeOpen(); Point3d pt = ed.GetPoint("\nPick new start point location: ").Value; Point2d sp = pt.Convert2d(new Plane(Point3d.Origin, pline.Normal)); pline.AddVertexAt(0, sp, 0, pline.ConstantWidth, pline.ConstantWidth); pline.RemoveVertexAt(1); } tr.Commit(); } } catch (System.Exception ex) { ed.WriteMessage( ex.Message); } } }
~'J'~
You need to extend this code
Add in there the part to work with different
coordinate system etc
You're welcome
~'J'~
Can't find what you're looking for? Ask the community or share your knowledge.