TheSwamp

Code Red => VB(A) => Topic started by: nburr3551 on November 10, 2008, 01:36:02 PM

Title: Dynamic Block with field
Post by: nburr3551 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.
Title: Re: Dynamic Block with field
Post by: nburr3551 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

 :|