So wird das auch nix
Blockdefinitionen halten zwar die container (Attribute) vor nur ausgefuellt werden die mit BLOCKREFERENCE
Function block_get_attribute(blo As AcadBlockReference, tagname) As String
Dim AttList As Variant
On Error Resume Next
If blo.HasAttributes Then
AttList = blo.GetAttributes
For i = LBound(AttList) To UBound(AttList)
If UCase(AttList(i).TagString) = tagname Or UCase(Trim(AttList(i).TagString)) = tagname & "_001" Then
block_get_attribute = AttList(i).textstring
Exit Function
End If
Next
End If
End Function
Sub block_set_attribute(blo As AcadBlockReference, tagname, tagvalue)
Dim AttList As Variant
If blo Is Nothing Then Exit Sub
If blo.HasAttributes Then
tagname = Trim(UCase(tagname))
AttList = blo.GetAttributes
For i = LBound(AttList) To UBound(AttList)
''debug.print "#" & UCase(attlist(i).TagString) & "#", tagname
If UCase(AttList(i).TagString) = tagname Or UCase(Trim(AttList(i).TagString)) = tagname & "_001" Then
'On Error Resume Next
AttList(i).textstring = "" & tagvalue
' attlist(I).Update
' On Error GoTo 0
Exit Sub
End If
Next
End If
End Sub
Sub block_references_delete_all(Name As String)
Dim entity As AcadEntity
Dim BLOCKDEF As AcadBlock
Dim layertext As String
application.update
For Each entity In ThisDrawing.modelspace
If LCASE(entity.ObjectName) = "acdbblockreference" Then
If LCASE(entity.EffectiveName) = LCASE(Name) Then
'entity.Delete
End If
End If
Next entity
For Each entity In ThisDrawing.PaperSpace
If LCASE(entity.ObjectName) = "acdbblockreference" Then
If LCASE(entity.EffectiveName) = LCASE(Name) Then
'entity.Delete
End If
End If
Next entity
On Error GoTo 0
End Sub
------------------
Wer es nicht versucht, hat schon verlorn
Und bei 3 Typos gibts den vierten gratis !
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP