Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NX 7.5 Journaling - General Assembly Question

Status
Not open for further replies.

cquinker

Bioengineer
Sep 20, 2012
16
Hey guys, so I've got funcitons that load in a part and then pulls in a component assembly using the following functions:

Function Load_Part(ByVal filepath1 As String) As Part

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim unit1 As Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), Unit)
Dim nullFeatures_Feature As Features.Feature = Nothing

Dim Part1 As Part
Dim Load1 As PartLoadStatus
On Error Resume Next
Part1 = theSession.Parts.Open(filepath1, Load1)

Return Part1

End Function

Function Load_Assembly(ByVal Part1 As part, componentName As String) As Assemblies.Component

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim unit1 As Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), Unit)
Dim nullFeatures_Feature As Features.Feature = Nothing

Dim basePoint1 As Point3d = New Point3d(0.0, 0.0, 0.0)
Dim orientation1 As Matrix3x3
orientation1.Xx = 1.0
orientation1.Xy = 0.0
orientation1.Xz = 0.0
orientation1.Yx = 0.0
orientation1.Yy = 1.0
orientation1.Yz = 0.0
orientation1.Zx = 0.0
orientation1.Zy = 0.0
orientation1.Zz = 1.0
Dim partLoadStatus1 As PartLoadStatus
Dim component1 As Assemblies.Component
component1 = workPart.ComponentAssembly.AddComponent(Part1, "MODEL", componentName, basePoint1, orientation1, 7, partLoadStatus1)

Return component1

End Function






So both of these functions work as hoped. They bring in a fully functional component assembly as expected. However, upon bringing the component assembly in, is there any way for me to loop through and process all of the individual features (bodies, planes, points, etc) from the component assembly? Additionally, if that's possible, is there any way to get the "custom name" of the features that one would normally see in the part navigator if this were in the Work Part?


Thanks, any help is greatly appreciated as this has me bashing my head against a wall.
 
Replies continue below

Recommended for you

You have two possibilities to access objects at the component part.

One is to use the part class methods for collections. This certainly covers points, planes & bodies as collections.

The other method is to change the work part to the component which has the objects of interest and then specific object can be selected in code more directly.

Regards

Frank Swinkels
 
Thanks Frank, I changed the work part to get the objects I needed. However, now I'm trying to using those planes, datum axes, and bodies for constraining the assembly component to planes and points in my original work part. Every time that I attempt to use the variables containing planes or axes (etc) from the assembly that I just got, I end up creating constraints that return the alert: "The constraint contains invalid geometry references. New references cannot be added to the constraint until the invalid references have been removed."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor