muck Posted December 8, 2011 Posted December 8, 2011 AutoCAD 2010 I have created a Dynamic Block with various visibility states. The block has attributes in that are not displayed depending on which visibility state that is selected. Is there a way for VBA to look at attributes in my dynamic block and tell which attributes are visible? Does anyone have any code demonstrating this? Thank you, Quote
meyerforhire Posted January 4, 2012 Posted January 4, 2012 Have you tried testing the attribute's non-dynamic property? AcadAttributeReference object, Visible property? Something like...... Private Function IsAttVis(objID As Long, attName As String) As Boolean 'You'll want to get the object ID and Attribute name to pass it to this function Dim objEnt As AcadEntity Dim objRef As AcadBlockReference Dim objAttRef As AcadAttributeReference Set objEnt = ThisDrawing.ObjectIdToObject(objID) If TypeOf objEnt Is AcadBlockReference Then Set objRef = objEnt Set objEnt = Nothing For Each objEnt In objRef If TypeOf objEnt Is objAttRef Then Set objAttRef = objEnt If objAttRef.ObjectName = attName Then If objAttRef.Visible = True Then IsAttVis = True Else IsAttVis = False End If End If Set objAttRef = Nothing End If Next Set objRef = Nothing End If Set objEnt = Nothing End Function The above is untested so the objEnt heirarchy may fail--I can't remember if it will work this way. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.