Need help in journal that identify assembly components that are "familly members components&quo
Need help in journal that identify assembly components that are "familly members components&quo
(OP)
Hi
Please can anyone help in nxopen vb functions that can scan an assembly and list all components
that are "familly members components"
Thanks in advanced
Please can anyone help in nxopen vb functions that can scan an assembly and list all components
that are "familly members components"
Thanks in advanced





RE: Need help in journal that identify assembly components that are "familly members components&quo
2. In a journal, use the old user function "UF_PART_is_family_instance"
3. As for scanning the assembly, there are a lot of code examples in the Siemens GTAC library
RE: Need help in journal that identify assembly components that are "familly members components&quo
I'l try the "UF_PART_is_family_instance"
Thank you
RE: Need help in journal that identify assembly components that are "familly members components&quo
maybe you can help in this
the "UF_PART_is_family_instance" function works good in NATIVE mode
but I need it in NXMANAGER mode but in this mode I get an error at this line
ufs.Part.IsFamilyInstance(myPart.Tag, is_family_instance)
the error is System.NullReferenceException: Object reference not set to an instance of an object
Thanks in advanced
heer the code that works good in Native mode
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Utilities
Imports NXOpen.Assemblies
Module list_all_family_members_components
Dim s As Session = Session.GetSession
Dim ufs As UFSession = UFSession.GetUFSession
Dim workPart As Part = s.Parts.Work
Dim dispPart As Part = s.Parts.Work
Dim lw As ListingWindow = s.ListingWindow
Sub Main()
Dim root As Component = dispPart.ComponentAssembly.RootComponent
Dim refComps As Component() = root.GetChildren()
Dim is_family_instance As Boolean
Dim cnt As Integer = 1
Dim len As Integer
Dim fmComponents(-1) As Component
lw.Open()
len = -1
For Each thisComp As Component In refComps
Dim myPart As Part = thisComp.Prototype.OwningPart
ufs.Part.IsFamilyInstance(myPart.Tag, is_family_instance)
If is_family_instance = TRUE Then
len = len + 1
ReDim Preserve fmComponents(len)
fmComponents(len) = thisComp
End If
Next
cnt = 1
For Each thisComp As Component In fmComponents
Dim selectedComps(0) As Assemblies.Component
lw.WriteLine(cnt.ToString & " " & thisComp.DisplayName & " ====>>> Is a family Member ")
cnt = cnt + 1
Next
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
Return Session.LibraryUnloadOption.Immediately
End Function
End Module
RE: Need help in journal that identify assembly components that are "familly members components&quo
RE: Need help in journal that identify assembly components that are "familly members components&quo
The syntax above will get a reference to the part file of the given component. It only works if the part file is open in session or if it can be found with the current load options.
Check to see if "myPart" is a valid reference before calling any of its properties or methods.
CODE
If IsNothing(myPart) Then 'part is not loaded, attempt to load it 'or skip processing this part End IfFully loading the assembly or changing your TC load options may help.
www.nxjournaling.com
RE: Need help in journal that identify assembly components that are "familly members components&quo
I'm very Thanks for the repllies
For thisComp.Prototype.OwningPart See NX journaling link
http://www.nxjournaling.com/content/component-name...
on the line ==>> Dim thePart As Part = theComponent.Prototype.OwningPart
and I see it also in some GTAC code examples
It only works if the part file is open in session but this journal is run ok in native mode
without opening any component part
Is NXMANAGER running mode is different from NATIVE running mode
Why NXMANAGER throw System.NullReferenceException and NATIVE not
I'm very thanks for any help to come
RE: Need help in journal that identify assembly components that are "familly members components&quo
www.nxjournaling.com
RE: Need help in journal that identify assembly components that are "familly members components&quo
Thank you for the response
When I am at work I'll check it
But what are the settings in load options that will allow the journal to work
I am grateful for any help
RE: Need help in journal that identify assembly components that are "familly members components&quo
The same settings that find and open the component part files successfully.
www.nxjournaling.com
RE: Need help in journal that identify assembly components that are "familly members components&quo
www.nxjournaling.com