License delivery maintenance is planned for Saturday, July 26, between 12:00 and 20:00 CEST. During this time, you may experience outages or limited availability across our services, including BIMcloud SaaS, License Delivery, Graphisoft ID (for customer and company management), Graphisoft Store, and BIMx Web Viewer. More details…

GDL
About building parametric objects with GDL.
SOLVED!

Object resize by A or B parameter

MitchD
Booster

I have a very simple script for a 2D object that creates a box with minimum dimension 1m, and total area of 3m².

it functions fine except it only seems to accept changes to the A parameter, where ideally i want both A and B to be defined (mainly so you can adjust any hotspot)

the parameters section is as below.

IF A < 1.0 THEN A = 1.0
PARAMETERS A = A
IF B < 1.0 THEN B = 1.0
PARAMETERS B = B
PARAMETERS B = 3/A

 
i've even tried changing the code to this, but didn't affect anything.

IF a < 1.0 then a = 1.0
IF b < 1.0 then b = 1.0

if glob_modpar_name = "a" then
        b = a / 3
        parameters b = b
endif
if glob_modpar_name = "b" then
        a = b / 3
        parameters a = a
endif


is there a more suitable code to allow either parameters to resize the object?

ArchiCAD 28 /// Win 11 Pro - Ultra 7 155H - 32GB RAM - RTX 4060 8GB /// Win 11 Pro - i7 12700 - 64GB RAM - RTX 3070 Ti 8GB
1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Yes, you could do that as well seeing as the maximum size would be 3m.

 

Then it could be simply ...

VALUES "A" RANGE [1.0,3.0]
VALUES "B" RANGE [1.0,3.0]

if GLOB_MODPAR_NAME = "A" then
	B = 3.0/A
endif
if GLOB_MODPAR_NAME = "B" then
	A = 3.0/B
endif

PARAMETERS A = A, B = B

 

You could also create a parameter for the area, if you want an adjustable maximum area.

Then just place that parameter everywhere you see 3.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

View solution in original post

5 REPLIES 5
BrunoH
Expert

Hi,

 

Try this,

 

if glob_modpar_name = "A" then
if A < 1.0 then A = 1.0
if A > 3.0 then A = 3.0 ! Area should be 3m2 so A should be < 3

B = 3.0 / A ! Calculate value of B

goto 1:
endif

if glob_modpar_name = "B" then
if B < 1.0 then B = 1.0
if B > 3.0 then B = 3.0! Area should be 3m2 so B should be < 3

A = 3.0 / B ! Calculate value of A
endif

1:
parameters A = A , B = B ! Set the values of A and B
ArchiCad 3.43 to 28
MacOS Monterey
Barry Kelly
Moderator

Try this.

 

VALUES "A" RANGE [1.0,]
VALUES "B" RANGE [1.0,]

if GLOB_MODPAR_NAME = "A" then
	B = 3.0/A
	if B < 1.0 then
		B = 1.0
		A = 3.0
	endif
endif
if GLOB_MODPAR_NAME = "B" then
	A = 3.0/B
	if A < 1.0 then
		A = 1.0
		B = 3.0
	endif
endif

PARAMETERS A = A, B = B

 

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

Cap the ranges to 3 given the set area with min dimension.

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
Solution

Yes, you could do that as well seeing as the maximum size would be 3m.

 

Then it could be simply ...

VALUES "A" RANGE [1.0,3.0]
VALUES "B" RANGE [1.0,3.0]

if GLOB_MODPAR_NAME = "A" then
	B = 3.0/A
endif
if GLOB_MODPAR_NAME = "B" then
	A = 3.0/B
endif

PARAMETERS A = A, B = B

 

You could also create a parameter for the area, if you want an adjustable maximum area.

Then just place that parameter everywhere you see 3.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
MitchD
Booster

Fantastic! thank you both very much.

The range with extra parameters for set area and minimum dimension would resolve a couple of objects for me.

ArchiCAD 28 /// Win 11 Pro - Ultra 7 155H - 32GB RAM - RTX 4060 8GB /// Win 11 Pro - i7 12700 - 64GB RAM - RTX 3070 Ti 8GB