iLogic DWF Export Problem
Hello All,
I have been attempting to use iLogic to generate a dwf. The rule I created contains the verbatim code from the "Publish DWF 2D and 3D" snippet. The problem is that the rule does not generate the 3d model, only the sheet. I have tested this on numerous drawings, with the same result. The only fix I have found is to initiate the Export > Export to DWF command using the "Complete" option, or "Custom" and selecting "3D Model" in the Drawing tab. The rule will then function correctly. Obviously this is a waste of time.
I have just begun playing with iLogic, so I do not know how to tweak the code to get it to work.
I was going to attach a sample ipt and its idw, but I was unable to upload the zip (or any file, for that matter), so I am pasting the code here instead:
'this rule outputs all drawing sheets to dwf, 3D models of first sheet included
path_and_name = ThisDoc.PathAndFileName(False)
DWFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD95-2F4D-42CE-8BE0-8AEA580399E4}")
oDocument = ThisApplication.ActiveDocument
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
i = MessageBox.Show("Launch the viewer now?", "Title",MessageBoxButtons.YesNo)
If i = vbYes Then : launchviewer = 1 : Else : launchviewer = 0 : End If
If DWFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
oOptions.Value("Launch_Viewer") = launchviewer
oOptions.Value("Publish_All_Component_Props") = 1
oOptions.Value("Publish_All_Physical_Props") = 1
oOptions.Value("Password") = 0
If TypeOf oDocument Is DrawingDocument Then
Dim oSheets As NameValueMap
oSheets = ThisApplication.TransientObjects.CreateNameValueMap
oOptions.Value("Publish_Mode") = DWFPublishModeEnum.kCustomDWFPublish
oOptions.Value("Publish_All_Sheets") = 1
' Publish the first sheet AND its 3D model
Dim oSheet1Options As NameValueMap
oSheet1Options = ThisApplication.TransientObjects.CreateNameValueMap
oSheet1Options.Add("Name", "Sheet:1")
oSheet1Options.Add("3DModel", True)
oSheets.Value("Sheet1") = oSheet1Options
End If
End If
oDataMedium.FileName = path_and_name & ".dwf"
Call DWFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
If launchviewer = 1 Then ThisDoc.Launch(path_and_name & ".dwf")
Any help is appreciated.
Thank you.
Inv 2012 Pro
Win7 64 Ult
Design Review 2012/2013
Re: iLogic DWF Export Problem
Bunny i think i found the answer for this problem. There is a line of code missing in the Inventor Snippet. Add the red line of code and the ilogic-rule is working for me.
If DWFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
oOptions.Value("Launch_Viewer") = launchviewer
oOptions.Value("Publish_All_Component_Props") = 1
oOptions.Value("Publish_All_Physical_Props") = 1
oOptions.Value("Password") = 0
oOptions.Value("Publish_3D_Models") = Publish_3D_Models
If TypeOf oDocument Is DrawingDocument Then
Rob.
Re: iLogic DWF Export Problem
Thank you Rob. Works perfectly!
Re: iLogic DWF Export Problem
Perfect code! Thanks all.
Re: iLogic DWF Export Problem
This was great and help me do some things I wanted as well but I have something else I would like to do. I would like to use code to open a dwf markup and then republish the markup. Here is how I modified the code for the first step of making the dwf for the next person to check and mark up:
opath = ThisDoc.WorkspacePath()
oname = ThisDoc.FileName(False) ' without extension
DWFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD95-2F4D-42CE-8BE0-8AEA580399E4}")
oDocument = ThisApplication.ActiveDocument
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
If DWFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
oOptions.Value("Launch_Viewer") = launchviewer
oOptions.Value("Publish_All_Component_Props") = 1
oOptions.Value("Publish_All_Physical_Props") = 1
oOptions.Value("Password") = 0
End If
'Set the destination file name
oDataMedium.FileName = opath & "\Markups\Check\" & oname & ".dwf"
'Publish document.
Call DWFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
This is all I have for opening the overlay:
opath = ThisDoc.WorkspacePath()
oname = ThisDoc.FileName(False)
ThisApplication.Documents.Open(opath & "\Markups\Check\" & oname & ".dwf")
Now I want code to republish and dont know how to go about that..... Any help would be great! Thanks!
Re: iLogic DWF Export Problem
Quote:
Originally Posted by
RvdVeek
Bunny i think i found the answer for this problem. There is a line of code missing in the Inventor Snippet. Add the red line of code and the ilogic-rule is working for me.
If DWFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
oOptions.Value("Launch_Viewer") = launchviewer
oOptions.Value("Publish_All_Component_Props") = 1
oOptions.Value("Publish_All_Physical_Props") = 1
oOptions.Value("Password") = 0
oOptions.Value("Publish_3D_Models") = Publish_3D_Models
If TypeOf oDocument Is DrawingDocument Then
Rob.
Rob,
Can you add a line that would override the sheet color to be white? The pale yellow is great for reducing eye-strain, but not so hot for copy.
Thanks!
Re: iLogic DWF Export Problem
Bunny, i think if you add these lines under the 'RED' line you change the sheet color to white. If it's not working let me know so i can test it myself, because i can't test it now.
oOptions.Value("Override_Sheet_Color") = 1
' Create o color property to change the color to white
Dim oSheetColor As Color
oSheetColor = ThisApplication.TransientObjects.CreateColor(255, 255, 255)
oOptions.Value(Sheet_Color") = oSheetColor
Rob.