Hi,
I would like have the option to open PDF file from the IDW I have open?
Below you can see our structure.
03.Native: contains all the IDW files.
01.PDF: contains the PDF generated from the IDW in 03.Native.
Solved! Go to Solution.
Solved by FINET_Laurent. Go to Solution.
Hi @madstrolle,
The folowing code opens the pdf, that has the same name as the openned drawing document the rule is fired from :
Dim actDoc As Inventor.DrawingDocument = ThisApplication.ActiveDocument
Dim file As String = actDoc.FullFileName 'full drawing path
Dim name As String = actDoc.DisplayName 'drawing name
Dim dir As String = "03.Native"
Dim targetDir As String = "01.PDF"
Dim s As String = Left(file, file.Length - (dir.Length + name.Length) - 1) '-1 for \
Dim pdfname As String = Left(name, name.Length - 4) & ".pdf"
Dim pdfdoc As String = s & targetDir & "\" & pdfname
ThisDoc.Launch(pdfdoc)
Does this works as intented ?
Kind regards,
FINET L.
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"Hi @FINET_Laurent ,
Sorry, it's not working.
I says that it can't find the file.
Below is error message, if it helps.
Thanks😊
Hi @madstrolle,
From what I can see, the document you are firing the rule from is a new document that has not been saved, thus missing the extension in the display name. Please save the document on your computer before firing the rule.
Kind regards,
FINET L.
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"
This might then be due to windows directory options : No file type extension - Autodesk Community - Inventor
Anyway, to fix the issue (line 9), here is the code :
Dim actDoc As Inventor.DrawingDocument = ThisApplication.ActiveDocument
Dim file As String = actDoc.FullFileName 'full drawing path
Dim name As String = actDoc.DisplayName 'drawing name
Dim dir As String = "03.Native"
Dim targetDir As String = "01.PDF"
Dim s As String = Left(file, file.Length - (dir.Length + (name.Length + 4)) -1) '-1 for \
Dim pdfname As String = name & ".pdf"
Dim pdfdoc As String = s & targetDir & "\" & pdfname
ThisDoc.Launch(pdfdoc)
I might have done it wrong since I don't have any environement to test, can you try ?
Kind regards,
FINET L.
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"
Still not working, but it looks like it has the correct extension.
But in the path it says 001.PDF, where it should say 01.PDF?
Perhaps the directories names are missing a space ? :
Dim actDoc As Inventor.DrawingDocument = ThisApplication.ActiveDocument
Dim file As String = actDoc.FullFileName 'full drawing path
Dim name As String = actDoc.DisplayName 'drawing name
Dim dir As String = "03. Native"
Dim targetDir As String = "01. PDF"
Dim s As String = Left(file, file.Length - (dir.Length + (name.Length + 4)) -1) '-1 for \
Dim pdfname As String = name & ".pdf"
Dim pdfdoc As String = s & targetDir & "\" & pdfname
ThisDoc.Launch(pdfdoc)
Kind regards,
FINET L.
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"Can't find what you're looking for? Ask the community or share your knowledge.