cannot unsuppress a component in a sub-assembly in model state by running a rule in the sub-assembly from upper main assembly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hi, every one,
recently, I began to use inventor 2022. obviously, all my old programs using LOD must be transferred to use model state.
I was trying to write some simple programs to imitate what I did when I was using LOD.
unfortunately, I found that I could not unsuppress a component(if this component is already in suppressed state) in a sub-assembly by running a rule in the sub-assembly from the upper main assembly.
the rule in my sub-assembly is very simple:
Dim doc As Document = ThisDoc.Document
Dim FacDoc As Document = doc.ComponentDefinition.FactoryDocument
If FacDoc.RequiresUpdate
FacDoc.Update
FacDoc.Save
End If
Try
FacDoc.ComponentDefinition.ModelStates.Item("Ilogic").Activate
Catch
FacDoc.ComponentDefinition.ModelStates.Add("Ilogic")
Finally
FacDoc.ComponentDefinition.ModelStates.Item("Ilogic").Activate
End Try
'----set "Ilogic" as the active model state
'I want to unsuppress the following component and then update it.
Component.IsActive("DP10-2054:1") = True
RuleParametersOutput()
InventorVb.DocumentUpdate()
'after update, this component is useless, I must suppress it.
Component.IsActive("DP10-2054:1") = False
if I opened this sub-assembly to run this rule, it was ok, there was no problem.
if I put this sub-assembly under my upper main assembly, and in the rule in my upper main assembly, I run this
rule in the following way, the error occurred---that is , the component could not be "unsuppressed":
iLogicVb.RunRule("sub assy for test:1", "part suppress rule")
I have tried to think over this issue and done different tests for 8 days, and still cannot find a solution.
my questions are:
1. is this because I was using model state?
2. model state does not allow us to run rules in this way?
3. how can I make my rule run in my sub-assembly from the upper main assembly?
4. I just want to imitate my old ways in LOD using model state, just to try to modify all my old programs to make them
able to run under inventor 2022. Is there a more direct and simpler method? any special aspects that I must pay attention to when I use model state?
any ideas?
thanks in advance.