error running rule in subassembly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
i have a rule where i run another rule in a subassembly that is in another subassembly.
(main assembly: rule --> sub --> sub: rule)
everything seems to work fine when opening the sub and running the rule but i get an error when suppressing mates.
previously i also got an error when using component.visible in the sub rule, so i replaced all the component.visible with a function:
Function Componentvisibility (Name As String, visibility As Boolean)
Dim doc As Document = ThisDoc.Document
Dim compdef As ComponentDefinition = doc.componentdefinition
For Each occ As ComponentOccurrence In compdef.Occurrences
If occ.Name = Name Then
occ.Visible = Visibility
Exit For
End If
Next
End Function
this works fine and solves all visibility issues i had.
so when i got an error when suppressing constraints with constraint.isactive is also created a function for that:
Function ConstraintIsActive(Name As String, State As Boolean)
Dim doc As Document = ThisDoc.Document
Dim compdef As ComponentDefinition = doc.componentdefinition
State = Not State
For Each cons As AssemblyConstraint In compdef.constraints
If cons.Name = Name Then
cons.Suppressed = State
Exit For
End If
Next
End Function
but this does not seem to fix the problem. everytime i get an error at line 7 (of the example)
it looks like constraints.isactive as well as cons.suppressed are write protected.
The file is checked out/ not read-only.
The file is open visible.
when running the rule in the subassembly manually (not ran from another ilogic rule) i don't get any errors, so i assume it has something to do with the different assembly levels this code is excecuted.
are there any known erros/ solutions for this problem?