Drawing - Ilogic

Drawing - Ilogic

Boopathi_Sivakumar
Collaborator Collaborator
359 Views
3 Replies
Message 1 of 4

Drawing - Ilogic

Boopathi_Sivakumar
Collaborator
Collaborator

Hi fellas,

 

           I want to Save my Drawing as Pdf through Ilogic For the File Names will be Typed by the user. I don't Have much skills in VB So couldn't get the idea,

 

I ll Show you what I did

 

 

NewName = InputBox("Name to Save", "Save As", "")

ThisDoc.Document.SaveAs(ThisDoc.ChangeExtension(".pdf"), True)

 NewName is the User parameter in the drawing, So whatever I type the parameter will hold the value,

How Can i use the value as my File Name ? that's the question.

 

Hope You Guys get it.

 

Regards, 

Boopathi

Boopathi Sivakumar
Sr Application Engineer
www.usamcadsoft.in
Facebook | Twitter | LinkedIn

0 Likes
360 Views
3 Replies
Replies (3)
Message 2 of 4

mcgyvr
Consultant
Consultant

See if this example helps you..

http://inventortrenches.blogspot.com/2011/07/ilogic-to-save-pdf-files-to-new.html

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 3 of 4

Curtis_Waguespack
Consultant
Consultant

@Boopathi_Sivakumar wrote:

...I want to Save my Drawing as Pdf through Ilogic For the File Names will be Typed by the user...

 


 

Hi @Boopathi_Sivakumar,

 

Using the example that mcgyvr linked to, I've combined another example found at this link, so that the user is presented a dialog box in which to type the file name. 

 

This negates the need for the user parameter for gathering the file name, but if you must use the parameter for other reasons, this example could be modified to use it also.

 

Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

'define the active document
oDoc = ThisDoc.Document
'create a file dialog box
Dim oFileDlg As inventor.FileDialog = Nothing
InventorVb.Application.CreateFileDialog(oFileDlg)

'filter file type
oFileDlg.Filter = "PDF files (*.pdf)|*.pdf"

'set the directory to open the dialog at
oFileDlg.InitialDirectory = ThisDoc.WorkspacePath()
'set the file name string to use in the input box
oFileDlg.FileName = iProperties.Value("Project", "Part Number")

'work with an error created by the user backing out of the save
oFileDlg.CancelError = True
On Error Resume Next
'specify the file dialog as a save dialog (rather than a open dialog)
oFileDlg.ShowSave()

'catch an empty string in the imput
If Err.Number <> 0 Then
MessageBox.Show("No File Saved.", "iLogic: Dialog Canceled")
ElseIf oFileDlg.FileName <> "" Then
MyFile = oFileDlg.FileName
End If

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

'set PDF options
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") = 2
'oOptions.Value("Custom_End_Sheet") = 4

 'Set the PDF target file name
oDataMedium.FileName = MyFile 

'Publish document
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)

 

EESignature

0 Likes
Message 4 of 4

Boopathi_Sivakumar
Collaborator
Collaborator

Thanks for Both of you guys,

 

          I have made some changes to your code and it works perfectly. I have one more doubt is it  possible to export the drawing to autocad 2000 version through i-logic?

 

Regards,

Boopathi

Boopathi Sivakumar
Sr Application Engineer
www.usamcadsoft.in
Facebook | Twitter | LinkedIn

0 Likes