How to break an entity using C#

How to break an entity using C#

Anonymous
Not applicable
1,092 Views
2 Replies
Message 1 of 3

How to break an entity using C#

Anonymous
Not applicable
Hi, I have a line in the modelspace, and i want to program to break it at a point (already known).

Thanks!
0 Likes
1,093 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Check out...
Autodesk.AutoCAD.DatabaseServices.Curve.GetSplitCurves
0 Likes
Message 3 of 3

Anonymous
Not applicable
Thanks, it works. but i think it's a little complex. my code is attached below, do you have any idea to simple it?

Line line = new Line(new Point3d(100, 10, 0), new Point3d(200, 20, 0));
Tools.AddToCurrentSpace(line); //a sealed tool to help add entitys to modelspace

Point3d[] arrP3s=new Point3d[1]{new Point3d(150, 15, 0)};
Point3dCollection p3c = new Point3dCollection(arrP3s);
DBObjectCollection dboc=line.GetSplitCurves(p3c);
IEnumerator enumDbOc=dboc.GetEnumerator();
while(enumDbOc.MoveNext())
{
Line lineTemp = (Line)enumDbOc.Current;
Tools.AddToCurrentSpace(lineTemp);
}

Tools.Erase(line.Id); //remove the entity from the modelspace by id.
0 Likes