HOW DYNAMICBLOCK EVERYPROPERTY NAME VALUE CHANGE IN VBA ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Plse Help how i change vertical direction stretch value in autocad vba
my code is :
Private Sub CommandButton1_Click()
UserForm1.Hide
With ThisDrawing.SelectionSets
While .Count > 0
.Item(0).Delete
Wend
End With
Dim oSset As AcadSelectionSet
Dim ftype(0) As Integer
Dim fdata(0) As Variant
Dim D1 As String
Dim D2 As String
Dim L1 As ACAD_DISTANCE
Dim L2 As ACAD_DISTANCE
D1 = TextBox1.Text
D2 = TextBox2.Text
L1 = ThisDrawing.Utility.DistanceToReal(D1, acDecimal)
L2 = ThisDrawing.Utility.DistanceToReal(D2, acDecimal)
CL = L1 / 2
ftype(0) = 0: fdata(0) = "INSERT"
Set oSset = ThisDrawing.SelectionSets.Add("SomeSet")
oSset.SelectOnScreen ftype, fdata
Dim oEnt As AcadEntity
Dim blkref As AcadBlockReference
For Each oEnt In oSset
Set blkref = oEnt
If blkref.IsDynamicBlock Then
ChangeDynProperty blkref, "JAI", CL
ChangeDynProperty blkref, "MANI", CL
End If
Next
End Sub
Private Sub Label1_Click()
End Sub
Private Sub UserForm_Click()
End Sub
Public Function GetDynProps(ByVal blkref As AcadBlockReference) As Variant
If Not blkref.IsDynamicBlock Then
GetDynProps = Null
Else
GetDynProps = blkref.GetDynamicBlockProperties
End If
End Function
Public Sub ChangeDynProperty(ByVal blkref As AcadBlockReference, _
ByVal pName As String, ByVal pValue As Variant)
Dim bProps As Variant
bProps = GetDynProps(blkref)
Dim n
For n = 0 To UBound(bProps)
Dim curProp As AcadDynamicBlockReferenceProperty
Set curProp = bProps(n)
On Error Resume Next
If curProp.Name = pName Then
curProp.Value = pValue
End If
If Err Then
Err.Clear
End If
On Error GoTo 0
Next
End Sub