Saveas Multi Sheet PDF to specified location

Saveas Multi Sheet PDF to specified location

Anonymous
Not applicable
441 Views
4 Replies
Message 1 of 5

Saveas Multi Sheet PDF to specified location

Anonymous
Not applicable

Hello All,

 

Does anyone have an iLogic code that will enable me to save my current drawing document containing two sheets out to pdf?

 

I have been tasked with saving all our .idw drawing files out to pdf and dxf which is going to take a long time, and so am looking to find an easier way to achieve this.

 

I have managed to successfully save my documents out as pdfs and dxfs to a specific location including some iProperties (after assistance from Salariua, thanks again), but  only the first sheet is being saved.

I can, if necessary seperate the pdf and dxf rules so I would run one after the other but my main concern is being able to save both my flat plate (sheet 1) and the folded plate (sheet 2) which are on the two sheets in my drawing as a pdf. (Only need the flat plate as dxf).

 

I have read lots of related code but I think I am just confusing myself further with all the different styles out there. Also a lot of the sytax used is not listed in the snippets browser in this version of iLogic.

 

I have followed Curtis Waguespack's examples as well as others but still being very new to writing code, am failing miserably.

 

Any help would be much appreciated.

 

Thanks

 

Kevin-SCS

 

Inventor 2011

Windows 7 Pro

 

 

 

0 Likes
442 Views
4 Replies
Replies (4)
Message 2 of 5

GosponZ
Collaborator
Collaborator

Try this one i'm using for long time . You will need to copy address and paste of desired path

response = MessageBox.Show("Did you change path in this rule?", "Reminder",MessageBoxButtons.YesNo)
If response = vbNo Then Exit Sub

 
'Save PDF with options
'SaveLoc = "C:\"
'FileName = ThisDoc.FileName(True)
'ThisDoc.Document.SaveAs(FileName & (".pdf") , True)
oPath = ThisDoc.Path
PN = iProperties.Value("Project", "Part Number")


'path_and_namePDF = ThisDoc.Pathandname(False)
oFileName = ThisDoc.FileName(False) 'without extension
oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
oDocument = ThisApplication.ActiveDocument
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium




If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
oOptions.Value("All_Color_AS_Black") = 1
oOptions.Value("Remove_Line_Weights") = 1
oOptions.Value("Vector_Resolution") = 400
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
'oOptions.Value("Custom_Begin_Sheet") = 1
'oOptions.Value("Custom_End_Sheet") = 4
End If



'Set the destination file name 
oPath = "N:\INVENTOR PDF FILES\"
oPath = InputBox("Replace Path","New Path")
 
oDataMedium.FileName = oPath & "\" & PN & ".pdf"
'Publish document 
 'Confirmation message
 MessageBox.Show("PDF SAVED TO: " & oDataMedium.FileName, "PDF Saved", MessageBoxButtons.OK)
 


On Error Goto handlePDFLock
'Publish document.
Call oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)


'--------------------------------------------------------------------------------------------------------------------


Exit Sub


handlePDFLock: 
MessageBox.Show("PDF could not be saved, most likely someone else has it open", "No PDF for you " & ThisApplication.GeneralOptions.UserName & "!")
Resume Next


handleXLSLock: 
MessageBox.Show("No XLS", "iLogic")
Resume Next


 

0 Likes
Message 3 of 5

Anonymous
Not applicable

 

 

 

 

 

Hi MisterZS,

 

Thank you for your reply.

 

I have quickly created a new rule and copied and pasted your code into it; as is without changing anything and run it.

So far it has returned an error dialogue stating:

 

Rule Compile Errors in MisterZS, in HS Charge Pin Bracket.idw

Error on Line 18 : End of statement expected.

Error on Line 20 : End of statement expected.

 

I will endevour to try and sort it; although if you have any suggestions as to what the problem may be?

 

Many thanks

 

Kevin_SCS

 

 

0 Likes
Message 4 of 5

GosponZ
Collaborator
Collaborator

I'm working with this rule for long time. I'm on 2012 Inventor. Are you on 2011? If some other people want to give try to help you solve problem.

Try att. text file

0 Likes
Message 5 of 5

Anonymous
Not applicable

Hi MisterZS,

 

Thanks for your help. It was very much welcomed. I will try to progress as best I can with what you have given me.

 

Regards

 

Kevin-SCS

 

Inv 2011 Simulation Suite.
Dell Precision Workstation T5400
O/S Windows 7 Pro 64bit;
Intel Xeon 2.33GHz; 4 gig ram; 298 gig Hard Drive
Graphics Nvidia Quadro FX570 Driver 8.17.12.7071; DirectX 10

0 Likes