+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    j_r_auden
    Guest

    Default Extracting attribute data

    Registered forum members do not see this ad.

    I have a block in my drawing that has 2 attributes attached to it. Let's say length and size are the 2 attributes.
    I need a little help writing this code as I am a C++ programmer.


    For Each block In MyBlocksSet
    If the size attribute = 1
    size1count += this blocks length attribute
    Else if the size attribute = 2
    size2count += this blocks length attribute
    ............
    ............
    Next

    I am having trouble extracting the data though. How could I do something simple like extract a block's length attribute and display it. I know I am close but I can't seem to do something as simple as this.

    Also, do you know of any good books on VBA in a CAD environment.
    I can find many books on VB and VBA, but not many dealing with the AutoCAD aspects of VBA.

    Thanks for the help !!!!!!!!

  2. #2
    Administrator CADTutor's Avatar
    Computer Details
    CADTutor's Computer Details
    Operating System:
    Windows 7 Home Premium 64bit
    Motherboard:
    Asus P7P55D-E PRO
    CPU:
    Intel Core i7-860
    RAM:
    4GB PC3-12800 C8 Corsair Dominator
    Graphics:
    NVIDIA Quadro FX 1800 768 MB
    Primary Storage:
    Intel X25-M SSD 160GB
    Secondary Storage:
    Samsung Spinpoint 320GB
    Monitor:
    BenQ FP241W 24" Wide
    Discipline
    Education
    CADTutor's Discipline Details
    Occupation
    Senior Lecturer (Digital Design), Landscape Architect & Web Designer
    Discipline
    Education
    Using
    AutoCAD 2014
    Join Date
    Aug 2002
    Location
    Hampshire, UK
    Posts
    3,606

    Default

    Unfortunately I don't have any specific advice but you could do worse that look here for a start.
    Tip: Please do not PM or email me with CAD questions - use the forums, you'll get an answer sooner.
    AutoCAD Tutorials | How to add images to your posts | How to register successfully | Forum FAQ

  3. #3
    Super Member
    Using
    AutoCAD 2007
    Join Date
    Aug 2003
    Location
    Livingston, Scotland
    Posts
    995

    Default

    Registered forum members do not see this ad.

    check out my answer to your other post
    http://www.cadtutor.net/forum/viewto...?p=12483#12483

    it will be something like

    Code:
    For Each block In MyBlocksSet
    Myattributes=block.getattributes
    TheLength=MyAttributes(0).textstring
    msgbox TheLength
    Next  block
    of course, if there is more than one attribute, then you need to check which attribute you actually have at any given time
    ResourceCAD.... the Resource for your CAD Solutions

Bookmarks

Posting Permissions

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