Results 1 to 4 of 4

Thread: (Simple?) AutoCAD VBA Question

  1. #1
    Member
    Join Date
    2010-07
    Posts
    2
    Login to Give a bone
    0

    Default (Simple?) AutoCAD VBA Question

    Hello all,

    I am quite experienced in using VBA with Excel, however I have never used it before with AutoCAD. My experience with AutoCAD is lijmited however I have used it.

    I use Autodesk ADT 2005.

    A few questions:

    1) is there a good resource of all the keywords somewhere, for terminology purposes?
    2) Does AutoCAD distinguish between the objects in a drawing (inserted, lines, etc) or all they all "objects"?

    and a specific question: How difficult would it be to create a program to go through a large AutoCAD drawing and check each object's size (in memory), and delete objects larger than a given size?

    Something like
    Code:
    Sub test()
        Dim varObject As Object
        For Each varObject In Me.AcadDocument
        
        'check size, delete if too large
        
        
        Next varObject
    End Sub
    I could do this quite easily in Excel VBA but am quite confused here I know that me.acaddocument is incorrect syntax too, but am not sure how to fix it.

    Many thanks

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,397
    Login to Give a bone
    0

    Default Re: (Simple?) AutoCAD VBA Question

    1. See the developer guid in the acad install folder ...\Help\acad_dev.chm
    2. Yes, they are called 'entities' in acad terms.
    3. Acad objects don't have a 'size' property, i.e. not in bytes (except for embedded OLE). The dwg file is just a database, and objects are stored in tables. So they are just a db record. Size in bytes is the same for most objects. The record is used by the graphics engine to draw the object on screen. Besides, if you deleted based upon memory size, how would know if the information you deleted was important or not?
    C:> ED WORKING....

  3. #3
    Member
    Join Date
    2010-07
    Posts
    2
    Login to Give a bone
    0

    Default Re: (Simple?) AutoCAD VBA Question

    Quote Originally Posted by Ed Jobe View Post
    1. See the developer guid in the acad install folder ...\Help\acad_dev.chm
    2. Yes, they are called 'entities' in acad terms.
    3. Acad objects don't have a 'size' property, i.e. not in bytes (except for embedded OLE). The dwg file is just a database, and objects are stored in tables. So they are just a db record. Size in bytes is the same for most objects. The record is used by the graphics engine to draw the object on screen. Besides, if you deleted based upon memory size, how would know if the information you deleted was important or not?
    Good information (even if it tells me I probably cannot do what I want to do... ).

    Many of the layouts I deal with have imbedded graphics or CAD files causing very large file sizes. I would prefer to eliminate all non-arc/line/etc types of objects, and leave it as just basic autoCAD objects.

    Perhaps that is more clear, as I realize now that from what I wrote before it probably was not all that clear at all.

  4. #4
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,397
    Login to Give a bone
    0

    Default Re: (Simple?) AutoCAD VBA Question

    If that is the case, you can look for OLE objects. However, rather than just deleting them, you may want to also extract them and log what you've done so that you can replace the objects they displayed. I just did that (manually). There was an embedded xls. I saved it to a new file and created a datalink and then added a table.
    Last edited by Ed Jobe; 2010-07-14 at 03:18 PM.
    C:> ED WORKING....

Similar Threads

  1. Simple Question, again
    By BeKirra in forum AutoLISP
    Replies: 4
    Last Post: 2008-11-23, 09:32 PM
  2. Simple Question: tool palettes Autocad
    By sschwartz85916 in forum AutoCAD Customization
    Replies: 3
    Last Post: 2008-01-23, 04:30 PM
  3. dwf simple question
    By 4vinci in forum DWF Viewer - General
    Replies: 1
    Last Post: 2007-10-12, 05:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •