if and then statements

if and then statements

sjoerd.van.der.eerden
Contributor Contributor
245 Views
2 Replies
Message 1 of 3

if and then statements

sjoerd.van.der.eerden
Contributor
Contributor

hi, i'm making an configurable inventor model with ilogic. 
i have two paramerters that controle the same feutures. there are a total of 4 combinations that can be made. but only one of them works. this is the piece of code i used.

 

If aantal_vulpunten = "1" And leiding_inkomst = "achterkant" Then
     Feature.IsActive("achterkant:1", "Extrusion4") = "true"
     Feature.IsActive("achterkant:1", "Extrusion5") = False 
     Feature.IsActive("top:1", "Extrusion2") = False 
     Feature.IsActive("top:1", "Extrusion3") = False 

ElseIf aantal_vulpunten = "2" And leiding_inkomst = "achterkant" Then
     Feature.IsActive("achterkant:1", "Extrusion4") = False  
     Feature.IsActive("achterkant:1", "Extrusion5") = "true"
     Feature.IsActive("top:1", "Extrusion2") = False 
    Feature.IsActive("top:1", "Extrusion3") = False 
	
ElseIf aantal_vulpunten = "1" And leiding_inkomst = "bovenkant" Then
    Feature.IsActive("achterkant:1", "Extrusion4") = False  
    Feature.IsActive("achterkant:1", "Extrusion5") = False 
    Feature.IsActive("top:1", "Extrusion2") = "true"
    Feature.IsActive("top:1", "Extrusion3") = False 
	
ElseIf aantal_vulpunten = "2" And leiding_inkomst = "bovenkant" then
    Feature.IsActive("achterkant:1", "Extrusion4") = False  
    Feature.IsActive("achterkant:1", "Extrusion5") = False 
    Feature.IsActive("top:1", "Extrusion2") = "true" 
    Feature.IsActive("top:1", "Extrusion3") = "true"

End    

any advise?

thanks in advance. 

0 Likes
246 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

Hi @sjoerd.van.der.eerden.  The first thing I am seeing that does not look correct is that you are putting quotation marks around some of your Boolean type values.  When using Feature.IsActive() methods, you need to always set the value as either True or False, and never with "true" in quotes.  If the value is in quotation marks, it is seen as a String instead of a Boolean, so it will fail.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

sjoerd.van.der.eerden
Contributor
Contributor
I deleted the quotation marks but that didn't seem to be the problem.
it turned out there was an extra space in one of the names. therfore it dind't recognise it.
aparently a space can cost you an hour of your day.
but thank you for the advise, really appreciate it. 🙂
0 Likes