Automate PDF Export and Sort by numbers
Automate PDF Export and Sort by numbers
(OP)
Hello, I have these two great VB scripts for exporting a PDF and sorting the Sheet names by number, but am wondering if anyone has the knowledge on how to combine these both together into one VB script.
Thank you for any help that you can provide.
Thank you for any help that you can provide.





RE: Automate PDF Export and Sort by numbers
www.nxjournaling.com
RE: Automate PDF Export and Sort by numbers
I just tried this journal but it didn't produce any output, however looking at the log file I think it's because our part numbers have a slash in them so it's tried to create 332/G2189_3.pdf .
Recently we were looking at an export CGMs journal, which used the sheetnames rather than the filename, and cycled through the sheets to update before exporting CGMs (attached).
Is it possible to modify the attached to export PDFs in the same way?
Thanks in advance, Carl
www.jcb.com
NX 8.5 with TC 8.3
RE: Automate PDF Export and Sort by numbers
Sheet1
Sheet10
Sheet11
Sheet2
Sheet3
etc.
I really appreciate your help though.
RE: Automate PDF Export and Sort by numbers
I've updated the journal, please download it again (use the link in the previous post).
carlharr,
Do you want each sheet exported to an individual pdf file?
www.nxjournaling.com
RE: Automate PDF Export and Sort by numbers
Yes, that would be great if it's possible?
www.jcb.com
NX 8.5 with TC 8.3
RE: Automate PDF Export and Sort by numbers
It's probably also possible if you want to export to TC dataset(s), but I have not figured that out yet.
www.nxjournaling.com
RE: Automate PDF Export and Sort by numbers
Just to the file system would be fine, so essentially the same as CGM export in the journal, but for PDF.
I'm looking for ways for engineers to get exports out quickly, for communicating with suppliers etc.
All this work is a follow on from the "no CGMs in MS Office products" problem.
For a couple of reasons, I'm not overly keen on exports to Teamcenter.
Much appreciated, Carl
www.jcb.com
NX 8.5 with TC 8.3
RE: Automate PDF Export and Sort by numbers
That did it! Thank you so much, you are a life saver! I would have never gotten that.
RE: Automate PDF Export and Sort by numbers
Try this journal.
www.nxjournaling.com
RE: Automate PDF Export and Sort by numbers
That is perfect!
I'll send it out to some of our users for a thorough test, but its working great on my machine.
Much appreciated, Carl
www.jcb.com
NX 8.5 with TC 8.3
RE: Automate PDF Export and Sort by numbers
I hate to ask, but for the script that you made for me, is there a way that it can also be made to run externally from the NX command prompt on a directory of parts, where it would open and cycle through each .prt file in a directory, and do the same exporting that you have set up in the journal already? I'm working on modifying the script that you gave me, but I know that my programming skills are majorly lacking.
In the end, if I or you are able to make this work, I'm hoping that I might also be able to use the same code for other export types, such as STEP, IGES, etc.
Thank you again for taking a look at this, your last script for this has worked amazingly.
RE: Automate PDF Export and Sort by numbers
Start the NX command prompt and enter:
CODE
run_journal {path to journal file} -args {path of folder to scan} {path of folder to output pdf files}www.nxjournaling.com
RE: Automate PDF Export and Sort by numbers
This works great, thank you!
Can I ask one last favor though? I have a bit of code I'd like to incorporate into this which makes it so it doesn't process it and make a pdf file if the sheet is empty.
I know that I am probably pushing it, but I could I ask you to incorporate such a function. One would hope that you shouldn't need such a thing, but it seems that people are not clean with their files and do not delete empty sheets.
CODE -->
' ---------------------------------------------- ' Do Not Process Empty Sheet(s) (DeleteEmptySheets) ' ---------------------------------------------- For Each dwg As DrawingSheet In s.Parts.Display.DrawingSheets dwg.Open() 's.ListingWindow.WriteLine("Drawing: " & dwg.Name.ToString) ' For Each dV As DraftingView In dwg.GetDraftingViews() ' Dim dvTag As NXOpen.Tag = dV.Tag ' Dim dvObj As NXOpen.Tag = NXOpen.Tag.Null ' ufs.View.CycleObjects(dvTag, _ ' UFView.CycleObjectsEnum.VisibleObjects, dvObj) ' If (dvObj = NXOpen.Tag.Null) Then ' s.ListingWindow.WriteLine(" deleting empty view: " & _ ' dV.Name.ToString) ' ufs.View.Delete(dvTag) ' End If ' Next Dim dsTag As NXOpen.Tag = dwg.View.Tag Dim dsObj As NXOpen.Tag = NXOpen.Tag.Null ufs.View.CycleObjects(dsTag, UFView.CycleObjectsEnum.VisibleObjects, _ dsObj) If (dsObj = NXOpen.Tag.Null) And _ (dwg.GetDraftingViews.Length = 0) Then s.ListingWindow.WriteLine(" Empty drawing not processed: " & _ dwg.Name.ToString) ufs.Draw.DeleteDrawing(dwg.Tag) End If Next If thePart.Tag = Tag.Null Then Return End If Dim drawingSheets As DrawingSheet() = thePart.DrawingSheets.ToArray If drawingSheets.Length() > 0 Then lw.WriteLine(" Sheets found: " & drawingSheets.Length().ToString()) End If Dim mySheet As DrawingSheet = Nothing Dim partName As String = thePart.Leaf.ToString() For Each mySheet In drawingSheets lw.WriteLine(" Processing Sheet: " & mySheet.Name()) mySheet.Open()RE: Automate PDF Export and Sort by numbers
www.nxjournaling.com
RE: Automate PDF Export and Sort by numbers
RE: Automate PDF Export and Sort by numbers
I've updated the code, you can get it from the same link as above (link in post dated: 1 Dec 14 14:40).
www.nxjournaling.com
RE: Automate PDF Export and Sort by numbers
I tried to use your updated script for exporting pdf in one file but it's giving ordering different apart from sheet numbers like sheet 10, 1 , 6, 3 etc. Could you please share correct path for script to export pdf as per sheet numbers.
And, I am also looking for export selective sheets as one pdf. for example I have 10 sheets drawing. so I want to export 1 to 5 in pdf1 and 6 to 10 ion pdf 2 like that. or selected sheets numbers in one pdf file
Please do needful
Thanks & Regards,
Ganesh
RE: Automate PDF Export and Sort by numbers
This works amazingly, thank you! It does say many times "part open error: File already exists", which I'm not sure why, but it is still doing everything I hoped.
I can't thank you enough!
Thank you, thank you, thank you!