We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Incorrect vallues calculated for parameter list

Anonymous
Not applicable
I am working on developing a typical stair. I am trying to get some base calculations done, and the part is returning incorrect values to the parameter list the first time it is run. The second time the object is run, it will update to the correct values. I am banging my head trying to figure out what is wrong, and hoping a fresh set of eyes can see it. I am attaching the stair, but the code is here as well. All the calculation is in the Parameter script, so I don't think there is any execution order problems.

VALUES "ZZYZX" 128", 168", 176", 192"

IF ZZYZX < 192" THEN
	IF ZZYZX < 176" THEN
		IF ZZYZX < 168" THEN
			PARAMETERS riserQuantity = 20
			PARAMETERS riserHeight=ZZYZX/riserQuantity
			LOCK "riserHeight"
		ELSE
			PARAMETERS riserQuantity = 24
			PARAMETERS riserHeight=ZZYZX/riserQuantity
			LOCK "riserHeight"
		ENDIF
	ELSE
		PARAMETERS riserQuantity = 26
		PARAMETERS riserHeight=ZZYZX/riserQuantity
		LOCK "riserHeight"
	ENDIF
ELSE
	PARAMETERS riserQuantity = 28
	PARAMETERS riserHeight=(ZZYZX/riserQuantity)
	LOCK "riserHeight"
ENDIF

!PARAMETERS stringerAngle = ATN(riserHeight/treadDepth)  !!Doesn't calculate correct angle
PARAMETERS stringerAngle = ATN((ZZYZX/riserQuantity)/treadDepth) !!Calculates correct angle
LOCK "stringerAngle"

PARAMETERS stringerAngleTan = TAN(stringerAngle)
4 REPLIES 4
Anonymous
Not applicable
And a screen shot showing the value displayed in the parameter list and a the same value Using a PRINT command. I would be fine is the parameter values was incorrect, but the part is using the incorrect value elsewhere making geometry incorrect the first time the object is generated.
incorrect value.jpg
Anonymous
Not applicable
Still not sure why this is happening, but if I remover the riserQuantity variable from the riser height calculation and use the actual value, the angle is calculating properly.
Anonymous
Not applicable
Hello,

I think you should declare the values first,
using the parameters command only
sets the user values and runs occasionally.
...
      IF ZZYZX < 168" THEN
         PARAMETERS riserQuantity = 20
         PARAMETERS riserHeight=ZZYZX/riserQuantity
         LOCK "riserHeight"
      ELSE
         PARAMETERS riserQuantity = 24
...



For example;

...
riserQuantity = 20 
riserHeight=ZZYZX/riserQuantity
PARAMETERS riserQuantity = riserQuantity, riserHeight = riserHeight
...
Hope this works / helps.

Regards, Juha
Anonymous
Not applicable
Thanks for the tip, but unfortunately it isn't helping. I think my issue has something to do with the Circular functions. I have added in a parameter (stringerAngle2) that takes the TAN of stringerAngle and calculates the arc tangent. This should give me the original angle, but it is off, and not just a small fraction off. It is the angle from the previous run of the scripts. Something isn't updating properly.