Hi!
I have an assembly with several parts where I use a pattern to duplicate the parts in the height. I cannot use the pattern sideways due to different center distances between the parts. I could get this distance by using several patterns, but I rather not if there is another way.
I have made a code for suppressing the parts in element 2 if the same part is suppressed in element 1.
IfComponent.IsActive("FB-07 midtstykke-001:1")=False ThenComponent.IsActive("FB-07 midtstykke-001:2")=FalseElseComponent.IsActive("FB-07 midtstykke-001:2")=TrueEndIf
which works fine, however, I only want the rule to run if two criterias are true. I`ve tried the following:
If Component.IsActive("FB-02 midtstykke-001:1") = False And No = 2 Then
component.IsActive("FB-07 midtstykke-001:2") = False
Else
Componen.....
End if
But this rule runs even if No = 3, which it shouldnt. Any ideas?
Thanks in advance 🙂
I usually use this method as I have had trouble using 'AND'.
If Component.IsActive("FB-02 midtstykke-001:1") = False
If No = 2 Then
component.IsActive("FB-07 midtstykke-001:2") = False
Else
Componen.....
End If
Else
Component...
End if
It's basically just an IF within an IF
Nice, Thank you!
However, this code does not turn the part back on if Component.IsActive("FB-02 midtstykke-001:1") = True
If Component.IsActive("FB-07 midtstykke-001:1")=False Then IfNo=2 ThenComponent.IsActive("FB-07 midtstykke-001:2")=FalseElseComponent.IsActive("FB-07 midtstykke-001:2")=TrueEndIf EndIf
IfComponent.IsActive("FB-07 midtstykke-001:1")=TrueThen IfNo=2 ThenComponent.IsActive("FB-07 midtstykke-001:2")=TrueElseComponent.IsActive("FB-07 midtstykke-001:2")=FalseEndIfEndIf
What would the code be if I should have used 1 if then code? Is it better to use 1 more complex then 2 "easier" code?this code will be copied maaaaany times!
You shouldn't have to copy the code twice with 'False' replaced with 'True. The function after 'Else' should do this for you.
What is 'No'? If it is a parameter, then you will need to replace it with 'Parameter("No")'.
I'm not sure I understand what you are wanting to achieve but try pasting the following.
If Component.IsActive("FB-02 midtstykke-001:1") = False Then
If Parameter("No") = 2 Then
Component.IsActive("FB-07 midtstykke-001:2") = False
Else
Component.IsActive("FB-07 midtstykke-001:2") = True
End If
Else
component.IsActive("FB-07 midtstykke-001:2") = True
End if
The "And" function works just fine for me in my applications, I use it extensively. Can you post your files or an example that shows the same problem for me to look at?