.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to break an entity using C#

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
814 Views, 2 Replies

How to break an entity using C#

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

Thanks!
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

Check out...
Autodesk.AutoCAD.DatabaseServices.Curve.GetSplitCurves
Message 3 of 3
Anonymous
in reply to: Anonymous

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost