×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Automate PDF Export and Sort by numbers
2

Automate PDF Export and Sort by numbers

RE: Automate PDF Export and Sort by numbers

Hi cowski,

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

(OP)
Cowski, I gave this a try, but unfortunately it still produced the PDF's in an unsorted order. So if I have 11 sheets, they get produced in the following manner:

Sheet1
Sheet10
Sheet11
Sheet2
Sheet3
etc.

I really appreciate your help though.

RE: Automate PDF Export and Sort by numbers

hermhart,
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

Hi cowski,

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 possible as long as we are exporting to the file system.

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

Hi cowski,

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

(OP)
cowski,

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

cowski,

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

(OP)
cowski,

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

Try this journal.

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

(OP)
cowski,

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

(OP)
I seem to get a lot of "Part Scan Error: Object reference not set to an instance of an object." errors, then it stops after that.

RE: Automate PDF Export and Sort by numbers

Bummer, we should have quit while we were ahead.bigsmile

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

Hi Cowski,

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

(OP)
cowski,

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! bigsmile

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources