- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey everyone!
Recently I added this rule to my ipt sheet template (I found this rule here, at Autodesk Knowledge).
Dim oSMDoc As PartDocument = ThisApplication.ActiveDocument Dim oSMDef As SheetMetalComponentDefinition = oSMDoc.ComponentDefinition If oSMDef.HasFlatPattern = False Then MsgBox("There is no Flat Pattern yet.", vbOKOnly, "NO FLAT PATTERN") Return End If Dim oTopFace As Face = oSMDef.FlatPattern.TopFace Dim oMeasureTools As MeasureTools = ThisApplication.MeasureTools Dim oLoopLength As Double = 0 For Each oEdgeLoop As EdgeLoop In oTopFace.EdgeLoops oLoopLength = oLoopLength + oMeasureTools.GetLoopLength(oEdgeLoop) Next iProperties.Value("Custom", "CONTORNOTOTAL") = Round(oLoopLength*10)
Inside the IPT template, this rule is working fine! No problems at all!
But, if I add the IPT with this rule to a IAM enviroment and save it, it gives me this error in rule:
ERROR MESSAGE
Error in rule: CONTORNOTOTAL, in document: Peça6.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: There is no support to this interface (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
MORE INFO
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: There is no support to this interface (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at ThisRule.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)
Does anyone knows the cause of it and how to fix it?
Thanks!!
Solved! Go to Solution.