PDA

View Full Version : Text String Mode



BeetleJuice
2010-05-08, 12:34 PM
I am trying to alter the mode of an attribute i.e ac AttributeModeInvisible, etc)
I can't seem to get the current mode of an attribute.

Here is my code in early stages and hope someone can help.


Sub ToggleRef()
Dim objBRef As AcadBlockReference
Dim varPick As Variant
Dim iCount As Integer
Dim oBlock As AcadBlock
Dim bname As String
Dim SpecValue As Variant
Dim i As Integer
''get an entity from user
On Error Resume Next
With ThisDrawing.Utility
.GetEntity objBRef, varPick, vbCr & "Pick a SRD reference: "
If Err Then Exit Sub
End With
bname = objBRef.Name
Set oBlock = ThisDrawing.Blocks(bname)
iCount = oBlock.count
MsgBox iCount
If objBRef.Name <> "REF1_50" Or objBRef.HasAttributes = False Or iCount <> 3 Then
MsgBox "This Is Not A valid SRD Reference"
Exit Sub
End If
SpecValue = objBRef.GetAttributes

For i = 0 To 2
MsgBox (SpecValue(i).TextString)
'''''''''''MsgBox (SpecValue(i).TextString(i).Mode) '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Next i

End Sub

BeetleJuice
2010-05-08, 02:21 PM
have managed to Sort the visibility of attributes and have attached below.


Sub ToggleRef()
Dim objBRef As AcadBlockReference
Dim varPick As Variant
Dim iCount As Integer
Dim oBlock As AcadBlock
Dim bname As String
Dim SpecValue As Variant
Dim AttVis As Boolean
''get an entity from user
On Error GoTo ErrorHan
With ThisDrawing.Utility
.GetEntity objBRef, varPick, vbCr & "Pick a SRD reference: "
If Err Then Exit Sub
End With
bname = objBRef.EffectiveName
Set oBlock = ThisDrawing.Blocks(bname)
iCount = oBlock.count

If objBRef.EffectiveName <> "REF1_50" Or objBRef.HasAttributes = False Or iCount <> 3 Then
MsgBox "This Is Not A valid SRD Reference"
Exit Sub
End If

SpecValue = objBRef.GetAttributes
AttVis = SpecValue(1).Invisible
If AttVis = True Then
SpecValue(1).Invisible = False
Else
SpecValue(1).Invisible = True
End If

Exit Sub
ErrorHan:
MsgBox Err.Number
If Err.Number = -2147352567 Then
Exit Sub
End If

ToggleRef
End Sub

fixo
2010-05-08, 02:34 PM
Or a bit shorter to toggle visibility


SpecValue(1).Invisible =Not SpecValue(1).Invisible


~'J'~