iLogic error with folding sheet metal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am using the following code to automatically create a flat pattern when I save a sheet metal document.
Dim oDoc As PartDocument oDoc = ThisApplication.ActiveDocument Dim State As SheetMetalComponentDefinition State=oDoc.ComponentDefinition If State.HasFlatPattern = False Then State.Unfold End If
The problem comes when I insert this part into an assembly. When the sheet metal part has been edited and I save the assembly I get the following error:
Error in rule: unfold, in document: Part19.ipt
Unable to cast COM object of type 'Inventor._DocumentClass' to interface type 'Inventor.PartDocument'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{29F0D463-C114-11D2-B77F-0060B0F159EF}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
More Info tab:
System.InvalidCastException: Unable to cast COM object of type 'Inventor._DocumentClass' to interface type 'Inventor.PartDocument'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{29F0D463-C114-11D2-B77F-0060B0F159EF}' 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)
Any ideas?
