Rule with multiple options

Rule with multiple options

KaynePellegrino
Enthusiast Enthusiast
447 Views
20 Replies
Message 1 of 21

Rule with multiple options

KaynePellegrino
Enthusiast
Enthusiast

This is a long one.

------------------------

 

I make doors. They can be different Widths and Heights, among different Types.

Widths:

3-6 (41.75")

3-0 (35.75")

2-10 (33.75")

2-8 (31.75")

2-6 (29.75")

 

Heights:

8-0 (95.375")

6-8 (79.375")

 

Types:

1K (1-Panel)

2K (2-Panel

3F (3-Panel)

3S (3-Panel w/ Glass)

50 (5-Panel)

 

------------------------

 

I have a Width Param & Rule:

DoorWidthOptions [Text, Multi]: 3-6, 3-0, 2-10, 2-8, 2-6

DoorWidth [Num]: (Varies)

Door Width Rule:

'Door Width
If DoorWidthOptions = "3-6" Then
		DoorWidth = 41.75
	End If

If DoorWidthOptions = "3-0" Then
		DoorWidth = 35.75
	End If

If DoorWidthOptions = "2-10" Then
		DoorWidth = 33.75
	End If

If DoorWidthOptions = "2-8" Then
		DoorWidth = 31.75
	End If

If DoorWidthOptions = "2-6" Then
		DoorWidth = 29.75
	End If

 

I have a Height Param & Rule:

Works same as width, except with the 2 Height options

DoorHeightOptions [Text, Multi]: 8-0, 6-8

DoorHeight [Num]: (Varies)

Door HeightRule:

'Door Height
If DoorHeightOptions = "6-8" Then
		DoorHeight = 79.375
	End If

If DoorHeightOptions = "8-0" Then
		DoorHeight = 95.375
	End If

 

I have a Door Type Rule: Same rule for all other types as well,  not just '1K'

If DoorType = "1K" Then
		Component.IsActive("1K Skin: Back") = True
		Component.IsActive("1K Skin: Front") = True
		Component.IsActive("2K Skin: Back") = False
		Component.IsActive("2K Skin: Front") = False
		Component.IsActive("3F Skin: Back") = False
		Component.IsActive("3F Skin: Front") = False
		Component.IsActive("3F (3-6) Skin: Back") = False
		Component.IsActive("3F (3-6) Skin: Front") = False
		Component.IsActive("3S Skin: Back") = False
		Component.IsActive("3S Skin: Front") = False
		Component.IsActive("50 Skin: Back") = False
		Component.IsActive("50 Skin: Front") = False
	End If

 

------------------------

The doors are made of Skins (front and back of door), Stiles (sides of doors), and Rails (top and bottom of doors)

All Skin Models:

1K

2K

3F (Widths 2-6 to 3-0)

3F (Width 3-6)

3S

50

 

------------------------

 

Issue is.

 

When I run the 1K rule it works great cuz there's only one 1K model

But for the 3F there's two 3F models that are different sizes.

I need the 3F 3-6 model to be active only if I have the DoorType ="3F" AND the DoorWidthOptions = "3-6"

Then to suppress it if DoorWidthOptions = "3-0", "2-10", "2-8", or "2-6"

This is what I wrote and it doesn't work.

If DoorType = "3F" And DoorWidthOptions = ("2-6" or "2-8" or "2-10" or "3-0") Then
		Component.IsActive("1K Skin: Back") = False
		Component.IsActive("1K Skin: Front") = False
		Component.IsActive("2K Skin: Back") = False
		Component.IsActive("2K Skin: Front") = False
		Component.IsActive("3F Skin: Back") = True
		Component.IsActive("3F Skin: Front") = True
		Component.IsActive("3F (3-6) Skin: Back") = False
		Component.IsActive("3F (3-6) Skin: Front") = False
		Component.IsActive("3S Skin: Back") = False
		Component.IsActive("3S Skin: Front") = False
		Component.IsActive("50 Skin: Back") = False
		Component.IsActive("50 Skin: Front") = False
	End If

 

How do I write this to mean if DoorWidthoptions has one selected of a few options so I don't need to write it out for each option

 

3F and 3-0

3F and 2-10

3F and 2-8

3F and 2-6

 

How can it be 3F and (3-0, 2-10, 2-8, or 2-6)

0 Likes
448 Views
20 Replies
Replies (20)
Message 21 of 21

SMillsYS3X2
Advocate
Advocate

That would work with a setting up each set of Component.IsActive("XXXXX") = True or False lists individually. The reason I put all the Component.IsActive("XXXXX") = False at the top of the rule/code, was so all affected components had a default of False, then you just Component.IsActive("XXXXX") = True on each component you actually want to use. Otherwise, you could be activating different components each time the code is run as the values/inputs are changed. Also if/when components are added or removed from the assembly, you just have a couple of places in the code to update, instead of adding or removing from several sets in the same rule. Makes the code easier to maintain through design changes of the assembly.