How to get parrameter from dynamic block

How to get parrameter from dynamic block

danijel.radenkovic
Collaborator Collaborator
1,277 Views
2 Replies
Message 1 of 3

How to get parrameter from dynamic block

danijel.radenkovic
Collaborator
Collaborator

Hello to all,

I have created an dynamic block. Block consist of Two Points, one Linear Parameter and an Dimensional Constraint between them. Using "Stretch" action, I can change distance between points by moving one of the points, so dimensional constraint updates immediately. My question: How to get the value of the linear dimension inside the block?

 

Any help is very appreciated.

Danijel

Inventor 2018/Windows 10 x64
If this information was helpful, please consider marking it as an Accepted Solution by using the Accept as Solution. Kudos are also gladly accepted.
0 Likes
Accepted solutions (1)
1,278 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

 

 

use  GetDynamicBlockProperties() method of the BlockReference object

 

for instance, the following function will return the value of the passed block reference dynamic property named after passed propName parameter

 

Function GetPropertyValue(objBlockRef As AcadBlockReference, propName As String) As Variant
    Dim iProp As Long
    Dim dybprop As Variant
    
    If objBlockRef.IsDynamicBlock Then '<--| if the passed block reference is a dynamic block one
        dybprop = objBlockRef.GetDynamicBlockProperties '<--| get its dynamic properties
        For iProp = LBound(dybprop) To UBound(dybprop) '<--| iterate through them properties
            With dybprop(iProp)
                If .PropertyName = propName Then '<--| if the current property matches the passed name
                    GetPropertyValue = .Value '<--| return ist value
                    Exit Function
                End If
            End With
        Next
    End If
End Function

that you could use as follows:

 

Sub main()
    Dim returnBlck As AcadBlockReference
    
    ' code to have the user select the block reference to query property of
    ' ...
    
    MsgBox GetPropertyValue(returnBlck, "SW") '
End Sub
Message 3 of 3

danijel.radenkovic
Collaborator
Collaborator

That's I was looking for.

Thank you!

 

Inventor 2018/Windows 10 x64
If this information was helpful, please consider marking it as an Accepted Solution by using the Accept as Solution. Kudos are also gladly accepted.
0 Likes