Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ilogic oPath in workgroup!

9 REPLIES 9
SOLVED
Reply
Message 1 of 10
ChristinaForest
873 Views, 9 Replies

ilogic oPath in workgroup!

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???

9 REPLIES 9
Message 2 of 10

Message 3 of 10

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!

Message 4 of 10

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

Message 5 of 10

Thanks Curtis 🙂

 

Work great to find but not to save or created pdf, dxf, dwf, excell, ect,....

Message 6 of 10

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

Message 7 of 10

error ruleerror.PNG

Message 8 of 10

Hi sergelachance,

 

I copied the code in the message 6 

Message 9 of 10

yes a copy paste

Message 10 of 10

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report