The Global Archicad Community

Stay informed. Get help. Share your knowledge.

Topics specific to the scripting and development of Library Parts and Libraries using Param-O or the Geometric Description Language – GDL. (Example: How do you use “REQUEST” GDL commands?)

Moderators: Karl Ottenstein, LaszloNagy, ejrolon, Barry Kelly, Gordana Radonic, nbalogh, mnguyen, gkmethy, rmasaki, Akos Somorjai, Csilla Mai, Peter Baksa

#320830
runxel wrote: Thu Jan 07, 2021 3:58 pm Hey there, found another bug:
GLOB_WORLD_ORIGO_OFFSET_X (and _Y) always return 0 (zero).

Tested with AC 23 and 24.

Where are you using it?
It doesn't work in Parameter (Master) script.


Barry.
#320857
Hey Barry, I know. I'm using it in the 2D script.
There is even an example code in the reference manual:
Code: Select all
add2 -GLOB_WORLD_ORIGO_OFFSET_X-SYMB_POS_X, -GLOB_WORLD_ORIGO_OFFSET_X-SYMB_POS_Y
line2 -0.1, 0.0, 0.1, 0.0
LINE2 0.0, -0.1, 0.0, 0.1
hotspot2 0.0, 0.0, 1
text2 0, 0, "( 0.00 ; 0.00 )"
text2 0, 0.5, "World Origin"
del top

if abs(GLOB_WORLD_ORIGO_OFFSET_X) > 0.01 or\
    abs(GLOB_WORLD_ORIGO_OFFSET_Y) > 0.01 then
   ! THIS WILL NEVER BE EXECUTED
    add2 - SYMB_POS_X, - SYMB_POS_Y
    line2 -0.1, 0.0, 0.1, 0.0
    line2 0.0, -0.1, 0.0, 0.1
    hotspot2 0.0, 0.0, 2
    text2 0, 0, "(" + str(GLOB_WORLD_ORIGO_OFFSET_X, 9, 4) + "; " + str(GLOB_WORLD_ORIGO_OFFSET_Y, 9, 4) + " )"
    text2 0, 0.5, "Virtual Origin"
    del top
endif

if abs(GLOB_WORLD_ORIGO_OFFSET_X + SYMB_POS_X) > 0.01 or\
    abs(GLOB_WORLD_ORIGO_OFFSET_Y + SYMB_POS_Y) > 0.01 then
    line2 -0.1, 0.0, 0.1, 0.0
    line2 0.0, -0.1, 0.0, 0.1
    hotspot2 0.0, 0.0, 3
    text2 0, 0, "(" + str(GLOB_WORLD_ORIGO_OFFSET_X + SYMB_POS_X, 9, 4) + "; " + str(GLOB_WORLD_ORIGO_OFFSET_Y + SYMB_POS_Y, 9, 4) + " )"
    text2 0, 0.5, "Object Placement"
endif
#320930
I found that ....
Code: Select all
if abs(GLOB_WORLD_ORIGO_OFFSET_X) > 0.01 or\
    abs(GLOB_WORLD_ORIGO_OFFSET_Y) > 0.01 then
needs to be ...
Code: Select all
if abs(GLOB_WORLD_ORIGO_OFFSET_X) > 0.01 or abs(GLOB_WORLD_ORIGO_OFFSET_Y) > 0.01 then
All on one line and the "/" removed after the OR


Barry.
#320950
I couldn't reproduce that in AC24 build 3022.
This offset is only recalculated when a file is opened, so it might look it isn't working with a moved object.
First move the object far away from the origin, save the file, re-open it, and the extra hotspot will be visible.
#320964
Peter Baksa wrote: Mon Jan 11, 2021 9:15 am This offset is only recalculated when a file is opened, so it might look it isn't working with a moved object.
First move the object far away from the origin, save the file, re-open it, and the extra hotspot will be visible.
THAT was the missing piece of information... :)
Sorry for the confusion and thanks to Péter!

It becomes quite obvious when you think about it, but man, sometimes the easiest things are the hardest. :oops: