- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I need some help form you 🙂
I have some iLogic that helps te determine what sort of file I have, I will use it do let it run some other iLogic.
The whole routine runs good, but it gives an error when I save an iAssembly member.
Hope someone can help me get the error out and make a good working routine.
The error:
Error in rule: 00_Start, in document: ilogic Test iAssembly File-01.iam
Kan lid niet vinden. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))
More Info:
System.Runtime.InteropServices.COMException (0x80020003): Kan lid niet vinden. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))
at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)
Here the part of the routine that gives an error:
SyntaxEditor Code Snippet
Dim oDoc As Document = ThisDoc.Document 'Assembly file If oDoc.DocumentType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject Then If oDoc.ComponentDefinition.IsiAssemblyFactory Then MessageBox.Show("This is an iAssemblyFactory", "I will stop") Return Else If oDoc.ComponentDefinition.IsiAssemblyMember Then MessageBox.Show("This is an iAssemblyMember", "I will stop") 'Here it gives an error when I save the iAssembly Members Return End If MessageBox.Show("This is an Assembly", "I will Return") End If
The whole code:
SyntaxEditor Code Snippet
Dim oDoc As Document = ThisDoc.Document 'Presentation file If oDoc.DocumentType = Inventor.DocumentTypeEnum.kPresentationDocumentObject Then MessageBox.Show("This is a Presentation", "I will stop") Return 'Part file Else If oDoc.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject And oDoc.SubType <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then If oDoc.ComponentDefinition.IsiPartFactory Then MessageBox.Show("This is an iPartFactory", "I will stop") Return Else If oDoc.ComponentDefinition.IsiPartMember Then MessageBox.Show("This is an iPartMember", "I will stop") Return End If If TypeOf ThisApplication.ActiveEditObject Is Sketch Then MessageBox.Show("You have a sketch active in a part file.", "Stop the Sketch") Else MessageBox.Show("This is a Part", "I will Return") End If 'SheetMetal file Else If oDoc.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject And oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then If TypeOf ThisApplication.ActiveEditObject Is Sketch Then MessageBox.Show("You have a sketch active in a part file.", "Stop the Sketch") Else MessageBox.Show("This is a Sheetmetal Part", "I will Return") End If 'Assembly file Else If oDoc.DocumentType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject Then If oDoc.ComponentDefinition.IsiAssemblyFactory Then MessageBox.Show("This is an iAssemblyFactory", "I will stop") Return Else If oDoc.ComponentDefinition.IsiAssemblyMember Then MessageBox.Show("This is an iAssemblyMember", "I will stop") 'Here it gives an error when I save the iAssembly Members Return End If If TypeOf ThisApplication.ActiveEditObject Is Sketch Then MessageBox.Show("You have a sketch active in an assembly file.", "Stop the Sketch") Else MessageBox.Show("This is an Assembly", "I will Return") End If 'Drawing file Else If oDoc.DocumentType = Inventor.DocumentTypeEnum.kDrawingDocumentObject Then If TypeOf ThisApplication.ActiveEditObject Is Sketch Then MessageBox.Show("You have a sketch active in a drawing file.", "Stop the Sketch") Else MessageBox.Show("This is a Drawing", "I will Return") End If MessageBox.Show("How did I get here?", "???") End If MessageBox.Show("I have Returend", "Yeah")
If you find this reply helpful ? It would be nice if you use the Accept as Solution or Kudos button below.
Solved! Go to Solution.