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

Learn to manage BIM workflows and create professional Archicad templates with the BIM Manager Program.

GDL
About building parametric objects with GDL.
SOLVED!

GDL: Hotspot Units

Lingwisyer
Guru

Hi all,

 

Is there a way to scale a parameter used by a dynamic hotspot? My parameters are in Layout units, so they are set to the View, and I would rather not need to make a set of intermediary parameters to convert it for graphical editing...

 

paramReference / GLOB_SCALE
HOTSPOT2 (marker_length) * GLOB_SCALE,	lsg_elevation,	lsg_uID,	marker_length / GLOB_SCALE,	2+1024	: lsg_uID = lsg_uID +1	!Left moving

 

 

Ling.

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
2 ACCEPTED SOLUTIONS

Accepted Solutions
Solution
runxel
Hero

Yes, there is a way: Add '1024' to the type bitmask. Then the parameter will be measured in paper space (not in model space).

Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»

View solution in original post

Solution

It would appear that the reference guide description is inaccurate. 1024 works.

 

Flag 1024: use paramReference value as meters in paper space.

This line in the reference guide should be rewritten as:

 

Flag 1024: scale paramReference value to View scale

 

Ling.

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

View solution in original post

12 REPLIES 12
DGSketcher
Legend

I think the units are tied to the project working unit. As you have suggested the only way round that is with intermediate parameters and using the "displayParam" option in the Hotspot settings. 

Apple iMac Intel i9 / macOS Sonoma / AC27UKI (most recent builds.. if they work)
Solution
runxel
Hero

Yes, there is a way: Add '1024' to the type bitmask. Then the parameter will be measured in paper space (not in model space).

Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»

Doesn't that just converts the input into meters, so scales the input by 1000. "Units" was probably the wrong word to be using... I am scaling to the Layout, so if the View is 1:50, I need to scale the input by 50, but if it's 1:20, I need to scale it by 20.

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

It would appear that the reference guide description is inaccurate. 1024 works.

 

Flag 1024: use paramReference value as meters in paper space.

This line in the reference guide should be rewritten as:

 

Flag 1024: scale paramReference value to View scale

 

Ling.

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
danielk
Enthusiast

Hi,
I am having a similar problem, but I am not sure this solution works for me (or I am just doing it wrong).

 

I have an object that I place into the model space, but it scales itself to paper size. I have 2 pieces (in practice a marker and a text box, but in the example below I just use a line and a box), that I need to be able to adjust compared to each other.

danielk_0-1740502104709.png

The line and the box are both paper size, so the X/Y distance between them also need to be paper size. All my parameters are floats/real numbers (because the length would be in model space units, and I just want them to be mm).

 

So, I have an X and a Y parameter, both real numbers in mm, that you can change on the UI, and it moves the box compared to the line. But I just cannot make it work with an editable hotspot. whatever I do, it just won't work...

danielk_1-1740502535231.png

 

 

PAPER_TO_MODEL = GLOB_SCALE / 1000
_x = x_paper * PAPER_TO_MODEL
_y = y_paper * PAPER_TO_MODEL

line2 0, 0, 0, 1

add2 _x, _y
rect2 0, 0, 1, 1
del 1

unID = 1
hotspot2 0, 0, unID: unID = unID + 1

hotspot2 0,		_y,	unID, x_paper, 1 + 128	: unID = unID + 1
hotspot2 _x,	_y,	unID, x_paper, 2		: unID = unID + 1
hotspot2 -1,	_y,	unID, x_paper, 3		: unID = unID + 1

hotspot2 _x,	0,	unID, y_paper, 1 + 128	: unID = unID + 1
hotspot2 _x,	_y,	unID, y_paper, 2		: unID = unID + 1
hotspot2 _x,	-1,	unID, y_paper, 3		: unID = unID + 1

 

 

What am I doing wrong?

Hey Daniel,

as far as I can tell this does never work if you do not "shadow" the parameters.

You will need to have the values in both real dimension and millimeters.

 

So, I call my millimeter one x_mm and my real dimension one xx.

Now I tie them together in the Master/Param script:

 

 

!// Master/Param script:
if GLOB_MODPAR_NAME = "xx" then 	parameters x_mm = xx*1000
if GLOB_MODPAR_NAME = "x_mm" then 	parameters xx = x_mm/1000

 

 

This gives me the possibility to do this in the 2D script:

 

 

!// 2D script 
line2 0, 0, 0, 1

_x = xx * GLOB_SCALE

add2 _x, 0
rect2 0, 0, 1, 1
del 1
 
unID = 1
hotspot2 0, 0, unID : unID=unID+1

hotspot2 0,		0,	unID, xx, 1+128+1024, x_mm	: unID=unID+1
hotspot2 _x,	0,	unID, xx, 2, x_mm			: unID=unID+1
hotspot2 -1,	0,	unID, xx, 3, x_mm			: unID=unID+1

 

 

 

So, why does this work?

x_mm will always hold the value in Millimeters. But we need to work with the real dimensions in GDL, so we cannot use that: We need the value in Meters, which is obviously mm times 1000. We sync both values so it does not matter what the user changes, the other value will always be correct.

The 1024 always only operates on the 'paramRef' (after the unID). Again, we can only use real dimensions (Meter) in GDL commands, so there is no chance to substitute it here with x_mm. Also there is no flag to reverse from mm to m, only the other way around.

You obviously want however the user to show the value in Millimeter and enable them to put in a value in mm as well. That's why we use the x_mm as the 'displayParam'.

And lastly because the '1024' only does its magic when the Hotspot is in use we need to manually go from "xx" to "_x" by multiplying it with GLOB_SCALE and putting it in as the position for the hotspot.

 

Not the easiest thing to wrap your head around, I agree! 🫨

 

Lucas Becker | AC 27 on Mac | Graphisoft Insider Panelist | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs | I Will Piledrive You If You Mention AI Again |

POSIWID – The Purpose Of a System Is What It Does /// «Furthermore, I consider that Carth... yearly releases must be destroyed»
Lingwisyer
Guru

Don't only Length parameters get interpreted as mm?

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

Length parameters are shown in whatever working unit you have Archicad set to.

In GDL they are always interpreted as meters.

If you use a real number or integer, they will be interpreted as meters.

 

I have never tried coding an object for 'imperial' units, so not sure how that works.

Length units will be in feet/inches, but the code I believe is still meters.

 

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

I was more wondering what the point in using a Real Number parameter together with a Display parameter instead of just using a Length parameter. I do not get this comment...

All my parameters are floats/real numbers (because the length would be in model space units, and I just want them to be mm)

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