1 Attachment(s)
my block dinamic hatch can not change length and angle
i have code to dinamic block using hatch but while distance1 is changed and angle1 is changed
my hatch can not update distance1 and angle1
please help every body
Code:
Sub test1()
Dim j As String, Sudut As Double, jarak As Double
Dim a As AcadBlockReference
jarak = ThisDrawing.Utility.GetString(1, vbCrLf & "Masukkan Jarak: ")
x = ThisDrawing.Utility.GetPoint(, "Klik titik awal")
jarak = CDbl(jarak)
Sudut = Atn(1)
Set a = ThisDrawing.ModelSpace.InsertBlock(x, "a1", 1, 1, 1, 0) 'a1 ganti dengan nama blokc
If a.IsDynamicBlock = True Then
Props = a.GetDynamicBlockProperties
For Index = LBound(Props) To UBound(Props)
Set prop = Props(Index)
If prop.PropertyName = "Distance1" Then
prop.Value = jarak
ElseIf prop.PropertyName = "Angle1" Then
prop.Value = Sudut
End If
ThisDrawing.Regen acAllViewports
Next Index
End If
End Sub
1 Attachment(s)
Re: my block dinamic hatch can not change length and angle
this is my image please help me what is wrong
Attachment 107610
3 Attachment(s)
Re: my block dinamic hatch can not change length and angle
Your hatch was not included in the stretch action. I redefined it by modifying the stretch action's selection set and doing a crossing window using points 1,2. After that, the code worked...with modifications. You had 4 variables that were not dimensioned. If you add Option Explicit to the top of each module as shown, the IDE will notify you if you try to use a var that has not been dim'ed. If you set Require Variable Declarations in your VBA options, it will add Option Explicit to new modules.