Author Topic: Dynamic Block with field  (Read 2196 times)

0 Members and 1 Guest are viewing this topic.

nburr3551

  • Guest
Dynamic Block with field
« on: November 10, 2008, 01:36:02 PM »
I have created a dynamic block with a field attached that updates when the block is stretched or visibility changes. I need to be able to read the value using VBA but don't know how to access the info.

nburr3551

  • Guest
Re: Dynamic Block with field
« Reply #1 on: November 13, 2008, 03:56:38 PM »
Not sure if its proper or correct but made a copy of the blockreference exploded it read value and deleted all exploded objects from block.

Public Function Get_Wt(BlockRefObj)
 ' Define the block
 Dim blockObj As AcadBlock
 
 ' Explode the block reference
 Dim explodedObjects As Variant
 Dim copyblockobj As Variant
 Set copyblockobj = BlockRefObj.COPY()
 explodedObjects = BlockRefObj.Explode
 
 ' Loop through the exploded objects
 Dim I As Integer
 For I = 0 To UBound(explodedObjects)
 If explodedObjects(I).ObjectName = "AcDbMText" Then
    wght = explodedObjects(I).TextString
 End If
 explodedObjects(I).DELETE
 Next
 Get_Wt = wght
End Function

 :|