Transferring attributes from iParts

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am looking for a way to transfer both WorkPoints and WorkAxis attributes from an iPart to an assembly which uses member parts derived from the iPart Factory. I have been successful in doing this for Edge and Face attributes in the following way, however this approach doesn't work for WorkPoints and WorkAxes.
The following procedure works well to transfer attributes for Edges
Public Sub CopyEdgeAttributes(ByVal app As Inventor.Application)
Dim oAsmDoc As AssemblyDocument
Dim oOcc As ComponentOccurrence
Dim oOccEdges As Edges
Dim oFactoryDoc As PartDocument
Dim oNativeEdges As Edges
oAsmDoc = app.ActiveDocument
oOcc = oAsmDoc.ComponentDefinition.Occurrences.item(1)
oOccEdges = oOcc.SurfaceBodies.item(1).Edges
oFactoryDoc = oOcc.Definition.iPartMember.ParentFactory.Parent
oNativeEdges = oFactoryDoc.ComponentDefinition.SurfaceBodies.item(1).Edges
Dim i As Long
For i = 1 To oNativeEdges.count
Dim oEdgePx As EdgeProxy
oEdgePx = oOccEdges.item(i)
Dim oAttributeSet As AttributeSet
For Each oAttributeSet In oNativeEdges(i).AttributeSets
Dim oNewAttSet As AttributeSet
oNewAttSet = oEdgePx.AttributeSets.Add(oAttributeSet.name)
Dim oAttribute As Inventor.Attribute
For Each oAttribute In oAttributeSet
oNewAttSet.Add(oAttribute.name, oAttribute.ValueType, oAttribute.Value)
Next
Next
Next
End Sub