How do I get a journal to get the part family save directory
How do I get a journal to get the part family save directory
(OP)
I would like to obtain the part family save as directory as a varible in a journal. I found the following in the .net reference file but not sure how to use it.
Namespaces -> NXOpen -> SaveOptions -> FamilyDefaultDirectory
public string FamilyDefaultDirectory { get; set; }
Public Property FamilyDefaultDirectory As String
Get
Set
Also if possible I would also like to know if there is a way to find out what family members were created last or created in the current session. Maybe copy lines from the information window if there are no UG functions for it.
Namespaces -> NXOpen -> SaveOptions -> FamilyDefaultDirectory
public string FamilyDefaultDirectory { get; set; }
Public Property FamilyDefaultDirectory As String
Get
Set
Also if possible I would also like to know if there is a way to find out what family members were created last or created in the current session. Maybe copy lines from the information window if there are no UG functions for it.





RE: How do I get a journal to get the part family save directory
"To obtain an instance of this class, refer to PartCollection"
Follow the link for the PartCollection and do the same, you'll see you need a reference to the Session object. So your code will look something like:
CODE --> psuedocode
CODE
Option Strict Off Imports System Imports NXOpen Module Module1 Sub Main() Dim theSession As Session = Session.GetSession() Dim lw As ListingWindow = theSession.ListingWindow lw.Open() Dim myPartFamSaveDir As String = "" myPartFamSaveDir = theSession.Parts.SaveOptions.FamilyDefaultDirectory lw.WriteLine("Part family save directory: " & myPartFamSaveDir) lw.Close() End Sub Public Function GetUnloadOption(ByVal dummy As String) As Integer 'Unloads the image when the NX session terminates GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination '----Other unload options------- 'Unloads the image immediately after execution within NX 'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately 'Unloads the image explicitly, via an unload dialog 'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly '------------------------------- End Function End Modulewww.nxjournaling.com
RE: How do I get a journal to get the part family save directory
RE: How do I get a journal to get the part family save directory
After a lot of searching I found the following on the gtac website. It seems to work.
CODE -->
Option Strict Off Imports System Imports NXOpen Imports NXOpen.UF Module report_part_families Sub Main Dim theSession As Session = Session.GetSession() Dim ufs As UFSession = UFSession.GetUFSession() Dim workPart As Part = theSession.Parts.Work Dim displayPart As Part = theSession.Parts.Display Dim lw As ListingWindow = theSession.ListingWindow Dim dir As String = "" Dim family As Tag Dim family_count As Integer Dim families As Tag() Dim instance As Tag lw.Open() ufs.Part.AskFamilyInstance(displayPart.Tag, instance) lw.WriteLine("Family instance = " & instance.ToString()) ufs.Part.AskFamInstSaveDir(dir) lw.WriteLine("Family Instance Save Dir = " & dir) ufs.Part.AskFamilies(displayPart.Tag, family_count, families) lw.WriteLine("Families in Part = " & family_count.ToString()) for ii As Integer = 0 To family_count-1 ufs.Part.AskFamilySaveDir(families(ii), dir) lw.WriteLine("Family = " & families(ii).ToString()) lw.WriteLine("Family Save Dir = " & dir) Next End Sub End Module