cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

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

Show minimum length of an object

Anonymous
Not applicable
Hi Guys,

I have an object that needs to be restricted to a minimum length. I used a statement in the 2D script(IF A < 2" THEN A = 2") that keeps the object in plan at 2" or more. The problem is that if you type anything less than that in the length box ("A" parameter), that dimension stays the same in the box even though the object itself stays at 2". I'd like the length parameter to revert to the minimum if anything less is typed in.

Thanks in advance,

Doug
9 REPLIES 9
TomWaltz
Participant
You need to put that limiting aspect in the Parameters script and use an accompanying "PARAMETERS" command.

Basically:

IF A < 2" THEN A = 2"
PARAMETERS A = A
Tom Waltz
Anonymous
Not applicable
Thanks Tom,

That's perfect. I've never (obviously) used the Parameters command. I tried a search and the help files but it's tough when you don't know exactly what you are looking for. It's quite humbling as a novice scripter to have you're big head deflated with something so simple!!

Thanks again,

Doug
TomWaltz
Participant
For two years, I basically just wrote objects for half my day. It's amazing the things you learn when you have to, but are completely unknown otherwise.
Tom Waltz
Anonymous
Not applicable
You can also accomplish the same thing with:

VALUES "A" RANGE [2", ]

It's good to get to know both the PARAMETERS and VALUES functions. There's lots of utility in them.

For example:

VALUES "A" RANGE [2", ] STEP 2", 2"

Does the above and limits A to 2" increments.

You can also stack up the arguments as in:

VALUES "A" RANGE [2", 12"] STEP 2", 2", RANGE [24", 48"] STEP 24", 3"

This will limit the values to 2" increments from 2" to 12" and 3" increments between 24" and 48" (and allow no other values).

Another useful form is:

VALUES "n" 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

It gives the user a pop-up list of predefined values to chose from.

The GDL Reference is rather cryptic on this (and other) topics but worth a look to at least get some hints about what these functions can do.
Karl Ottenstein
Moderator
Another plus of VALUES, as suggested by Matthew, is that you get an automatic tooltip like thingie so that the user doesn't wonder why the number they entered got changed to something else.

Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.9, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Anonymous
Not applicable
Another one:
A = min (2", A) ! Master Script
parameters A = A ! Parameter Script

The problem with range values ... Fore sure, they tell you the limits,
But in case of wrong value, they just return to the minimum value.

I find more intuitive to fix the limits myself.
A = min ( max (2", A), 10") ! Master Script
values "A" 2", 4", 6", 10", custom ! Parameter Script
parameters A = A ! Parameter Script

"A" automatically update within the limits, from min to max,
but locks on 2" for any value < 2", and locks on 10" for any value > 10"

That's split hairs, i agree. Whatever method you choose, it's important to use one, for safety.
Supose a typo error. About resolution, you type 3600 instead of 36 (fingers accident).
The object will start infinite loops. At the end, you have to force AC to quit. Too bad.
Anonymous
Not applicable
I forgot this one.

Range values don't work into arrays.
The parameters method allows a workaround.

!!! --------- Master Script
for k = 1 to nSeg-1
if bStepRot then
for j = 0 to resT
if j = 0 then
if rotE >= 0 and rotE < stepAng*0.5 then rotE = 0
else
if rotE >= stepAng*((j-1)+0.5) and rotE < stepAng*(j+0.5) then rotE = stepAng*j
endif
next j
endif
next k

!!!-------- Parameter Script
parameters rotE = rotE

In this situation, you can move an angle by increment, into an array.
Anonymous
Not applicable
Thanks Guys,

I understand the "Values" function (thanks again Matthew)but I have to say Oliver, you have officially gone over my head with your last post! I'll have to try to find the time to study it and figure it out.

Doug
Anonymous
Not applicable
4thorns, sorry, the formula can be simplified.

for k = 1 to nSeg-1
for j = 1 to resT
if rotE >= stepAng*((j-1)+0.5) and rotE < stepAng*(j+0.5) then rotE = stepAng*j
next j
next k

Joke aside, this thread just demonstrates AC flexibility.
GDL or not, threre are many ways to achieve what you want.

Cheers,

Olivier