Ilogic error - can you help fix?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am getting an error message with the Ilogic code below. I can't find the fault can you?
ERROR MESAGE...
Error in rule: C3 Drawing EXPORT DWF, in document: Pool Wall.idw
Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
MORE INFO...
System.Runtime.InteropServices.COMException (0x80004005): Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Inventor.Document.Save()
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)
ILOGIC CODE...
Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 42650 StartFragment: 314 EndFragment: 42618 StartSelection: 314 EndSelection: 314SyntaxEditor Code Snippet
'check if custom iproperty "DWF Location" exists and add it if not found Dim propertyName1 As String = "DWF Location" customPropertySet = ThisDoc.Document.PropertySets.Item _ ("Inventor User Defined Properties") Try prop = customPropertySet.Item(propertyName1) Catch ' Assume error means not found customPropertySet.Add("Blank", propertyName1) End Try 'output the custom iproperties and update the file RuleParametersOutput() InventorVb.DocumentUpdate() '------------------------------------------------------------------------------------ 'Warning - Save current document question = MessageBox.Show("To proceed you must save this document... " _ & vbLf & " " _ & vbLf & " " _ & vbLf & " Do you want save and continue?" _, "Warning",MessageBoxButtons.YesNo,MessageBoxIcon.Question) If question = vbNo Then Return End If '------------------------------------------------------------------------------------ 'Warning - overwrite? question2 = MessageBox.Show("*** This will overwrite any existing DWF files? ***" _ & vbLf & " " _ & vbLf & " " _ & vbLf & " Do you want to continue?" _, "Warning",MessageBoxButtons.YesNo,MessageBoxIcon.Question) If question2 = vbNo Then Return End If '----------------------------------------------------------------------------------- 'Is "DWF Location" custom property = "blank"... If iProperties.Value("Custom", "DWF Location")= "Blank" Then 'Set file location ODWF_Location = InputBox("File location is not specified. Please enter one." _ & vbLf & " " _ & vbLf & "*** NOTE ***" _ & vbLf & "This location will be saved for next time. It can be altered by changing the IProperty DWF Location, if required" _, "Enter file location", "M:\(A2) Vault duplicate\Designs\Job year 14-15\59 South Edwards Square") iProperties.Value("Custom", "DWF Location") = ODWF_Location 'UPDATE RuleParametersOutput() iLogicVb.UpdateWhenDone = True End If 'If message box cancel is selected... If iProperties.Value("Custom", "DWF Location")="" Then iProperties.Value("Custom", "DWF Location") = "Blank" 'UPDATE RuleParametersOutput() iLogicVb.UpdateWhenDone = True Return End If '---------------------------------------------------------------------------------- 'save current document ThisDoc.Save '----------------------------------------------------------------------------------- 'Change line weight Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument For Each oLayer In oDrawDoc.StylesManager.Layers oLayer.LineWeight = 0.001 Next '---------------------------------------------------------------------------------------------------------------------- 'this rule outputs all drawing sheets to dwf, 3D models of first sheet included oLocation = iProperties.Value("Custom", "DWF Location") & "\" oFileName = ThisDoc.FileName(False) 'without extension oRevNum = iProperties.Value("Project", "Revision Number") 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") = 0 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 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 = oLocation & oFileName & " Rev " & oRevNum & ".dwf" Call DWFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) ThisApplication.ActiveDocument.Close(True)