简体   繁体   中英

How to enumerate through Autocad Entities without using Autocad.Interop?

I'd like to enumerate all entities in an Autocad Drawing, but not using Autocad.Interop reference.

With Interop I could just pick:

IAcadApplication App = (IAcadApplication)Application.AcadApplication;
IAcadDocument Doc = App.ActiveDocument;

foreach (IAcadEntity Ent in Doc.ModelSpace) // or paperspace, or any IAcadBlock

But with the Object Arx references I can only find tutorials to get entities using transactions in a database, taking objects by ID. I think that's really boring stuff to slow down the works.

That's the way we do it. You have either the Interop code, or some fashion of objectid iteration.

Here's a good article from the Dev Network: http://adndevblog.typepad.com/autocad/2012/05/whats-the-best-way-to-iterate-through-an-entire-database.html

If you are going to work with C#, I recommend just biting the bullet, and moving on to use transactions and such, there is really no way around it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM