cancel
Showing results for 
Search instead for 
Did you mean: 

how could postprocess on batch mode?

Genius
Genius

Hi,

 

Is there any posibility, to postprocess programs on batch mode for taking out different NC programs?

 

Thanks,

8 REPLIES

Re: how could postprocess on batch mode?

Esteemed Contributor
Esteemed Contributor

I'm not sure what you are asking...

 

1) You have several NX part files with programs in them, and you want to cycle thru them and post each one in "batch" mode?

 

2) You have one NX parts with several program groups, and you want to post each groups separately?

 

3) Something else?

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: how could postprocess on batch mode?

Genius
Genius

I want to schedule the postprocess action by time, for example for part1 start to postprocess at 03/06/2014 at 19:00 pm for part2 start at 03/06/2014 at 21:00 pm etc.
Each part file has different program groups. Previously I have selected the post, part files and scheduled the time periods for postprocessing. This task is possible or a special application is needed?

 

 

 

Re: how could postprocess on batch mode?

Esteemed Contributor
Esteemed Contributor

You should be able to do this.  Native mode somewhat easier than TC.

- You need a scheduler utility

Windows has "Task Scheduler" (control panels -> Admin tools).  Unix has ?cron?.

As I'm not too familiar with them, you'll have to research how to use.

- You need a .bat/journal to start NX, open the appropriate file, select the right group(s) and post them.  (.BAT for the task sceduler & set up & Start NX, then I think you can specify a journal to run when NX starts?)

 

The first bit I can't help to much with, but this journal code should help with file open & posting (it is a journal run from an already open NX session)

(note I am editing this on the fly to take out stuff I don't think you need - I may not have got it 100% correct but your should get the idea, I hope)

' post_test_files_7554mp1_tschudin.vb
' Journal created by kakerboo on Tue Sep 09 18:21:27 2008 Eastern Daylight Time
'
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module NXJournal
Sub Main

Dim theSession As Session = Session.GetSession()
Dim lw As ListingWindow = theSession.ListingWindow
Dim ufs As UFSession = UFSession.GetUFSession()

lw.Open()

' Must set Load Options = "LOAD AS SAVED"
theSession.Parts.LoadOptions.ComponentLoadMethod = LoadOptions.LoadMethod.FromDirectory

Dim Base_Folder As String = "G:\NX7.5_test\NX7.5_Post_Testing"
Dim Part_Folder As String = Base_Folder & "\parts_NX7554mp1"
Dim OutFolderBase As String = "\Output_NX7554MP1"


Dim TestFiles(5) As String
TestFiles(0) = Part_Folder & "\tscg0000\TSCG3001_A001"
TestFiles(1) = Part_Folder & "\tscg0000\TSCG3017_B001"
TestFiles(2) = ""
TestFiles(3) = ""
TestFiles(4) = ""
'TestFiles(7) = ""


Dim PostNames(5) As String
PostNames(0) = "Tschudin GW Dress"
PostNames(1) = "Tschudin RW Dress"
PostNames(2) = ""
PostNames(3) = ""
PostNames(4) = ""
         
Dim Outfolder(5) As String
Outfolder(0) = "\tscg0000"
Outfolder(1) = "\tscg0000"
Outfolder(2) = "\"
Outfolder(3) = "\"
Outfolder(4) = "\"
          
Dim PTPNames(5) As String
PTPNames(0)  = "\tscg3001.ptp"
PTPNames(1)  = "\tscg3017.ptp"
PTPNames(2)  = "\"
PTPNames(3)  = "\"
PTPNames(4)  = "\"
        
Dim Extension As String = ".prt"

Dim iCount, FileCount As Integer
FileCount = 2

Dim basePart1 As BasePart
Dim partLoadStatus1 As PartLoadStatus
Dim workPart As Part
Dim displayPart As Part 
Dim objects1(0) As CAM.CAMObject
Dim nCGroup1 As CAM.Operation
Dim OutFile as String
Dim PrtName as String
Dim Group1 As String
Dim Group2 As String
Dim nCGroup2 As CAM.NCGroup

' Need to select specific groups & post each using proper post

For iCount = 0 To FileCount - 1
	If TestFiles(iCount).Equals(TestFiles(0)) Then
		Group1 = "TSCG3001"
		Group2 = "TSCR4001R"
	Else If TestFiles(iCount).Equals(TestFiles(1))
		Group1 = "TSCG3017"
		Group2 = "TSCR4017R"
	Else 
		
	End If

	' ----------------------------------------------
	'   Menu: File->Open...
	' ----------------------------------------------
	PrtName = TestFiles(iCount) & Extension
	lw.WriteLine("Opening part " & PrtName)
	basePart1 = theSession.Parts.OpenBaseDisplay(PrtName, partLoadStatus1)

	workPart = theSession.Parts.Work

	displayPart = theSession.Parts.Display

	partLoadStatus1.Dispose()
	theSession.CreateCamSession()

	' ----------------------------------------------
	'   Menu: Tools->Operation Navigator->Output->NX Post Postprocess...
	' ----------------------------------------------
	nCGroup1 = CType(workPart.CAMSetup.CAMOperationCollection.FindObject(Group1), CAM.Operation)
	objects1(0) = nCGroup1

	' must keep in separate folders as many posts rename the output files
	OutFile = Base_Folder & OutFolderBase & OutFolder(iCount) & PTPNames(iCount)
	workPart.CAMSetup.Postprocess(objects1, PostNames(0), OutFile, CAM.CAMSetup.OutputUnits.PostDefined)

	nCGroup2 = Nothing
	nCGroup2 = CType(workPart.CAMSetup.CAMGroupCollection.FindObject(Group2), CAM.NCGroup)
	objects1(0) = nCGroup2

	' must keep in separate folders as many posts rename the output files
	OutFile = Base_Folder & OutFolderBase & OutFolder(iCount) & PTPNames(iCount)
	workPart.CAMSetup.Postprocess(objects1, PostNames(1), OutFile, CAM.CAMSetup.OutputUnits.PostDefined)

	theSession.Parts.CloseAll(BasePart.CloseModified.CloseModified, Nothing)
	workPart = Nothing
	displayPart = Nothing
	nCGroup1 = Nothing
		
Next

' ----------------------------------------------
'   Menu: Tools->Journal->Stop
' ----------------------------------------------
lw.WriteLine("Done")

' Write listing (Info) window to a file - compare error messages
Dim sDate As String 
sDate = DateTime.Now.ToString("yyyy") & DateTime.Now.ToString("MM") & DateTime.Now.ToString("dd") 
ufs.Ui.SaveListingWindow(Part_Folder & "\nx7554MP1_tschudin_journal_results_" & sDate & ".txt")


End Sub
End Module

 

 

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: how could postprocess on batch mode?

Genius
Genius

Hi Ken,

 

Thanks for the idea. I will do some tests, when I have it running I will post the solution.

 

Regards, Igor.

Re: how could postprocess on batch mode?

Interactively, select the program, then on the ribbon go to operations > More > Batch Processing.

 

Select Postprocess and OK. (ignore the Delay Time). When this runs it will create a log file and save your part. Look in the log file and you will see the command line that is used to postprocess.

 

We provide a program cambatch_background that will generate and/or postprocess. You could use this command, or the direct comand line interface for ugpost.exe, to batch post your programs.

 

I would write a temporary .bat file to do this, and then use the OS to schedule what time to run it.

The .bat file will need a minumum environment defined - take a look at runugpost.bat for a sample of this.

 

Mark Rief
Retired Siemens

Re: how could postprocess on batch mode?

Genius
Genius

Hi,

 

Anyone, could provide a code structure of a .BAT file for NX CAM. I haven't been involved with this type of files on NX CAM. I have done some .BAT files for CAE solvers and batch analysis.

 

Thanks, Igor.

Re: how could postprocess on batch mode?

Esteemed Contributor
Esteemed Contributor

"%UGII_BASE_DIR%\MACH\auxiliary\runugpost.bat" has the ability to run a batch process of ugpost.exe located in the same folder.

 

If you execute ugpost.exe without any arguments, you will get the usage message.

 

It is easy to combine the information found in the batch file mentioned above with the usage of ugpost.exe to avoid the use of the runugpost dialog.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: how could postprocess on batch mode?

Genius
Genius

Hi,

 

If I have 5 different postprocessors, how can I use Windows 8.1 Task Scheduler for postprocessing different jobs on different days and different hours? for example 10 jobs, 3 jobs on 27-11-14 at 9:00 am, 5 jobs on 27-11-14 at 10:00 pm and 2 jobs on 28-11-14 at 13:00 pm.

Do I need a macro linked with Windows 8.1 task scheduler?

 

Thanks in advance.

Learn online





Solution Information