- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Its throwing up the following error "
Error in rule: Rule0, in document: JE352-100-07TEMPL Hopper Joiner Plate.dwg
Unable to cast COM object of type 'Inventor._DocumentClass' to interface type 'Inventor.View'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{70109AA3-63C1-11D2-B78B-0060B0EC020B}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))."
More Info,
"System.InvalidCastException: Unable to cast COM object of type 'Inventor._DocumentClass' to interface type 'Inventor.View'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{70109AA3-63C1-11D2-B78B-0060B0EC020B}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)"
Also, see code modified for the file path I require... have I done something wrong?
Imports SysIO = System.IO
Sub Main()
'Check pre-processing conditions.
If (ThisApplication.Views.Count = 0) Then: Exit Sub: End If
Dim DWGAddIn As TranslatorAddIn = ThisApplication.ApplicationAddIns.ItemById("{C24E3AC2-122E-11D5-8E91-0010B541CD80}")
Dim oContext As TranslationContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = kFileBrowseIOMechanism
Dim oOptions As NameValueMap = ThisApplication.TransientObjects.CreateNameValueMap
Dim oDataMedium As DataMedium = ThisApplication.TransientObjects.CreateDataMedium
For Each oVisDoc As View In ThisApplication.Documents.VisibleDocuments
If oVisDoc.DocumentType = kDrawingDocumentObject Then
DocName = SysIO.Path.GetFileName(oVisDoc.FullFileName)
Dim dwgDir = SysIO.Path.GetDirectoryName(oVisDoc.FullFileName)
'required path - 'Dim dwgDir = "S:\Drawing Office\Inventor Design Folder\Export Copy Main Directory - Shared\dwg\"
oDataMedium.MediumType = kFileNameMedium
oDataMedium.FileName = dwgDir & iProperties.Value(DocName, "Project", "Part Number") & " Rev. " & iProperties.Value(DocName, "Project", "Revision Number") & ".dwg"
If DWGAddIn.HasSaveCopyAsOptions(oVisDoc, oContext, oOptions) Then
Dim strIniFile As String = "S:\Drawing Office\Inventor Design Folder\Export Copy Main Directory - Shared\dwg\Format2000DONOTDELETE.ini"
oOptions.Value("Export_Acad_IniFile") = strIniFile
Call DWGAddIn.SaveCopyAs(oVisDoc, oContext, oOptions, oDataMedium)
End If
End If
Next
End Sub