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

Explode

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
amitnkukanur
1048 Views, 9 Replies

Explode

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

Senior Software Engineer
9 REPLIES 9
Message 2 of 10
norman.yuan
in reply to: amitnkukanur

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

Message 3 of 10
amitnkukanur
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

Senior Software Engineer
Message 4 of 10
norman.yuan
in reply to: amitnkukanur

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.

Message 5 of 10
cdinten
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 ?
Message 6 of 10
norman.yuan
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.

Message 7 of 10
amitnkukanur
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
Senior Software Engineer
Message 8 of 10
cdinten
in reply to: norman.yuan

ok, thanks norman, can you recommand some resources of using COM ?
Message 9 of 10
norman.yuan
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.

Message 10 of 10
cdinten
in reply to: norman.yuan

ok, that's very helpful, thank you!

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