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.

Can a parameter change itself?

Anonymous
Not applicable
Hi all.
I swear I've done this before but am losing my mind trying to get it to work.
This is an example of my code in the parameter script;

IF LN = "Arm @" THEN LN = "Doug"
PARAMETERS LN = LN

The parameter LN is set in a list of values above the code.

I have this in a different object and it works fine;

IF A < 2" THEN A = 2"
PARAMETERS A = A

Any thoughts?
Thanks, Doug
6 REPLIES 6
Barry Kelly
Moderator
Is "Doug" in the VALUE list of available parameters?
If not you are trying to set it to something that it can not be.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Anonymous
Not applicable
Thanks Barry. Though I thought I'd been in this situation before, your solution didn't ring a bell. After modifying the code though your explanation made perfect sense. I added a "Dummy" parameter that the LN parameter reads from. (The LN parameter is required for scheduling). The code below works fine except that I would like to add the section in red. PII (Pitch in inches) is a real number parameter that is predefined. I'd like to end up with...Arm @ 10/12. I can probably figure it out but it's gonna have to wait till tomorrow! I appreciate the help. Doug

VALUES "FLN" 'Arm', 'Arm @'

PARAMETERS LN = FLN

IF FLN = "Arm @" THEN
PARAMETERS LN ="Arm @ " + PII + "/12"
ENDIF
Barry Kelly
Moderator
You will need to use the STR function to convert your number into a string value.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Anonymous
Not applicable
Thanks again for the help last night Barry. I wound up getting it to work before I called it a night. I've used the str function in the past but just needed to refresh my memory. This is what I came up with:

PARAMETERS LN = FLN
PARAMETERS PII = 12*(TAN(P))


IF FLN = "Arm @" THEN
PARAMETERS LN = "Arm @"+STR(PII,3,2)+"/12"
ENDIF

Something I couldn't find though is a way to suppress zeros after the decimal point. (eg. 10 instead of 10.00) Can you save me some research time and tell me if it's possible?

Thanks again, Doug
Barry Kelly
Moderator
That would be the '2' in your STR function.

STR(PII,3,2)

That is the length of the number after the decimal point.

STR(PII,3,0) ... should be what you are after.

The '3' if the minimum number of characters in the string.
It will automatically increase them if you have a larger number and will pad with spaces if you have a smaller number.

So you could actually try ... STR(PII,1,0)

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Anonymous
Not applicable
Hi Barry. I think I mislead you with my example into thinking I wanted to eliminate everything after the decimal point. Actually I just wanted to "supress" all trailing zeros and have a maximum of two places after the point. I dug into the GDL reference guide, found the str function and with some trial and error came up with this;

STR("%~.2",PII)+"/12"

The "tide" symbol ~ (I had to look up the name and it's very fitting) suppresses the trailing zeros and the 2 is the max number of places after the decimal point.

Thanks again for the assist.
Doug