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.
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.