Autodesk Inventor
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
iLogic If then formulas
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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 ![]()
Re: iLogic If then formulas
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Inventor 2013 Certified Professional
Autodesk Inventor Professional 2011
Windows 7 Enterprise, 64-bit
Re: iLogic If then formulas
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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!
Re: iLogic If then formulas
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
some thing happend there.
Basically the same formula, but if compon... = True then
if No = 2 then
Com....
Re: iLogic If then formulas
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Inventor 2013 Certified Professional
Autodesk Inventor Professional 2011
Windows 7 Enterprise, 64-bit
Re: iLogic If then formulas
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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?
