How to get ucs matrix in a derived part without opening the base part (VBA)

How to get ucs matrix in a derived part without opening the base part (VBA)

Anonymous
Not applicable
568 Views
2 Replies
Message 1 of 3

How to get ucs matrix in a derived part without opening the base part (VBA)

Anonymous
Not applicable

I would like to create a UCS, same as a UCS in a derived part. Is it possible to do that without opening the base part?

I already include the work geometries in the derived part (x-axis, y-axis, z-axis, XY Plane, YZ Plane, XZ Plane)

 

Thanks,

0 Likes
Accepted solutions (2)
569 Views
2 Replies
Replies (2)
Message 2 of 3

JhoelForshav
Mentor
Mentor
Accepted solution

Hi @Anonymous 

As long as you haven't broken or suppressed the link to the base component you can get the UCS-definition from it.

I don't know what you mean by "without opening the base part", If the link isn't broken the base part is open in inventors memory. Do you mean that the link will be broken/suppressed?

If not try this VBA macro:

Sub GetUCS()
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oDef As PartComponentDefinition
Set oDef = oDoc.ComponentDefinition
Dim oDerPart As DerivedPartComponent
Set oDerPart = oDef.ReferenceComponents.DerivedPartComponents(1) 'Derived part index
oDef.UserCoordinateSystems.Add (oDerPart.ReferencedDocumentDescriptor.ReferencedDocument. _
ComponentDefinition.UserCoordinateSystems("UCS1").Definition) 'UCS name
End Sub

 

Message 3 of 3

Anonymous
Not applicable
Accepted solution
 
JhoelForshav, it's exactly what I want to do. What I did is to open the referenced file of the derived part, get UCS then close it. As result it loads the derived parts twice. The problem was that I have more than hundreds parts like that. It's huge different. Thank you so much for your help!

 

0 Likes