Transferring attributes from iParts

Transferring attributes from iParts

Anonymous
Not applicable
404 Views
2 Replies
Message 1 of 3

Transferring attributes from iParts

Anonymous
Not applicable

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

 

0 Likes
405 Views
2 Replies
Replies (2)
Message 2 of 3

adam.nagy
Autodesk Support
Autodesk Support

Hi Peter,

 

Depending on the the type of changes an iPart parameter change can cause in your parts it might not be very robust to rely on the order of the edges and faces in the derived part/ipart instance.

 

Here is a blog post which might be helpful:

http://adndevblog.typepad.com/manufacturing/2014/11/get-edge-in-derived-part-that-drives-work-point....

 

Cheers,

 

 

 



Adam Nagy
Autodesk Platform Services
Message 3 of 3

Anonymous
Not applicable

Many thanks for an informative and well writtten article. I missed your response the first time around so apologise for a late reply.

 

Best regards

Peter

0 Likes