cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
GDL
About building parametric objects with GDL.
SOLVED!

Keeping paper size when changing scale

Durval
Enthusiast

 

I'm writing a 2D custom marker that shows the distances from the insertion point to the origin in plan.

Not really complicated, it basically uses SYMB_POS_X and SYMB_POS_Y to print the distances in plan.
It also uses GLOB_SCALE to convert elements (a few lines) from model to paper size.

Everything should be paper size in this object, and it is, except from the text position and its distance from the insertion point.

The user wants to change the text position (and the corresponding line that links the text with the insertion point), ie., they want to edit 'text_location_X' and 'text_location_Y' parameters.

I created editable hotspots so these parameters can be changed in plan view. For this to work properly, AFAIK, it has to be edited in model size.

So, I created two more parameters – 'text_location_XM' and 'text_location_YM' – that are the model sizes versions of text locations These parameters will be kept hidden in the dialog box of the object.

I have this in my Master Script:

IF (GLOB_MODPAR_NAME = "text_location_X") OR (GLOB_MODPAR_NAME = "text_location_Y") THEN
	text_location_XM = text_location_X*GLOB_SCALE/1000
	text_location_YM = text_location_Y*GLOB_SCALE/1000
ENDIF
IF (GLOB_MODPAR_NAME = "text_location_XM") OR (GLOB_MODPAR_NAME = "text_location_YM") THEN
	text_location_X = text_location_XM*1000/GLOB_SCALE
	text_location_Y = text_location_YM*1000/GLOB_SCALE
ENDIF

And this in my Parameter Script:

IF (GLOB_MODPAR_NAME = "text_location_X") OR (GLOB_MODPAR_NAME = "text_location_Y") THEN
	text_location_XM = text_location_X*GLOB_SCALE/1000
	text_location_YM = text_location_Y*GLOB_SCALE/1000
        PARAMETERS text_location_XM = text_location_XM, text_location_YM = text_location_YM
ENDIF
IF (GLOB_MODPAR_NAME = "text_location_XM") OR (GLOB_MODPAR_NAME = "text_location_YM") THEN
	text_location_X = text_location_XM*1000/GLOB_SCALE
	text_location_Y = text_location_YM*1000/GLOB_SCALE
        PARAMETERS text_location_X = text_location_X, text_location_Y = text_location_Y
ENDIF

Almost everything is working as expected. When changing the scale, all elements change accordingly, keeping their paper size.
Except form the text location and its corresponding connecting lines: when user changes plan scale, the scripts are keeping the model size parameters – 'text_location_XM' and 'text_location_YM' –, and recalculating the paper size parameters – 'text_location_X' and 'text_location_Y'.

I need the opposite behavior: the paper sizes should remain unchanged, as it happens to all other elements, and model sizes are recalculated.
If I didn't need these editable hotspots, I wouldn't need the model size parameters, and everything would behave as expected. But I could not find any proper way to edit the text location without having to resort to these extra parameters.

I am aware of the 'j11' attribute. From the GDL Reference Guide AC27 (pg. 203):
"attribute = 128*j8 + 256*j9 + 512*j10 + 1024*j11, where each j can be 0 or 1.

j8: hide hotspot (meaningful for types: 1,2,4,5),

j9: editable base hotspot (for types: 1,4),

j10: reverse the angle in 2D (for type 6),

j11: the value of paramReference is used as meters in paper space, the editable hotspot's distance from the base hotspot is scaled to view scale (for type 1).
I thought that adding '1024' to the base hotspot (type 1) flag would allow in some way to convert the value from paper space to model space, eliminating the need to create additional parameters.
But I couldn't figure it out. Tried almost every possible combination of multiplying/dividing by 1000 and GLOB_SCALE, but nothing put the hotspot in the correct position and doing the correct stretchings.
Any advice?

Maybe GLOB_FEEDBACK_MODE would help?

Please help.

 

--- www.dtabach.com.br ---

AC 27 BR – MacBook Pro Apple M2 16GB RAM Mac OS Sonoma
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
runxel
Hero

Hi @Durval, please see the solution in this thread. It's neither obvious nor intuitive, but it does work. 😄

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

2 REPLIES 2
Solution
runxel
Hero

Hi @Durval, please see the solution in this thread. It's neither obvious nor intuitive, but it does work. 😄

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»

You really deserve the ‘Hero’ badge.
I knew that two values were required, model size and paper size. But the truth is that we have to deal with 3 values, the previous ones plus the actual size on the scale of the drawing.
You've come up with a very ingenious solution. Congratulations and thank you.

--- www.dtabach.com.br ---

AC 27 BR – MacBook Pro Apple M2 16GB RAM Mac OS Sonoma

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!