Author Topic: Extract custom info from a dynamic block look up table  (Read 1613 times)

0 Members and 1 Guest are viewing this topic.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4043
Extract custom info from a dynamic block look up table
« on: January 16, 2007, 02:50:49 PM »
Has anyone every done this? I put some part numbers in the look up table, but cant seem to find where they are in code
« Last Edit: January 16, 2007, 02:51:50 PM by CmdrDuh »
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

daron

  • Guest
Re: Extract custom info from a dynamic block look up table
« Reply #1 on: January 16, 2007, 04:01:55 PM »
I believe that the problem with dyn blks is that you are looking at objects that are in the unnamed block section, i.e. *u234

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4043
Re: Extract custom info from a dynamic block look up table
« Reply #2 on: January 16, 2007, 04:57:26 PM »
does that mean you cant get the info?  I can see that the block is named U11, but I dont see any of the custom data associated with it.

i found this, but couldn't figure out how to make it work
Quote
object.GetDynamicBlockProperties

object

BlockRef, MInsertBlock
The object or objects this method applies to.

Remarks

BlockRef.GetDynamicBlockProperties returns a collection of DynamicBlockReferenceProperty objects if the block reference is a dynamic block containing custom properties.

Note To access this method, use the IAcadBlockReference2 or IAcadMInsertBlock2 interface.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

daron

  • Guest
Re: Extract custom info from a dynamic block look up table
« Reply #3 on: January 16, 2007, 10:31:57 PM »
Sorry, as far as I gotcha, is as far as I can getcha.

Bryco

  • Water Moccasin
  • Posts: 1864
Re: Extract custom info from a dynamic block look up table
« Reply #4 on: January 16, 2007, 11:41:00 PM »
Perhaps this will get you started.

Code: [Select]
Private Sub Dy()
   
    Dim oBref As IAcadBlockReference2
    Dim oDynProp As AcadDynamicBlockReferenceProperty
    Dim arr
    Set oBref = EntSel
    Debug.Print oBref.Name, oBref.EffectiveName
    arr = oBref.GetDynamicBlockProperties
    Dim i As Integer
    For i = 0 To UBound(arr)
        Set oDynProp = arr(i)
        Debug.Print "PropertyName=" & oDynProp.PropertyName
        If Not IsArray(oDynProp.Value) Then
            Debug.Print oDynProp.Value
        Else
            Dim V As Variant
            V = oDynProp.Value
            Dim j As Long
            For j = LBound(V) To UBound(V)
                Debug.Print V(j)
            Next j
        End If
    Next i
End Sub