Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Transferring attributes from iParts

2 REPLIES 2
Reply
Message 1 of 3
peter
284 Views, 2 Replies

Transferring attributes from iParts

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

 

2 REPLIES 2
Message 2 of 3
adam.nagy
in reply to: peter

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
peter
in reply to: adam.nagy

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report