Hi all!
I have a serious problem with many ilogic automatic creation, pdf, dxf, dwf, etc,... Sometime save on my c: and another time in my workgroup if i'm in check in or check out!
oPath=ThisDoc.Path
It's possible to created all the time in my workgroup???
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi sergelachance,
Here are a couple of links that might provide some ideas:
http://inventortrenches.blogspot.com/2012/07/ilogic-get-file-information-for.html
http://inventortrenches.blogspot.com/2012/07/ilogic-and-inventor-project-file.html
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Hi Curtis!
Thanks for your help 🙂
It's possible to created or save all the time in workgroup forlder?
i'm looking your rule but in check in and check out the file location is not the same!
Hi sergelachance,
Because you can have multiple workgroups defined in your project file, you need to hand them to an array. Here's an example that reports all of the workgroups:
Dim asNames() As String = {}
Dim asPaths() As String = {}
Dim iNumWorkgroups As Long
ThisApplication.FileLocations.Workgroups(iNumWorkgroups, asNames, asPaths)
i = 0
Do until i = iNumWorkgroups
wGName = asNames(i)
wGPath = asPaths(i)
MessageBox.Show("WorkGroup Name: " & wGName _
& vblf & "WorkGroup Path: " & wGPath , "iLogic")
i = i + 1
Loop
If you know that you only have one workgroup, I suppose you could use something like this:
Dim asNames() As String = {} Dim asPaths() As String = {} Dim iNumWorkgroups As Long ThisApplication.FileLocations.Workgroups(iNumWorkgroups, asNames, asPaths) MessageBox.Show("WorkGroup Name: " & asNames(0) _ & vblf & "WorkGroup Path: " & asPaths(0) , "iLogic")
And just in case someone is looking for how to find the workspace path directly , here it is as well:
MyWorkSpace = ThisApplication.FileLocations.Workspace MessageBox.Show("WorkSpace Path: " & MyWorkSpace, "iLogic")
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Thanks Curtis 🙂
Work great to find but not to save or created pdf, dxf, dwf, excell, ect,....
Hi sergelachance,
Here is an example using a workgroup path to save a PDF file:
Dim oDocument As Inventor.DrawingDocument oDocument = ThisApplication.ActiveDocument 'find workgroup Dim asNames() As String = {} Dim asPaths() As String = {} Dim iNumWorkgroups As Long ThisApplication.FileLocations.Workgroups(iNumWorkgroups, asNames, asPaths) If iNumWorkgroups = 0 Then MessageBox.Show("No Workgroups are defined in the current project.", "iLogic") Return End If 'Save PDF with options PDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}") oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism oOptions = ThisApplication.TransientObjects.CreateNameValueMap oDataMedium = ThisApplication.TransientObjects.CreateDataMedium 'set PDF options If PDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then oOptions.Value("Remove_Line_Weights") = 1 oOptions.Value("Vector_Resolution") = 400 oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets End If 'set document name docName = ThisDoc.FileName(False) 'without extension 'Set the destination file name oDataMedium.FileName = asPaths(0) & "\" & docName & ".pdf" 'Publish document. Call PDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) MessageBox.Show("PDF saved to: " & oDataMedium.FileName, "iLogic")
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Hi sergelachance,
I copied the code in the message 6 Curtis_Waguespack provided in a drawing document. It works well without any problem. I can only see some snippet off your screenshot. Are you using the same code in message 6? In addition, could you translate the error message to English? Probably it would help to diagnose what happened at your side.
Rule Compile Errors in PRINT_PDF, in CARTOUCHE.idw
Error on Line 8 : Argument not specified for parameter 'Names' de 'Public Sub Workgroups(ByRef NumWorkGroups As Integer, ByRef Names() As String, ByRef Paths() As String)'.
Error on Line 8 : Comma, ')', or a valid expression continuation expected
Error on Line 8 : Too many arguments to 'Public Sub Workgroups(ByRef NumWorkGroups As Integer, ByRef Names() As String, ByRef Paths() As String)'.
Error on Line 17 : End of statement expected.
Error on Line 19 : End of statement expected.