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!

Need help for save as journal

Status
Not open for further replies.

patrice vallet

Industrial
Dec 5, 2016
2
Hi,

Currently, I work with an assembly composed of family part member
I have not problem when I work on standard products, but for special products, I need to clone the assembly and family part members to do specific modification.
I can’t use cloning function to rename my assembly and parts and save it on a other directory, due to the use of family part.
Currently, I do several “save as” to do it, but it’s time consumer.

I would to do a NX journal to do it. The journal will have to :
Ask the user to choose a save directory
Ask the user a number (exemple : 145145)
Save the active assembly and the part under it in the save directory
Rename all part with the number as suffix (exemple : part_145145.prt)

I work on NX10

Could you help me to create this journal ?

Thank you
Patrice
 
Replies continue below

Recommended for you

Hi,
I success to ask a directory, and a number to the user. And save the work part.
But, now I don't know how do this action on all the parts under the work assembly.
Could you help me, please ?

Code:
Option Strict off
Imports System
Imports NXOpen
Imports System.Windows.Forms
Imports NXOpen.UF
Imports NXOpen.Assemblies

Module Main

    Dim theSession As Session = Session.GetSession()
    Dim theUfSession As UFSession = UFSession.GetUFSession()
    Dim workPart As Part = theSession.Parts.Work
    Dim lw As ListingWindow = theSession.ListingWindow
    Public Folder as String = nothing
    Public dispPart As Part = theSession.Parts.Display

    Sub Main()


        ' ----------------------------------------------
        'demande chemin sauvegarde
        ' ----------------------------------------------
        lw.Open()

        Dim FolderBrowserDialog As FolderBrowserDialog = New FolderBrowserDialog()

        FolderBrowserDialog.SelectedPath = "C:"
        FolderBrowserDialog.Description = "Selectionner le dossier ou doivent être sauvegardé les pièce"

        If (FolderBrowserDialog.ShowDialog() <> DialogResult.OK) Then Return ' Sort si le user n'a rien indiqué
        Folder = FolderBrowserDialog.SelectedPath

        lw.WriteLine("Le directory choisi est :" & Folder)


        ' ----------------------------------------------        
        'demande numero projet
        ' ----------------------------------------------
        Dim numeroProjet As String = ""

        numeroProjet = InputBox("Enter project number", "numero projet", "")


        ' ----------------------------------------------
        '   Save As...
        ' ----------------------------------------------
        Dim partSaveStatus1 As PartSaveStatus
        Try
            partSaveStatus1 = workPart.SaveAs(Folder+"\"+workPart.Leaf+"_"+numeroProjet+".prt")
            partSaveStatus1.Dispose()
            Catch ex as Exception
        End Try


    End Sub


End Module
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor