.NET

Reply
Mentor
amitk_189
Posts: 238
Registered: ‎12-15-2011
Message 1 of 10 (307 Views)
Accepted Solution

Explode

307 Views, 9 Replies
04-15-2014 04:29 AM

Hello, I am doing a customization in AutoCAD2013 using C# as development language. The Application runs outside AutoCAD and is a COM Application. However i am stuck at explode option currently i am sending command to AutoCAD to select all and then explode. This works some times and some times doesn't work hence results are improper

 

Is there any possibility to explode using COM interface.

 

rgds

Amit

*Expert Elite*
norman.yuan
Posts: 985
Registered: ‎04-27-2009
Message 2 of 10 (290 Views)

Re: Explode

04-15-2014 06:14 AM in reply to: amitk_189

Yes, COM API does provide "Explode" functionality. All of the explode-able COM objects (AcadBlockReference, AcadLWPolyline, AcadRegion...) have a method Explode().

Mentor
amitk_189
Posts: 238
Registered: ‎12-15-2011
Message 3 of 10 (266 Views)

Re: Explode

04-15-2014 11:46 PM in reply to: norman.yuan

Hi Norman Yuan,

 

Thanks for reply.

 

Actually this is my below code which i did earlier for Explode, It is not exploding the the way Explode command does.

 

 

foreach (AcadEntity acadEnt inacApp.ActiveDocument.Database.ModelSpace)

{

AcadBlockReference acadBlkRef = null;

 

if (acadEnt.ObjectName.Equals("AcDbBlockReference"))

{

acadBlkRef = acadEnt as AcadBlockReference;

 

//acadBlkRef.Delete();

acadBlkRef.Explode(); }

}

acApp.ActiveDocument.Save();

 

How should i explode all data present in drawing, please feel free to change the logic.

 

 

rgds

Amit

*Expert Elite*
norman.yuan
Posts: 985
Registered: ‎04-27-2009
Message 4 of 10 (254 Views)

Re: Explode

04-16-2014 06:30 AM in reply to: amitk_189

Well, Explode() method in the COM API does not equal to AutoCAD command "EXPLODE".

 

The Explode() method simply retuen an array of AcadObjects that makes up the entity "being exploded", which itself remains unchanged after calling the Explode() method.

 

So, if your intention is to do the same as AutoCAD's EXPLODE command, after you call the Explode() method, which generates a set of individual entities, you need to erase the entity being exploded.

Valued Contributor
cdinten
Posts: 61
Registered: ‎11-19-2010
Message 5 of 10 (253 Views)

Re: Explode

04-16-2014 06:51 AM in reply to: norman.yuan
does COM add all the AcadObjects that make up the entity into the Database, or should we have to provide some codes to add them into database ?
*Expert Elite*
norman.yuan
Posts: 985
Registered: ‎04-27-2009
Message 6 of 10 (242 Views)

Re: Explode

04-16-2014 10:44 AM in reply to: cdinten

No, in COM API, there is no Database/Transaction concept. The AcadObjects generated by calling Explode() method are already in drawing database when the call ends.

Mentor
amitk_189
Posts: 238
Registered: ‎12-15-2011
Message 7 of 10 (227 Views)

Re: Explode

04-17-2014 04:34 AM in reply to: norman.yuan
Hi Norman Yuan,

Thanks for reply and i will work on the idea which you provided. Thanks for replying.

rgds
Amit
Valued Contributor
cdinten
Posts: 61
Registered: ‎11-19-2010
Message 8 of 10 (226 Views)

Re: Explode

04-17-2014 04:52 AM in reply to: norman.yuan
ok, thanks norman, can you recommand some resources of using COM ?
*Expert Elite*
norman.yuan
Posts: 985
Registered: ‎04-27-2009
Message 9 of 10 (220 Views)

Re: Explode

04-17-2014 06:13 AM in reply to: cdinten

If you ever did AutoCAD VBA development, you would know to go to AutoCAD's VBA editor, open "Object Browser", select any Object/property/Mothd in Object Browser and click "?" buttom to open VBA Help. In comparison to .NET documentation, COM API is fairly well documented in VBA help, almost every Object/Method/Property comes with sample code.

Valued Contributor
cdinten
Posts: 61
Registered: ‎11-19-2010
Message 10 of 10 (193 Views)

Re: Explode

04-20-2014 08:47 PM in reply to: norman.yuan
ok, that's very helpful, thank you!
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.