Message 1 of 2

Not applicable
06-07-2018
11:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
It seems that I just don't have the best luck with my blocks. I have a function that is used to insert dynamic blocks into Modelspace and set some of its dynamic attributes according to specifications made in an Excel spreadsheet I'm reading from. I don't know what is causing this, but I am unable to change the values for the dynamic properties. I get the properties and read the values, but when I try to write the value, the routine exits without error. Here is the code to insert gridlines. Am I missing something simple?
Sub InsertGridline(ByRef insertionPnt As Variant, ByVal distance As String, ByVal totalDist As String, ByVal bubbleName As String) Dim newBlock As AcadBlockReference
If vertical Then
insertionPnt(0) = insertionPnt(0) + CalculateDistance(distance)
blockPath = "T:\Engineering\01-FIXED\50- New Template\TITLE BLOCKS\DYNAMIC BLOCKS\V_GRIDLINE.dwg"
Else
insertionPnt(1) = insertionPnt(1) + CalculateDistance(distance)
blockPath = "T:\Engineering\01-FIXED\50- New Template\TITLE BLOCKS\DYNAMIC BLOCKS\H_GRIDLINE.dwg"
End If
'Insert the block Set newBlock = ThisDrawing.ModelSpace.insertBlock(insertionPnt, blockPath, 1#, 1#, 1#, 0)
Dim attList As Variant
Dim att As AcadAttributeReference attList = newBlock.GetAttributes For i = 0 To UBound(attList) Set att = attList(i) att.TextString = bubbleName Next Dim name As String
Dim DynamicAttList As Variant Dim prop As AcadDynamicBlockReferenceProperty DynamicAttList = newBlock.GetDynamicBlockProperties For i = 0 To UBound(DynamicAttList) Set prop = DynamicAttList(i) name = prop.PropertyName If name = "GL Length" Then prop.Value = totalDist
' "DynamicAttList(i).Value = totalDist" does not work either ElseIf name Like "*Perp*" Then prop.Value = 0 ElseIf name Like "*Para*" Then prop.Value = 0 ElseIf name Like "*Flip*" Then prop.Value = "Not Flipped" End If Next End Sub
Solved! Go to Solution.