See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Extracting Object Data into an Attributed Block

  1. #1
    Login to Give a bone
    0

    Question Extracting Object Data into an Attributed Block

    Hello Folks,
    I was wondering how I can use VBA to extract object data information from an object and put that information into an attributed block. I think I have to go along the ODtable.getODRecords or ODFieldValue way but i'm not to sure how to go about it. If you could lead me in the right direction that would be wonderful.
    Thank you

  2. #2
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    1

    Default Re: Extracting Object Data into an Attributed Block

    What version of AutoCAD are you using? If you have AutoCAD 2005, take a look at Fields.

  3. #3
    AUGI Addict
    Join Date
    2015-12
    Location
    Arizona
    Posts
    2,337
    Login to Give a bone
    0

    Default Re: Extracting Object Data into an Attributed Block

    If this user were to use fields then the question would
    need to be how does he extract object data to fill in those fields?

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

    Default Re: Extracting Object Data into an Attributed Block

    Only if he has 2005. I think Robert's just waiting for his response so that he doesn't provide an answer that's not needed.
    C:> ED WORKING....

  5. #5
    Administrator richard.binning's Avatar
    Join Date
    2015-12
    Location
    In the foothills of the appalachians
    Posts
    2,260
    Login to Give a bone
    0

    Default Re: Extracting Object Data into an Attributed Block

    Quote Originally Posted by brennan.cunningham
    Hello Folks,
    I was wondering how I can use VBA to extract object data information from an object and put that information into an attributed block. I think I have to go along the ODtable.getODRecords or ODFieldValue way but i'm not to sure how to go about it. If you could lead me in the right direction that would be wonderful.
    Thank you
    ODtable.getODRecords? Sounds suspiciously like the OpenDrawing libraries to me. Is that right?

  6. #6
    AUGI Addict
    Join Date
    2015-12
    Location
    Arizona
    Posts
    2,337
    Login to Give a bone
    1

    Default Re: Extracting Object Data into an Attributed Block

    The user is attempting to extract AutoDesk MAP
    Object Data Records into block attributes.

  7. #7
    Login to Give a bone
    0

    Default Re: Extracting Object Data into an Attributed Block

    Yes I am using Autocad Map 3D 2005. I was given this code as an example but it doesn't seem to work.

    __________________________________________________________

    Code:
      Dim ODrcs As ODRecords
      Dim returnObj As AcadObject
      Dim i As Integer
      Dim strMsg As String
      Dim boolVal
    
      Set amap = ThisDrawing.Application.GetInterfaceObject("AutoCADMap.Application")
      Set ODrcs = amap.Projects.item(ThisDrawing).ODTables.item("MY_OD_TABLE_NAME").GetODRecords
      
      
      'Prompt user to select an object
      ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select an object"
      
      boolVal = ODrcs.Init(returnObj, True, False)
      strMsg = ODrcs.Record.tableName & vbNewLine
      strMsg = strMsg & ODrcs.Record.objectID & vbNewLine
      
      For i = 0 To ODrcs.Record.count - 1
        strMsg = strMsg & ODrcs.Record.item(i).Value & vbNewLine
      Next i
     
      MsgBox strMsg
    __________________________________________________________


    I always get a run time error on this line:
    Set amap = ThisDrawing.Application.GetInterfaceObject("AutoCADMap.Application")

    any suggestions?
    Last edited by Opie; 2007-10-17 at 01:39 PM. Reason: [CODE] tags added

  8. #8
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: Extracting Object Data into an Attributed Block

    Do you have more than one version installed?

    Does this make a difference?
    Set amap = ThisDrawing.Application.GetInterfaceObject("AutoCADMap.Application.16.1")

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

    Default Re: Extracting Object Data into an Attributed Block

    BTW, Brennan, It would have been helpful if you included this info with your first post.
    C:> ED WORKING....

  10. #10
    Login to Give a bone
    0

    Smile Re: Extracting Object Data into an Attributed Block

    Mr. Farrell helped me out - he suggested using an annotation template which extracted the object data information to a block. It was what I was looking for.

    Thanks again Mr. Farrell

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 2008-02-12, 12:51 PM
  2. Replies: 0
    Last Post: 2008-02-07, 05:29 PM
  3. Extracting Object Data from Map 3D 2006
    By tim.ashton in forum VBA/COM Interop
    Replies: 0
    Last Post: 2007-05-23, 02:28 PM
  4. Extracting Object Data from entities in AutoCAD MAP
    By snviswanadha in forum AutoLISP
    Replies: 8
    Last Post: 2006-08-29, 05:15 AM

Posting Permissions

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