Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have the following rule inside an assembly to change the Component Pattern direction and it works fine, until I try to run it from the top level assembly.
'Triggers
t = PatternDirection
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = oDoc.ComponentDefinition
Dim oOccPat1 As OccurrencePattern
oOccPat1 = oAsmCompDef.OccurrencePatterns.Item("Solids Pattern")
Dim oOccPat2 As OccurrencePattern
oOccPat2 = oAsmCompDef.OccurrencePatterns.Item("Bounding box Pattern")
If PatternDirection = True Then
oOccPat1.ColumnEntityNaturalDirection = True
oOccPat2.ColumnEntityNaturalDirection = True
ElseIf PatternDirection = False Then
oOccPat1.ColumnEntityNaturalDirection = False
oOccPat2.ColumnEntityNaturalDirection = False
End If
I'm suspecting this has something to do with
oDoc = ThisApplication.ActiveDocument
As I guess it is not the "ActiveDocument" if you call for this rule from another document?
The error I get when I try to run it is the following:
Error in rule: PatternDirection, in document: OUTLET1.iam Odefinierat fel (Exception from HRESULT: 0x80004005 (E_FAIL))
Happy for any advice on how to rewrite this rule so it can be triggered from outside the actual assembly.
Thanks!
/Fredrik
Solved! Go to Solution.
