Message 1 of 6
Atts
Not applicable
06-17-2004
08:47 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am confused on something with Attribute sets. Start a assembly and
place 1 component in it, then run the PlaceAtts sub below. It places a
attributeset and attribute on the component occurrence. Then run the
CheckAtts Sub to verify it is fine. Now in Inventor Delete the
occurrence, and re-run the CheckAtts sub. Why didn't the attributes
get deleted with the sub since they were attached to it?
Option Explicit
Public Sub PlaceAtts()
Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oCompDef As ComponentDefinition
Set oCompDef = oDoc.ComponentDefinition
Dim oOcc As ComponentOccurrence
Dim oAttSet As AttributeSet
Dim oAtt As Inventor.Attribute
Set oOcc = oCompDef.Occurrences(1)
Set oAttSet = oOcc.AttributeSets.Add("MyAttSets")
Set oAtt = oAttSet.Add("MyAtt", kStringType, "Testing")
End Sub
Public Sub CheckAtts()
Dim oAttMgr As AttributeManager
Dim oAttsetsEnum As AttributeSetsEnumerator
Set oAttMgr = ThisApplication.ActiveDocument.AttributeManager
Set oAttsetsEnum = oAttMgr.FindAttributeSets("*")
Dim oAttSet As AttributeSet
Dim oAtt As Inventor.Attribute
For Each oAttSet In oAttsetsEnum
Debug.Print oAttSet.Name
Debug.Print oAttSet.Parent.Parent.Name
For Each oAtt In oAttSet
Debug.Print oAtt.Name
Debug.Print oAtt.Parent.Parent.Parent.Name
Next
Next
End Sub
--
Kent Keller
http://www.KWiKMcad.com
Autodesk Discussion Group Facilitator