ilogic oPath in workgroup!

ilogic oPath in workgroup!

Anonymous
Not applicable
1,144 Views
9 Replies
Message 1 of 10

ilogic oPath in workgroup!

Anonymous
Not applicable

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

0 Likes
Accepted solutions (1)
1,145 Views
9 Replies
Replies (9)
Message 2 of 10

Curtis_Waguespack
Consultant
Consultant

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

EESignature

0 Likes
Message 3 of 10

Anonymous
Not applicable

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!

0 Likes
Message 4 of 10

Curtis_Waguespack
Consultant
Consultant

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

EESignature

0 Likes
Message 5 of 10

Anonymous
Not applicable

Thanks Curtis 🙂

 

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

0 Likes
Message 6 of 10

Curtis_Waguespack
Consultant
Consultant
Accepted solution

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

EESignature

0 Likes
Message 7 of 10

Anonymous
Not applicable

error ruleerror.PNG

0 Likes
Message 8 of 10

xiaodong_liang
Autodesk Support
Autodesk Support

Hi sergelachance,

 

I copied the code in the message 6 

0 Likes
Message 9 of 10

Anonymous
Not applicable

yes a copy paste

0 Likes
Message 10 of 10

Anonymous
Not applicable

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.

0 Likes