Attribute Extraction Wizard and VBA

Discussion in 'AutoCAD' started by Mrhault, Dec 17, 2004.

  1. Mrhault

    Mrhault Guest

    Hopefully someone can help me. I am new to programming in AutoCAD and having some difficulty.

    Starting with an open drawing in AutoCad2005, I want to perform the same task as the Attribute Extraction Wizard, only in VB. I don't change any of the options in the wizard until the output file type. I also do not want to see the Wizard during this process. What I would like to automate is this:

    Tools/Attribute Extraction...
    Current Drawing (Next>)
    Include xrefs, include nested blocks (Next>)
    No Template (Next>)
    Everything "Checked" (Next>)
    View output (Next>)
    Save template (Next>)
    Export C:\drawing01.txt (Tab delimited)

    The reason for not just using the Wizard is because I would like to process multiple files, but I am not at that point yet. Any help would be greatly appreciated. I hope I included all the info necessary to help with my problem.
     
    Mrhault, Dec 17, 2004
    #1
  2. Mrhault

    Oberer Guest

    "I am new to programming in AutoCAD and having some difficulty"
    are you proficient with vb(a)? do you need help with the code itself? if so, is there a particular part?
     
    Oberer, Dec 17, 2004
    #2
  3. Mrhault

    Mrhault Guest

    Thanks for the reply!
    I am fairly familar using vb for excel, thats about it. I would say that I would need code to get me started. If you said to x, y, and z, its doubtful that I would be able to code it. I can follow code I see for the most part, the "DIM" statements give me the most trouble because I dont know where and when to use them.
     
    Mrhault, Dec 17, 2004
    #3
  4. Mrhault

    Oberer Guest

    are you planning on doing the dialogues as well?
    have you written and pseudo code yet?

    as for the 'dim' statements, i'm sure you know you always want "option explicit" at the top of your module (forcing you to declare every var, instead of letting vba create variants for undeclareds)

    you have to "dim" all variables (and objects)

    do you have some 'basic cad code' for creating selection sets, etc?

    are you planning on dumping to a text file, to a table? a spreadsheet? i know you orignally mentioned a text file, but the later two are much more flexible, if you need it...
     
    Oberer, Dec 17, 2004
    #4
  5. Mrhault

    Dan Guest

    I am new and learning as well.

    Did you look at the Sample for Extracting Attributes? In 2002,2004,2005 it
    was located
    in this folder:
    c:\\<AcadainstallFolder>\Sample\ActiveX\ExtAttr

    The VBA macro is embedded in the sample Excel workbook.
    I modified the code to run from autocad, and push it to Excel instead of
    Excel pulling the attributes.

    This might help you get started.
    Good Luck,
    Dan
    task as the Attribute Extraction Wizard, only in VB. I don't change any of
    the options in the wizard until the output file type. I also do not want to
    see the Wizard during this process. What I would like to automate is this:
    process multiple files, but I am not at that point yet. Any help would be
    greatly appreciated. I hope I included all the info necessary to help with
    my problem.
     
    Dan, Dec 17, 2004
    #5
  6. How can you be "fairly familar using vb for excel" and not know about a DIM
    statement? VB is VB the only difference is the object model you are using.

    I'd recommend going to the library and getting a primer on VB or VBA before
    you start because you're going to hit a lot of hurdles if DIM has got you
    confused.

    As for the rest of your problems, do a google. There a hundreds of articles
    on writing to a text file [as well as a complete exampe in the VBA help
    file] and there is almost one question a week here on attributes.

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Dec 18, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.