cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
GDL
About building parametric objects with GDL.
SOLVED!

iWindowClass and iWindowType

Lingwisyer
Guru

Hi all,

 

I have an object that you can load standard AC windows into with all of their associated settings. My current issue is that what settings are available depends on the variables iWindowClass and iWindowType which when change to or from any of the Multisash options (iWindowType 42 or 43, iWindowClass 8 ) breaks the object by making optypeIDArray[CasementID] in the GeneralWindowUnit macro return an invalid result... I tried setting iWindowClass automatically based on the iWindowType input, but it only returns 8 for some reason...

 

IF GLOB_MODPAR_NAME = "iWindowType" then
	IF iWindowType <= 9 then			iWindowClass = 1
	IF 10 <= iWindowType <= 15 then		iWindowClass = 2
	IF 23 <= iWindowType <= 25 then		iWindowClass = 3
	IF 26 <= iWindowType <= 28 then		iWindowClass = 4
	IF 16 <= iWindowType <= 17 then		iWindowClass = 5
	IF 29 <= iWindowType <= 39 then		iWindowClass = 6
	IF 45<= iWindowType <= 48 | 100 <= iWindowType <= 102 then	iWindowClass = 7
	IF 42 <= iWindowType <= 43 then		iWindowClass = 8
	IF iWindowType = 99 then			iWindowClass = 99

	PARAMETERS iWindowClass = iWindowClass
endIF

 

 

Ling.

 

VALUES{2} "iWindowType"	1,	"WIN_W1",
						2,	"WIN_WDoubleSash",
						3,	"WIN_W2",
						4,	"WIN_W2Sidelight",
						5,	"WIN_W3",
						6,	"WIN_W32Sidelights",
						7,	"WIN_W32Sidelights2",
						8,	"WIN_WVariable",
						9,	"WIN_WVariableDoubleSash",
						10,	"WIN_HistoricWindowSingle2",
						11,	"WIN_HistoricWindowSingle",
						12,	"WIN_HistoricWindowDouble",
						13,	"WIN_HistoricWindowTriple",
						14,	"WIN_HistoricWindowSegmented",
						15,	"WIN_HistoricWindowTripleArched",
						16,	"WIN_W2HorizontalSlide",
						17,	"WIN_W4HorizontalSlide",
						18,	"WIN_Curved",
						19,	"WIN_Bow",
						20,	"WIN_SplayBay",
						21,	"WIN_SquareBay",
						22,	"WIN_Ribbon",
						23,	"WIN_WSingleHung1",
						24,	"WIN_WSingleHung2",
						25,	"WIN_WSingleHung3",
						26,	"WIN_WDoubleHung1",
						27,	"WIN_WDoubleHung2",
						28,	"WIN_WDoubleHung3",
						29,	"WIN_WRound",
						30,	"WIN_WOval",
						31,	"WIN_WMultiside",
						32,	"WIN_WHalfRound",
						33,	"WIN_WQuarterRound",
						34,	"WIN_WPentagon",
						35,	"WIN_WTriangle",
						36,	"WIN_WEyebrows",
						37,	"WIN_WArched",
						38,	"WIN_WTrapezoid",
						39,	"WIN_WTrapezoidDoubleSash",
						40,	"WIN_VentWindow",
						41,	"WIN_2SashSliding",
						42,	"WIN_MultisashHorizontal",
						43,	"WIN_MultisashVertical",
						44,	"WIN_GlassBlock",
						45,	"WIN_TerraceDoorSWE",
						46,	"WIN_W3HorizontalSlide",
						47,	"WIN_W6HorizontalSlide",
						48,	"WIN_VentilationBrick",
						49,	"WIN_Rhomb",
						50,	"WIN_Skewed",
						99,	"WIN_Custom",
						100,"DOOR_NoSidelight",
						101,"DOOR_OneSidelight",
						102,"DOOR_TwoSidelight"

VALUES{2} "iWindowClass"	1,	"WINCLASS_NORMAL",
							2,	"WINCLASS_HISTORIC",
							3,	"WINCLASS_SINGLE_HUNG",
							4,	"WINCLASS_DOUBLE_HUNG",
							5,	"WINCLASS_HORIZONTAL_SLIDING",
							6,	"WINCLASS_SPECIAL",
							7,	"WINCLASS_DOORSASH",
							8,	"WINCLASS_MULTISASH",
							10,	"WINCLASS_SHELL",
							99,	"WINCLASS_CUSTOM"

 

AC22-28 AUS 3110Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win11 | R5 2600 | 16GB | GTX1660
1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Hi Ling,

 

I think your 'IF' conditions are not as you intend.

You'd need to format them like in this test:

iWindowType = 10

IF iWindowType <= 9 then			iWindowClass = 1
IF 10 <= iWindowType & iWindowType <= 15 then		iWindowClass = 2
IF 23 <= iWindowType & iWindowType <= 25 then		iWindowClass = 3
IF 26 <= iWindowType & iWindowType <= 28 then		iWindowClass = 4
IF 16 <= iWindowType & iWindowType <= 17 then		iWindowClass = 5
IF 29 <= iWindowType & iWindowType <= 39 then		iWindowClass = 6
IF (45<= iWindowType& iWindowType <= 48) | (100 <= iWindowType & iWindowType <= 102) then	iWindowClass = 7
IF 42 <= iWindowType & iWindowType <= 43 then		iWindowClass = 8
IF iWindowType = 99 then			iWindowClass = 99

text2 0, 0, str("%", iWindowClass)

 

Hope that helps,
Bernd

 

Edit: As a good exercise for the reader, you can figure out why the 'iWindowClass' was always '8' in the original question.

 

Explanation:

Spoiler

First let's look at the following code + comments:

x = 9

a = 10 <= x <= 13  ! for x=9 this results in '1.0'! but why?
text2 0, 0, "a: " + str("%", a)

b = 10 <= x ! for x=9 this is 'false' - so b = 0.0
text2 0, 1, "b: " + str("%", b)

c = b <= 13 ! if b=0.0 then this is 'true' - so c=1.0! But even if b=1.0, then c=1.0!!
text2 0, 2, "c: " + str("%", c)


Now looking back at the original post, we see that

42 <= iWindowType <= 43

will always return '1.0'! The other statements behave the same. (except the last statement with comparison to 99).
That's why the second to last check for iWindowType will always "win" and set iWindowClass=8. The only exception is for iWindowType=99.

 

 

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com

View solution in original post

4 REPLIES 4
Solution

Hi Ling,

 

I think your 'IF' conditions are not as you intend.

You'd need to format them like in this test:

iWindowType = 10

IF iWindowType <= 9 then			iWindowClass = 1
IF 10 <= iWindowType & iWindowType <= 15 then		iWindowClass = 2
IF 23 <= iWindowType & iWindowType <= 25 then		iWindowClass = 3
IF 26 <= iWindowType & iWindowType <= 28 then		iWindowClass = 4
IF 16 <= iWindowType & iWindowType <= 17 then		iWindowClass = 5
IF 29 <= iWindowType & iWindowType <= 39 then		iWindowClass = 6
IF (45<= iWindowType& iWindowType <= 48) | (100 <= iWindowType & iWindowType <= 102) then	iWindowClass = 7
IF 42 <= iWindowType & iWindowType <= 43 then		iWindowClass = 8
IF iWindowType = 99 then			iWindowClass = 99

text2 0, 0, str("%", iWindowClass)

 

Hope that helps,
Bernd

 

Edit: As a good exercise for the reader, you can figure out why the 'iWindowClass' was always '8' in the original question.

 

Explanation:

Spoiler

First let's look at the following code + comments:

x = 9

a = 10 <= x <= 13  ! for x=9 this results in '1.0'! but why?
text2 0, 0, "a: " + str("%", a)

b = 10 <= x ! for x=9 this is 'false' - so b = 0.0
text2 0, 1, "b: " + str("%", b)

c = b <= 13 ! if b=0.0 then this is 'true' - so c=1.0! But even if b=1.0, then c=1.0!!
text2 0, 2, "c: " + str("%", c)


Now looking back at the original post, we see that

42 <= iWindowType <= 43

will always return '1.0'! The other statements behave the same. (except the last statement with comparison to 99).
That's why the second to last check for iWindowType will always "win" and set iWindowClass=8. The only exception is for iWindowType=99.

 

 

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com
Lingwisyer
Guru

Interpreted as an OR... What is math... Did not even cross my mind...

AC22-28 AUS 3110Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win11 | R5 2600 | 16GB | GTX1660

I wouldn't say it's interpreted as an OR. It's more that operator precedence is left to right.

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com
Lingwisyer
Guru

Took a bit of messing about with it to get it. So it resolves the left true or false, then uses that result, a 1 or 0, for the following, hence mirroring the equation will always return a 0. That explains your c = b comment, was a bit confused that that.

AC22-28 AUS 3110Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win11 | R5 2600 | 16GB | GTX1660

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!