ilogic _ SAVE PDF TO ACTIVE FOLDER

ilogic _ SAVE PDF TO ACTIVE FOLDER

doug.johnston
Advocate Advocate
1,205 Views
3 Replies
Message 1 of 4

ilogic _ SAVE PDF TO ACTIVE FOLDER

doug.johnston
Advocate
Advocate

Hi folks,

 

I found this ilogic code this week and have it used it for a specific project.  I was able to direct the PDF to save to a specific project folder for that purpose, but now I want to modify the code to save the PDF to whatever folder the model and drawing are saved to.

 

I added the "ThisDoc.Path" snippet in the 3rd line from the bottom to see if it would work, but it doesn't.

 

Any assistance would be appreciated ....

 

 

    '' Get the PDF translator Add-In.
    Dim PDFAddIn As TranslatorAddIn
    PDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")

    '' Set a reference to the active document (the document to be published).
    Dim oDocument As Document
    oDocument = ThisApplication.ActiveDocument

    Dim oContext As TranslationContext
    oContext = ThisApplication.TransientObjects.CreateTranslationContext
    oContext.Type = kFileBrowseIOMechanism

    '' Create a NameValueMap object
    Dim oOptions As NameValueMap
    oOptions = ThisApplication.TransientObjects.CreateNameValueMap

    '' Create a DataMedium object
    Dim oDataMedium As DataMedium
    oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

    '' Check whether the translator has 'SaveCopyAs' options
    If PDFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then

       ' ' Options for drawings...
        oOptions.Value("All_Color_AS_Black") = 0
        oOptions.Value("Remove_Line_Weights") = 0
        oOptions.Value("Vector_Resolution") = 600
        oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
        '' oOptions.Value("Custom_Begin_Sheet") = 2
        '' oOptions.Value("Custom_End_Sheet") = 4
    End If

    '' Set the destination file name
    oDataMedium.FileName = ThisDoc.Path & ThisDoc.FileName & ".pdf"
 

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

 


---------------------------------------------------
It's not easy maintaining this level of insanity !!!!!
0 Likes
Accepted solutions (1)
1,206 Views
3 Replies
Replies (3)
Message 2 of 4

bradeneuropeArthur
Mentor
Mentor
Accepted solution

hi,

 

Change this:

 

oDataMedium.FileName = ThisDoc.Path & "\" & ThisDoc.FileName & ".pdf"

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 4

doug.johnston
Advocate
Advocate

Ok ... that worked !!

 

Can you explain why that addition made it work and the purpose of that little bit of code ???  ( For those of us who are ilogic..cally challenged ??)


---------------------------------------------------
It's not easy maintaining this level of insanity !!!!!
0 Likes
Message 4 of 4

bradeneuropeArthur
Mentor
Mentor

a path always like: "C:\Folder\Folder

a filename always shows like: Drawing.dwg

 

Combining them to a complete path and file name must be: C:\Folder\Folder & "\" & Drawing.dwg & ".Pdf"

 

To achieve: C:\Folder\Folder\Drawing.dwg.Pdf

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature