Win11?

Win11?

Log0ut
Enthusiast Enthusiast
780 Views
16 Replies
Message 1 of 17

Win11?

Log0ut
Enthusiast
Enthusiast

Hi

 

I'm using follow code to generate PDF from drawings:

 '------start of iLogic-------
oPath = ThisDoc.Path
doc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
oFileName = ThisDoc.FileName(False) 'without extension
oRevNum = iProperties.Value(doc, "Custom", "rev")
oProduct = iProperties.Value(doc, "Custom", "toode")
oCurDate = iProperties.Value("Status", "Checked Date")
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

'get PDF target folder path
oFolder = Left(oPath, InStrRev(oPath, "\"))

'Check for the PDF folder and create it if it does not exist
If Not System.IO.Directory.Exists(oFolder) Then
    System.IO.Directory.CreateDirectory(oFolder)
End If

 'Set the PDF target file name
oDataMedium.FileName = oFolder & "\" & oProduct & " - " & oRevNum & " - " & oCurDate &".pdf"

'Publish document
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
'------end of iLogic-------


In work, win10, everything works. In home, win11, i get
this error:

Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

 

Has anybody have any idea, what causes this?

 

 

 

0 Likes
Accepted solutions (1)
781 Views
16 Replies
Replies (16)
Message 2 of 17

bradeneuropeArthur
Mentor
Mentor
Have you show fileextensions on in win11?

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 17

Log0ut
Enthusiast
Enthusiast
Are my file extensions showing in file explorer? yes
0 Likes
Message 4 of 17

bradeneuropeArthur
Mentor
Mentor

What message do you receive the last, if you use this coding?

'------start of iLogic-------
oPath = ThisDoc.Path
doc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
MsgBox("1")
oFileName = ThisDoc.FileName(False) 'without extension
MsgBox("2")
oRevNum = iProperties.Value(doc, "Custom", "rev")
MsgBox("3")
oProduct = iProperties.Value(doc, "Custom", "toode")
MsgBox("4")
oCurDate = iProperties.Value("Status", "Checked Date")
MsgBox("5")
oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _
("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
MsgBox("6")
oDocument = ThisApplication.ActiveDocument
MsgBox("7")
oContext = ThisApplication.TransientObjects.CreateTranslationContext
MsgBox("8")
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
MsgBox("9")
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
MsgBox("10")
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
MsgBox("11")

'get PDF target folder path
oFolder = Left(oPath, InStrRev(oPath, "\"))
MsgBox("12")

'Check for the PDF folder and create it if it does not exist
If Not System.IO.Directory.Exists(oFolder) Then
    System.IO.Directory.CreateDirectory(oFolder)
	MsgBox("13")
End If

 'Set the PDF target file name
oDataMedium.FileName = oFolder & "\" & oProduct & " - " & oRevNum & " - " & oCurDate & ".pdf"
MsgBox("14")

'Publish document
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
MsgBox("15")
'------end of iLogic-------

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 5 of 17

Log0ut
Enthusiast
Enthusiast
14, error in line 42
0 Likes
Message 6 of 17

bradeneuropeArthur
Mentor
Mentor

test if the add-in is loaded.

Do you receive a true message?

'------start of iLogic-------
oPath = ThisDoc.Path
doc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
MsgBox("1")
oFileName = ThisDoc.FileName(False) 'without extension
MsgBox("2")
'oRevNum = iProperties.Value(doc, "Custom", "rev")
MsgBox("3")
'oProduct = iProperties.Value(doc, "Custom", "toode")
MsgBox("4")
oCurDate = iProperties.Value("Status", "Checked Date")
MsgBox("5")
Dim oPDFAddIn As Inventor.ApplicationAddIn = ThisApplication.ApplicationAddIns.ItemById _
("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
MsgBox("6")
oDocument = ThisApplication.ActiveDocument
MsgBox("7")
oContext = ThisApplication.TransientObjects.CreateTranslationContext
MsgBox("8")
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
MsgBox("9")
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
MsgBox("10")
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
MsgBox("11")

'get PDF target folder path
oFolder = Left(oPath, InStrRev(oPath, "\"))
MsgBox("12")

'Check for the PDF folder and create it if it does not exist
If Not System.IO.Directory.Exists(oFolder) Then
    System.IO.Directory.CreateDirectory(oFolder)
	MsgBox("13")
End If

 'Set the PDF target file name
oDataMedium.FileName = oFolder & "\" & oProduct & " - " & oRevNum & " - " & oCurDate & ".pdf"
MsgBox("14")

'Publish document
MsgBox (oPDFAddIn.Activated)
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
MsgBox("15")
'------end of iLogic-------

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 7 of 17

Log0ut
Enthusiast
Enthusiast
Yes, true
0 Likes
Message 8 of 17

bradeneuropeArthur
Mentor
Mentor
Accepted solution

Test the date-string:

Does it contain non allowed characters like "/"?

bradeneuropeArthur_0-1668790627760.png

 

 

 

'------start of iLogic-------
oPath = ThisDoc.Path
doc = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
MsgBox("1")
oFileName = ThisDoc.FileName(False) 'without extension
MsgBox("2")
'oRevNum = iProperties.Value(doc, "Custom", "rev")
MsgBox("3")
'oProduct = iProperties.Value(doc, "Custom", "toode")
MsgBox("4")
oCurDate = iProperties.Value("Status", "Checked Date")
MsgBox (oCurDate.ToString)
MsgBox("5")
Dim oPDFAddIn As Inventor.TranslatorAddIn = ThisApplication.ApplicationAddIns.ItemById _
("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
MsgBox("6")
oDocument = ThisApplication.ActiveDocument
MsgBox("7")
oContext = ThisApplication.TransientObjects.CreateTranslationContext
MsgBox("8")
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
MsgBox("9")
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
MsgBox("10")
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
MsgBox("11")

'get PDF target folder path
oFolder = Left(oPath, InStrRev(oPath, "\"))
MsgBox("12")

'Check for the PDF folder and create it if it does not exist
If Not System.IO.Directory.Exists(oFolder) Then
    System.IO.Directory.CreateDirectory(oFolder)
	MsgBox("13")
End If

 'Set the PDF target file name
oDataMedium.FileName = oFolder & "\" & oProduct & " - " & oRevNum & " - " & oCurDate & ".pdf"
MsgBox(oFolder & "\" & oProduct & " - " & oRevNum & " - " & oCurDate & ".pdf")
MsgBox("14")

'Publish document
MsgBox (oPDFAddIn.Activated)
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
MsgBox("15")

 

 

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

Message 9 of 17

Log0ut
Enthusiast
Enthusiast
That was it- changing date format, solved the problem. Thank you!
Message 10 of 17

Log0ut
Enthusiast
Enthusiast

I also have another similar problem- if i export drawings to dwg, attached images shows like that:

Nimetu.png

 

 

 

 

 

 

 

 

 

 

 

At work converting works as it must be, using same drawing

 

0 Likes
Message 11 of 17

bradeneuropeArthur
Mentor
Mentor
Can you share that code too?

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 12 of 17

Log0ut
Enthusiast
Enthusiast

I'm using File-Export-Export to DWG option

0 Likes
Message 13 of 17

bradeneuropeArthur
Mentor
Mentor

The command in inventor selves.

You don't use coding to do the export.

Could you make a movie to see what happens.

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 14 of 17

Log0ut
Enthusiast
Enthusiast

Yes, i dont use coding to do export.

Everything works as it must. Only problem is that images don't show up in DWG

Log0ut_0-1669100164244.png

Log0ut_1-1669100277822.png

Log0ut_2-1669100315658.pngLog0ut_3-1669100366343.png

 

 

 

0 Likes
Message 15 of 17

Log0ut
Enthusiast
Enthusiast

Anybody any idea?

0 Likes
Message 16 of 17

bradeneuropeArthur
Mentor
Mentor
could you share the template file (drawing file)?

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 17 of 17

Log0ut
Enthusiast
Enthusiast

I attached template file

I don't believe that problem is template file, because in work computer same files works without problem

0 Likes