Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations Danlap on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA - List of objects in a drawing

Status
Not open for further replies.

tuli

Electrical
Feb 20, 2003
16
Hello,

I have a huge file with numerous objects I need to work on.
I need to identify various bodies that I cannot see in the GUI. The screen is very busy and I need to extract some objects and delete unnecessary ones, but it is too risky to do it with the GUI. I would like to do it with a script so I can have 100% control on what I am doing.

I would like to have the list of all objects and as much information I can get (layer, bounding box, object type etc.)

I would like to generate this list in VBA.

Any ideas?


Thank you
 
Replies continue below

Recommended for you

Hi,

I now nothing about the AutoCAD Application Object Model.

But I do know how object models work.

An object model I’m familiar with and I’d bet you might have some familiarity with is the Excel Object Model.
So you need to know the AutoCAD Application Object Model very well.

So using our commonly understood object model, what if I wanted to know all the Chart Objects I had in all open workbooks...
Code:
‘
   Dim wb As Workbook, ws As Worksheet, co As ChartObject, ch As Chart

   For Each wb In Excel.Workbooks
      For Each ws In wb.Worksheets
         Select Case ws.Type
            Case xlWorksheet
               For Each co In ws.co
                  Debug.Print co.Name, ws.Name, wb.Name
               Next
            Case xlChart
               Debug.Print ws.Chart.Name, ws.Name, wb.Name
         End Select
      Next
   Next

So you would need to do something like this for each object of interest.

Skip,

[glasses]Just traded in my OLD subtlety...
for a NUance![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor