.NET

Reply
Valued Mentor
joantopo
Posts: 675
Registered: ‎04-25-2010
Message 1 of 3 (218 Views)
Accepted Solution

get new id entity

218 Views, 2 Replies
12-27-2013 07:31 AM

Hi.

 

I am doing a routine to break a polyline in different points.

 

I do this by prompt with SendCommand.

 

   string strHandle1 = id.Handle.ToString();
   string strEntName1 = "(handent \"" + strHandle1 + "\")";


  string strCommand = "_BREAK" + "\n" + strEntName1 + "\n" + String_point + "\n" + String_point + "\n";
  Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute(strCommand, true, false, true);

 

However, I need the new Id of polyline to continue break in other point.

 

I have tried this:

 ObjectId idNewEntity = Autodesk.AutoCAD.Internal.Utils.EntLast();

to get the last entity created, but with "break" doesn´t consider new  entity created.

 

 

Then, How can I get the new Id after "break"?

 

Thanks in advance.

 

 

 

 

Autocad Civil 3D 2014 +SP1 // Civil 3D 2015
Quad Core Intel i7 3770-cpu 3.40Ghz.
ssd samsung 840 pro 512gb+ssd samsung 840 pro 256 gb+1tb hdd
32gb RAM 1600 Mhz.
nVidia Quadro 2000.
Win 7 Pro 64bit

I will use "GetSplitCurves()" that returns DBObjectCollection instead "break" command.

 

Thanks.

ADN Support Specialist
philippe.leefsma
Posts: 631
Registered: ‎06-02-2009
Message 2 of 3 (168 Views)

Re: get new id entity

12-31-2013 04:05 AM in reply to: joantopo

Hi,

 

My initial though would be rather to use the API to achieve that task. The polyline entity should provide the methods and properties required to replicate the BREAK command.

 

But if you want to stick to that approach, did you consider using a "Database.ObjectAppended" handler to grab the id's of newly created entities?

 

I hope it helps,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

Valued Mentor
joantopo
Posts: 675
Registered: ‎04-25-2010
Message 3 of 3 (164 Views)

Re: get new id entity

12-31-2013 04:41 AM in reply to: philippe.leefsma

I will use "GetSplitCurves()" that returns DBObjectCollection instead "break" command.

 

Thanks.

Autocad Civil 3D 2014 +SP1 // Civil 3D 2015
Quad Core Intel i7 3770-cpu 3.40Ghz.
ssd samsung 840 pro 512gb+ssd samsung 840 pro 256 gb+1tb hdd
32gb RAM 1600 Mhz.
nVidia Quadro 2000.
Win 7 Pro 64bit

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.