Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

How to check with a simple journal NX11 if the displayed part is a part family member ?

Status
Not open for further replies.

PSI-CAD

Computer
Feb 13, 2009
997
Hi,

How to check with a simple journal NX11 if the displayed part is a part family member ?

Thanks in advance

Regards
Didier Psaltopoulos
 
Replies continue below

Recommended for you

Discarded...didn't read the question good enough :) :)

Ronald van den Broek
Senior Application Engineer
Winterthur Gas & Diesel Ltd
NX9 / TC10.1.2

Building new PLM environment from Scratch using NX11 / TC11
 
Code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module NXJournal
Sub Main (ByVal args() As String)

Dim theSession As Session = Session.GetSession()
Dim theUI As UI = UI.GetUI()
Dim theUfSession As UFSession = UFSession.GetUFSession()


'Insert code here
        Dim dispPart As Part = theSession.Parts.Display
        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()

        Dim is_family_template As Boolean
        theUfSession.Part.IsFamilyTemplate(dispPart.Tag, is_family_template)
        lw.WriteLine("Part Family Template: " & is_family_template.ToString())

        Dim is_family_instance As Boolean
        theUfSession.Part.IsFamilyInstance(dispPart.Tag, is_family_instance)
        lw.WriteLine("Part Family Instance: " & is_family_instance.ToString())




End Sub
End Module

Suresh
 
Hi Suresh,

Thanks a lot.

In fact I was looking for the work part instead of displayed part but I was able to edit the journal


Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module NXJournal
Sub Main (ByVal args() As String)

Dim theSession As Session = Session.GetSession()
Dim theUI As UI = UI.GetUI()
Dim theUfSession As UFSession = UFSession.GetUFSession()


'Insert code here
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()

Dim is_family_template As Boolean
theUfSession.Part.IsFamilyTemplate(workPart.Tag, is_family_template)
lw.WriteLine("Part Family Template: " & is_family_template.ToString())

Dim is_family_instance As Boolean
theUfSession.Part.IsFamilyInstance(workPart.Tag, is_family_instance)
lw.WriteLine("Part Family Instance: " & is_family_instance.ToString())




End Sub
End Module


Regards
Didier Psaltopoulos
 
Where /what is the requirement ?

The simplest way of seeing if a component is a part family member, is :
info-part-nav_y8ienw.png


Then , when i see the above, I RMB the component - Properties - Parameters - Part Family - Information.

Regards,
Tomas
 
Hi Tomas,
I need to developp a journal to save as all Sub assy and all components except of family member.


Regards
Didier Psaltopoulos
 
That's pretty close to what the Clone assembly does.

Regards,
Tomas
 
Hi Tomas
Unfortunatly no.
Did you try with member family inside your assemby ?
Those parts are lost during clone opération :(

Regards
Didier Psaltopoulos
 
Didier said:
Hi Tomas
Unfortunatly no.
Did you try with member family inside your assemby ?
Those parts are lost during clone opération :(

That is a setting in the teamcenter integration preferences if I'm correct (if you are working in Teamcenter)

Ronald van den Broek
Senior Application Engineer
Winterthur Gas & Diesel Ltd
NX9 / TC10.1.2

Building new PLM environment from Scratch using NX11 / TC11
 
Hi,

I have modified my journal to scan the assembly but the result is not correct: Family member are not recognized [mad]

Find herewith an assembly for test

Thanks in advance for your help

_____________________________________________________
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Assemblies
Imports NXOpen.Features
Imports System.Windows.Forms
Imports NXOpen.UF
Imports NXOpen.Utilities
Imports System.Collections.Generic

Module Main
Dim s As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = s.ListingWindow
Dim NXMessageBox As NXMessageBox = NXOpen.UI.GetUI().NXMessageBox
Dim Folder As String = Nothing
Dim workPart As Part = s.Parts.Work
Dim PartList As List(Of Part) = New List(Of Part)
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim loadStatus As PartLoadStatus = Nothing
Dim is_family_instance As Boolean

Sub Main()

Dim basePart As BasePart = s.Parts.BaseWork

If basePart Is Nothing Then
NXMessageBox.Show("", NXMessageBox.DialogType.Error, "No Work Part")
Return
End If

Do_The_Job()

End Sub
Sub Do_The_Job()

Dim dp As Part = s.Parts.Display

Dim c As ComponentAssembly = s.Parts.Display.ComponentAssembly
Scan(c.RootComponent, 0)

' Ajout la tête d'assemblage ou la part unitaire dans la liste à traiter (version 1.1)
If Not PartList.Contains(dp) Then PartList.Add(dp)

ufs.Ui.SetStatus("Nombre de parts trouvées= " & PartList.Count)

For Each part As Part In PartList
'Echo(vbCrLf & "Traitement de : " & part.FullPath)
'Echo("")
s.Parts.SetDisplay(part, False, True, loadStatus)

' ----------------------------------------------
' Test si c'est un membre de famille
' ----------------------------------------------

theUfSession.Part.IsFamilyInstance(workPart.Tag, is_family_instance)


If is_family_instance.ToString()=False Then

lw.WriteLine("La part " & s.Parts.Work.Leaf & " n'est pas un membre de famille")
Else
lw.WriteLine("La part " & s.Parts.Work.Leaf & " est un membre de famille")
End If
Next

' remet la tete d'assemblage en display part
s.Parts.SetDisplay(dp, False, True, loadStatus)

End Sub

Public Sub Scan(ByVal component As Component, ByVal niveau As Integer)
' ce sous-programme scanne récursivement l'assemblage
' il ne met pas dans la liste , les parts supprimées et non ouvertes
Try
Dim part As Part = CType(component.Prototype, Part)
Dim enfants As Component() = component.GetChildren()

If Not PartList.Contains(part) Then
PartList.Add(part)
For Each comp As Component In enfants
Scan(comp, niveau + 1)
Next
End If
Catch ex As Exception

End Try
End Sub

Public Sub Echo(ByVal output As String)
lw.Open()
lw.WriteLine(output)
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
End Function
End Module
______________________________________________________________________________





Regards
Didier Psaltopoulos
 
In the following line

theUfSession.Part.IsFamilyInstance(workPart.Tag, is_family_instance)

workPart.Tag should be part.Tag

Also, make sure you open the listing window before writing to it.

Suresh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor