- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
It's based of another post and modified. Essentially i'm having to set the visibility, etc of all the pieces of a circular pattern.
The rule works completely fine in the assembly it's written in. This assembly inserted into another assembly. When saving all files in the upper level assembly, it generates and error on this rule in the sub assembly.
The code:
Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument Dim oPattern As OccurrencePattern oPattern = oDoc.ComponentDefinition.OccurrencePatterns.Item("FRS_Pattern 3:1") Dim oPatternElement As OccurrencePatternElement For Each oPatternElement In oPattern.OccurrencePatternElements Dim oOcc As ComponentOccurrence For Each oOcc In oPatternElement.Occurrences If FRS_SEGMENTS= 1 then oOcc.Enabled = False oOcc.Visible = False oOcc.BOMStructure = 51972 else oOcc.Enabled = True oOcc.Visible = True oOcc.BOMStructure = 51969 End if Next Next
The error:
iLogic Rule Error in rule: FRS_YN, in document: U_TIP_BODY_ASSY.iam
Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))
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.OccurrencePatterns.get_Item(Object Index)
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at e.a(String A_0)
Solved! Go to Solution.