Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic code doesnt work HELP

5 REPLIES 5
Reply
Message 1 of 6
nbaryosef
372 Views, 5 Replies

iLogic code doesnt work HELP

here is the code it doesnt work, does anyone sees somthing wrong?

 

    If (Length = 96<>120)
        Feature.IsActive("Hole3") = True
        Feature.IsActive("Hole4") = True
        Feature.IsActive("Hole5") = True
        Else If (Length = 72<>96)
        Feature.IsActive("Hole3") = True
        Feature.IsActive("Hole4") = False
        Feature.IsActive("Hole5") = True
        Else If (Length = 48<>72)
        Feature.IsActive("Hole3") = False
        Feature.IsActive("Hole4") = True
        Feature.IsActive("Hole5") = False
        Else If (Length = 0<>48)
        Feature.IsActive("Hole4") = False
        Feature.IsActive("Hole3") = False
        Feature.IsActive("Hole5") = False
    End If
    If (Length = 96<>120)
        pat_no = 3
        pat_dist = 45
        Else If (Length = 72<>96)
        pat_no = 5
        pat_dist = 60
        Else If (Length = 48<>72)
        pat_no = 5
        pat_dist = 60
        Else If (Length = 0<>48)
        pat_no = 5
        pat_dist = 60
        
    End If
    
    
iLogicVb.UpdateWhenDone = True
ThisApplication.ActiveView.Fit
5 REPLIES 5
Message 2 of 6
pcrawley
in reply to: nbaryosef

There are a couple of issues:

 

1.  You need the word "Then" after the If condition (and after the Else If's)

 

If (Length = 96<>120) Then

2. Your condition makes no sense:  In English, you've written "If length equals 96 doesn't equal 120" - and where I come from, I don't understand it 🙂

 

I think you want something like:

 

If (Length >= 96 and Length <= 120) Then

...

Else If (Length >= 72 and Length < 96) Then

...

Else If (Length >= 48 and Length < 72) Then

...

Else If (Length >= 0 and Length < 48) Then

 

I've used >= because you probably want to catch the 0, 48, 96 and 120 values.  Without the = you'll find your code excludes those values and you might end up with some other error.

 

Use the same techniques to fix the remainder of your code.

Peter
Message 3 of 6
nbaryosef
in reply to: nbaryosef

Thank you very much

 

i have small question

If i have the rule in the part itself and the part is going to be in assembly how could i bring it in into my assembly

it doesnt show in the i logic rules?

Message 4 of 6
mrattray
in reply to: nbaryosef

You have two ways to trigger the rule in the part from the assembly:
1) The rule will automatically trigger if any of the parameters it references changes.
2) You can create a rule in the assembly and use the "run rule in component" snippet to trigger the part's rule.
Mike (not Matt) Rattray

Message 5 of 6
nbaryosef
in reply to: nbaryosef

whats the right way to write the 

"run rule in component" line

Message 6 of 6
mrattray
in reply to: nbaryosef

Capture.JPG

Mike (not Matt) Rattray

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report