cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:
2024 Technology Preview Program

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

GDL
About building parametric objects with GDL.
SOLVED!

# Moving multiplied element with hotspots

Hello everyone,

Being that I am still new at ways of GDL, I could use assistance.

I am trying to create simple cells that can be moved with hotspots. I understand the basic concept of how to make them move, but the question is how to make them move when they are multiplied. To be precise how to move them individually with different values.

For now, I made  Value 1 and 2 move, but the Value 3 is for me brain teaser.

In the following the  code:

``````hsid=1
RECT2 A,0, 0,B
RECT2 A-margin,margin, margin,B-margin

!Title cell

Fill hatch1
POLY2_b 5,7,hatch_pen1,hatch_pen_background1,

margin,B-margin,1,
A-margin,B-margin,1,
A-margin,B-margin-title,1,
margin,B-margin-title,1,
margin,B-margin,1

Y1=B-margin-title

!Subtitle INSTALATION block
POLY2_b 5,7,hatch_pen2,hatch_pen_background2,

margin,Y1,1,
A-margin,Y1,1,
A-margin,Y1-subtitle,1,
margin,Y1-subtitle,1,
margin,Y1,1

!=============== INSTALATION NETO VALUE ===============!
!======================================================!

Y2=Y1-subtitle
Y3=Y2-YC

FOR n=1 TO 3 STEP 1

!Total VALUE cell

Fill hatch3
POLY2_b 5,7,hatch_pen3,hatch_pen_background3,

margin,Y3,1,
A-margin,Y3,1,
A-margin,Y3-value,1,
margin,Y3-value,1,
margin,Y3,1

NEXT n
DEL 3

!HOTSPOT VALUE CELL

!========== VALUE 1 =========!
HOTSPOT2 margin,		Y2, 	hsid+1, YC, 1+128:	hsid=hsid+1		!base (hidden)
HOTSPOT2 margin,		1, 		hsid+1, YC, 3:		hsid=hsid+1		!referece
HOTSPOT2 margin,		Y3, 	hsid+1, YC, 2:		hsid=hsid+1		!moving

!========== VALUE 2 =========!
HOTSPOT2 margin,		Y3-value,		hsid+1, YC1, 1+128:	hsid=hsid+1			!base (hidden)
HOTSPOT2 margin,		1, 				hsid+1, YC1, 3:		hsid=hsid+1			!referece
HOTSPOT2 margin,		Y3-value-YC1,	hsid+1, YC1, 2:		hsid=hsid+1			!moving

!========== VALUE 3 =========!
HOTSPOT2 margin,		Y3-value-YC1-value, 			hsid+1, YC2, 1+128:hsid=hsid+1		!base (hidden)
HOTSPOT2 margin,		1, 								hsid+1, YC2, 3:	hsid=hsid+1			!referece
HOTSPOT2 margin,		Y3-value-YC1-value-YC2, 		hsid+1, YC2, 2:	hsid=hsid+1			!moving``````

Parameters:

Also, I would like to know is it possible to embeed schedule information in GDL object, in that sence that we can create  graphical more appealing area schedule?

Cheers,

Stefan Veselinović

Versions 13 to 25
CPU: AMD Ryzen 9 5900X 12-Core
RAM:32GB
GPU: RTX 2080Ti
Windows 11
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Graphisoft

Hi,

You can use ADD2 between different hotspots to make their base and value clearer. The reference hotspot should be in the other direction from base than moving.

GDL objects don't know about other GDL objects, scheduling is not possible.

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest
6 REPLIES 6

The hotspots are fairly simple, but as far as I know the only way to get any schedule data into a gdl object will be with python.  You can't even use properties in gdl yet.

Solution
Graphisoft

Hi,

You can use ADD2 between different hotspots to make their base and value clearer. The reference hotspot should be in the other direction from base than moving.

GDL objects don't know about other GDL objects, scheduling is not possible.

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

Hello,

Thank you Peter for the explanation.

In the meantime, I restructured the code so I could learn to use subroutines

I managed to accomplish most of the things that imagined, but I have difficulty to figure how to move a certain hotspot, so it deducts from the B value.

Picture of explanation what I am struggling with

Object code:

``````hsid=1
RECT2 A,0, 0,B
RECT2 A-margin,margin, margin,B-margin

HOTLINE2 0,0, 0,B
HOTLINE2 0,B, A,B
HOTLINE2 A,B, A,0
HOTLINE2 A,0, 0,0

HOTLINE2 margin,margin, margin,B-margin
HOTLINE2 margin,B-margin, A-margin,B-margin
HOTLINE2 A-margin,B-margin, A-margin,margin
HOTLINE2 A-margin,margin, margin,margin

HOTSPOT2 0,0

!========== GS A direction RIGHT CORNER =========!
HOTSPOT2 0,		0, 		hsid+1, A, 1+128:	hsid=hsid+1		!base (hidden)
HOTSPOT2 0,		-1, 	hsid+1, A, 3:		hsid=hsid+1		!referece
HOTSPOT2 A,		0, 		hsid+1, A, 2:		hsid=hsid+1		!moving

!========== GS B direction RIGHT CORNER =========!
HOTSPOT2 A,		0, 		hsid+1, B, 1+128:	hsid=hsid+1		!base (hidden)
HOTSPOT2 0,		0, 		hsid+1, B, 3:		hsid=hsid+1		!referece
HOTSPOT2 A,		B, 		hsid+1, B, 2:		hsid=hsid+1		!moving

!========== GS B direction LEFT CORNER =========!
HOTSPOT2 0,		0, 		hsid+1, B, 1+128:	hsid=hsid+1		!base (hidden)
HOTSPOT2 0,		0, 		hsid+1, B, 3:		hsid=hsid+1		!referece
HOTSPOT2 0,		B, 		hsid+1, B, 2:		hsid=hsid+1		!moving

!=============== TITLE CELL ==============================!
!======================================================!

Fill hatch1
POLY2_b 5,7,hatch_pen1,hatch_pen_background1,

margin,B-margin,1,
A-margin,B-margin,1,
A-margin,B-margin-title,1,
margin,B-margin-title,1,
margin,B-margin,1

!=============== BLOCK 1 ==============================!
!======================================================!
!HOTSPOT2 margin,margin+value+tvalue

GOSUB "SUBTITLE"
DEL 1

GOSUB "PARAMETARS"
DEL 1

GOSUB "VALUE"
DEL 1

GOSUB "SUBTITLE"
DEL 1

GOSUB "PARAMETARS"
DEL 1

!========== BLOCK 1 GS UPPER PART =========!
HOTSPOT2 margin,		0, 					hsid+1, block1, 1+128:	hsid=hsid+1		!base (hidden)
HOTSPOT2 margin,		1, 					hsid+1, block1, 3:		hsid=hsid+1		!referece
HOTSPOT2 margin,		-block1, 			hsid+1, block1, 2:		hsid=hsid+1		!moving
DEL 1

Y1=value+subtitle+CELLheight

!========== BLOCK 1 GS LOVWER PART =========!
HOTSPOT2 margin,		-Y1, 				hsid+1, block1, 1+128:	hsid=hsid+1		!base (hidden)
HOTSPOT2 margin,		1, 					hsid+1, block1, 3:		hsid=hsid+1		!referece
HOTSPOT2 margin,		-Y1-block1, 		hsid+1, block1, 2:		hsid=hsid+1		!moving
DEL 1

!=============== BLOCK 2 ==============================!
!======================================================!

GOSUB "VALUE"
DEL 1

GOSUB "SUBTITLE"
DEL 1

GOSUB "PARAMETARS"
DEL 1

!========== BLOCK 2 GS UPPER PART =========!

HOTSPOT2 margin,		0, 			hsid+1,		block2, 1+128:	hsid=hsid+1		!base (hidden)
HOTSPOT2 margin,		1, 			hsid+1, 	block2, 3:		hsid=hsid+1		!referece
HOTSPOT2 margin,		-block2, 	hsid+1, 	block2, 2:		hsid=hsid+1		!moving
DEL 1

!========== BLOCK 2 GS LOWER PART =========!

HOTSPOT2 margin,		-Y1, 		hsid+1,		block2, 1+128:	hsid=hsid+1		!base (hidden)
HOTSPOT2 margin,		1, 			hsid+1, 	block2, 3:		hsid=hsid+1		!referece
HOTSPOT2 margin,		-Y1-block2, hsid+1, 	block2, 2:		hsid=hsid+1		!moving
DEL 1

!=============== BLOCK 3 ==============================!
!======================================================!

GOSUB "VALUE"
DEL 1

GOSUB "TVALUE"
DEL 1

END

!========= SUBROUTINES ============
!=====================================================
"SUBTITLE":
!=====================================================
Fill hatch2
POLY2_b 5,7,hatch_pen2,hatch_pen_background2,

margin,subtitle,1,
A-margin,subtitle,1,
A-margin,0,1,
margin,0,1,
margin,subtitle,1

RETURN

!=====================================================
"VALUE":
!=====================================================
Fill hatch3
POLY2_b 5,7,hatch_pen3,hatch_pen_background3,

margin,value,1,
A-margin,value,1,
A-margin,0,1,
margin,0,1,
margin,value,1

HOTLINE2 margin,value, A-margin,value
HOTLINE2 margin,0, A-margin,0
RETURN

!=====================================================
"TVALUE":
!=====================================================
Fill hatch4
POLY2_b 5,7,hatch_pen4,hatch_pen_background4,

margin,0,1,
margin,tvalue,1,
A-margin,tvalue,1,
A-margin,0,1,
margin,0,1

RETURN

!!=====================================================
"PARAMETARS":
!!=====================================================

RECT2 0,0, CELLroom,CELLheight
HOTLINE2 0,0, CELLroom,0

RECT2 0,0, 	CELLwall,CELLheight
HOTLINE2 0,0, CELLwall,0
DEL 1

RECT2 0,0, 	CELLfloor,CELLheight
HOTLINE2 0,0, CELLfloor,0
DEL 1

RECT2 0,0, 	CELLceling,CELLheight
HOTLINE2 0,0, CELLceling,0
DEL 1

RECT2 0,0, 	CELLperimeter,CELLheight
HOTLINE2 0,0, CELLperimeter,0
DEL 1

RECT2 0,0, 	CELLarea,CELLheight
HOTLINE2 0,0, CELLarea,0
DEL 1

DEL 1
RETURN``````

I would appreciate the help.

Cheers

Versions 13 to 25
CPU: AMD Ryzen 9 5900X 12-Core
RAM:32GB
GPU: RTX 2080Ti
Windows 11
Graphisoft

It looks like it should change the overall length of the box too?

Then you have to synchronize B with the edited length in the parameter script using GLOB_MODPAR_NAME. When the user edits one of them, the other has to be re-calculated.

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

Thank you for the replay.

Yes overall length of the box would change.

Regarding your answer I must admit it is a bit abstract for me in the sense that I don't really know how to implement it technically at this point, being that I started on my GDL journey two weeks ago and that I don't have prior coding experience.

Could you give some concrete code structure that I could try, so that I could learn from the example?

Thank you for your patience.

Cheers

Versions 13 to 25
CPU: AMD Ryzen 9 5900X 12-Core
RAM:32GB
GPU: RTX 2080Ti
Windows 11
Graphisoft

Hi,

With GDL users can change only one parameter at a time (except transferring settings and setting array parameters, but that is a more advanced topic), after each change the scripts will be executed. When any parameter's change (either from UI or hotspot) should affect other parameters' values, these changes have to be calculated in the parameter script. Your script can decide what calculations need to be done based on GLOB_MODPAR_NAME global variable, which is filled with the last changed parameter's name (case-sensitive).

The linked article has an example under "Displaying custom parameters in tracker".

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest