Afternoon,

Currently have a VBA program that inserts a dynamic block onto the drawing. It then updates the Dynamic Block Properties, Attributes and Layer settings based on the addition information provided by the user. And typically this process from start to finish takes about 1 to 2 seconds per dynamic block.

However, if we need to add in multiple blocks, you can see how the amount of time really can increase.

Using some timers in the code, I found the biggest cause of the time increase is updating the dynamic block properties. Is there a way in VBA to update or set the Dynamic Block Properties before inserting? My thought is AutoCAD inserts the block first in its base state then it has to redraw it again based on the values.



Private Sub UpdateDynamicBlockTags()


' Change Dynamic Block Values Based on Tag

Dim objBRef As AcadBlockReference
Dim dblangle As Double
Dim BLKINSERTPT As ACAD_POINT

Set objBRef = ThisDrawing.ModelSpace.InsertBlock(BLKINSERTPT, UserForm1.TextBox14.text, 1, 1, 1, dblangle)

Dim dybprop As Variant
Dim i As Integer

If objBRef.ObjectName = "AcDbBlockReference" Then
If objBRef.IsDynamicBlock Then
dybprop = objBRef.GetDynamicBlockProperties
For i = LBound(dybprop) To UBound(dybprop)
If dybprop(i).PropertyName <> "Origin" Then
If dybprop(i).PropertyName = "LENGTH" Then
dybprop(i).Value = Length_Tag
End If
End If
Next i
End If
End If


End Sub

Please let me know when you can.