<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Global Variable incorrect? in Libraries &amp; objects</title>
    <link>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211421#M18962</link>
    <description>alemanda,&lt;BR /&gt;
&lt;BR /&gt;
It's ok. Gergely's earlier post tells about the reasons behind the working you're experiencing.&lt;BR /&gt;
&lt;BR /&gt;
Regs,</description>
    <pubDate>Wed, 03 Nov 2010 22:58:19 GMT</pubDate>
    <dc:creator>ztaskai</dc:creator>
    <dc:date>2010-11-03T22:58:19Z</dc:date>
    <item>
      <title>Global Variable incorrect?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211413#M18954</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;&lt;R&gt;Hi folks,&lt;BR /&gt;
   bit of a random one here.&lt;BR /&gt;
&lt;BR /&gt;
I've adapted Daniel Lindahl's position marker object to create an object with the following code in 2D:&lt;BR /&gt;

&lt;PRE&gt;sz=sz/1000
GLOB_SCALE=A_
MUL2 A_,A_  

pX = (X~ + 0.0)
pY = (Y~ + 0.0)

PARAMETERS pX=pX, pY=pY

IF coord=ac1 THEN 
    pX = (pX + defx)
    pY = (pY + defy)
ENDIF

HOTSPOT2 0,0
PEN pen_colour
CIRCLE2 0,0, sz/2
LINE2 -sz,0,sz,0
LINE2 0,-sz,0,sz

!LINE2 0,0,pX,pY

DEFINE STYLE "pmx" font, tht, 7, 0
SET STYLE "pmx"
IF dimen=dim0 THEN
    TEXT2 sz,0, xtext + ": " + STR("%m",pX)
ELSE
    TEXT2 sz,0, xtext + ": " + STR("%.0mm",pX)
ENDIF

DEFINE STYLE "pmy" font, tht, 1, 0
SET STYLE "pmy"
IF dimen=dim0 THEN
    TEXT2 sz,0, ytext + ": " + STR("%m",pY)
ELSE
    TEXT2 sz,0, ytext + ": " + STR("%.0mm",pY)
ENDIF
&lt;/PRE&gt;

It seems to work fine - you place the object and it displays its coordinates in the scene. &lt;BR /&gt;
&lt;BR /&gt;
However, we had an issue yesterday where we placed the object in a file, had the correct reading, saved the file, closed ArchiCAD, opened it again, loaded the file, and the output displayed from the object was completely different (and wrong). It was completely random as well - not a scale issue as far as I can see.&lt;BR /&gt;
&lt;BR /&gt;
Any ideas? Is it likely to be the object, or something dodgy in the main ArchiCAD file doing strange things to global variables?&lt;BR /&gt;
&lt;BR /&gt;
We're completely stumped (and quite concerned, as we've been using this object a lot!)&lt;BR /&gt;
&lt;BR /&gt;
Any suggestions appreciated...&lt;BR /&gt;
&lt;BR /&gt;
Derek&lt;/R&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 30 Sep 2010 08:08:15 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211413#M18954</guid>
      <dc:creator>derekjackson</dc:creator>
      <dc:date>2010-09-30T08:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable incorrect?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211414#M18955</link>
      <description>At a glance I can't see anything wrong with the script although I can't see a need for the line ... GLOB_SCALE=A_&lt;BR /&gt;
&lt;BR /&gt;
Are you hotlinking your file by any chance?&lt;BR /&gt;
&lt;BR /&gt;
Barry.</description>
      <pubDate>Thu, 30 Sep 2010 09:26:54 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211414#M18955</guid>
      <dc:creator>Barry Kelly</dc:creator>
      <dc:date>2010-09-30T09:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable incorrect?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211415#M18956</link>
      <description>Right, I've made a much simpler version of the object, tried it in a new file (no hotlinks), and we still have the issue - thing is, seems to only be a problem once the object is placed over a certain distance from 0,0.&lt;BR /&gt;
&lt;BR /&gt;
Here's my code:
&lt;PRE&gt;pX = X~
pY = Y~

! Marker
HOTSPOT2 0,0
PEN 1
CIRCLE2 0,0, 0.05
LINE2 -0.1,0,0.1,0
LINE2 0,-0.1,0,0.1


DEFINE STYLE "txt" font, 3, 7, 0
SET STYLE "txt"

TEXT2 sz,0.5, "X: " + STR("%m",pX)
TEXT2 sz,0, "Y: " + STR("%m",pY)&lt;/PRE&gt;

When placed close the origin, it remembers it's position absolutely fine.&lt;BR /&gt;
&lt;BR /&gt;
If you try placing it a huge distance away (we tried X= 613,556,292mm, Y = 202,345,505mm), save the file, close and reopen, the output is completely wrong. If you then close and open it again, the number varies yet again.&lt;BR /&gt;
&lt;BR /&gt;
Any ideas? Could it be an upper limit on whatever number type the Global Position variables use? Is there a maximum limit on distance from project 0,0 to safely work? Looking through the forum suggests people have had issues - anyone know what the 'safe' limit is?&lt;BR /&gt;
&lt;BR /&gt;
This has completely stumped us - any help appreciated!&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
&lt;BR /&gt;
Derek</description>
      <pubDate>Thu, 30 Sep 2010 14:52:53 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211415#M18956</guid>
      <dc:creator>derekjackson</dc:creator>
      <dc:date>2010-09-30T14:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable incorrect?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211416#M18957</link>
      <description>Have you tried &lt;A href="http://www.selfgdl.de/9_diverse/globals/OBJECT/kompendium.php?glob=GLOB_WORLD_ORIGO_OFFSET_X" target="_blank"&gt;GLOB_WORLD_ORIGO_OFFSET_X&lt;/A&gt; and &lt;A href="http://www.selfgdl.de/9_diverse/globals/OBJECT/kompendium.php?glob=GLOB_WORLD_ORIGO_OFFSET_Y" target="_blank"&gt;GLOB_WORLD_ORIGO_OFFSET_Y&lt;/A&gt;?&lt;BR /&gt;
&lt;BR /&gt;
What happens, if you reload the library again?</description>
      <pubDate>Fri, 01 Oct 2010 06:28:29 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211416#M18957</guid>
      <dc:creator>Frank Beister</dc:creator>
      <dc:date>2010-10-01T06:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable incorrect?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211417#M18958</link>
      <description>To keep numeric precision at optimum, ArchiCAD may reallocate the inner &lt;I&gt;&lt;/I&gt;&lt;S&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/S&gt;calculation&lt;E&gt;&lt;/E&gt; origin which may move it away from the visible project origin. This is typically done when the whole model is far away from the project origin but this strategy can change over time. This was added in AC9 and this offset is recalculated when the project opens. That's why your SYMB_POS_X and SYMB_POS_Y global variables (X~ and Y~) changed after reopening your plan.&lt;BR /&gt;
&lt;BR /&gt;
You should use this for &lt;B&gt;px&lt;/B&gt; and &lt;B&gt;py&lt;/B&gt;:
&lt;PRE&gt;pX = SYMB_POS_X + GLOB_WORLD_ORIGO_OFFSET_X
pY = SYMB_POS_Y + GLOB_WORLD_ORIGO_OFFSET_Y&lt;/PRE&gt;

There is an example for this in GDL reference guide pdf, just after the list of global variables.&lt;BR /&gt;
&lt;BR /&gt;
HTH,&lt;BR /&gt;
__________________________________&lt;BR /&gt;
Gergely Fehér&lt;BR /&gt;
ArchiCAD Development - Library Team</description>
      <pubDate>Fri, 01 Oct 2010 07:31:22 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211417#M18958</guid>
      <dc:creator>Gergely Feher</dc:creator>
      <dc:date>2010-10-01T07:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable incorrect?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211418#M18959</link>
      <description>Cheers - that seems to have done it!&lt;BR /&gt;
&lt;BR /&gt;
So - is there a known point after which this variable comes in to play? I assume there's a realistic maximum distance from origin from which it's safe to work...&lt;BR /&gt;
&lt;BR /&gt;
The reason we're so far out is that we've aligned our survey data to actual world coordinates - the site is roughly 500km from '0,0' so that's where we've placed it. Unfortunately this seems to lead to issues with ArchiCAD's stability.&lt;BR /&gt;
&lt;BR /&gt;
What does everyone else do? Move every project to 0,0? What about when the project has to be at a fixed position away from 0,0?</description>
      <pubDate>Fri, 01 Oct 2010 13:12:38 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211418#M18959</guid>
      <dc:creator>derekjackson</dc:creator>
      <dc:date>2010-10-01T13:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable incorrect?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211419#M18960</link>
      <description>&lt;BLOCKQUOTE&gt;Move every project to 0,0?&lt;/BLOCKQUOTE&gt;

Absolutely: Yes. ArchiCAD has to handle too big numbers for too precise calculations.&lt;BR /&gt;
&lt;BR /&gt;
The effect does not aacure, if you place at least one element at 0/0, but I wouldn't do it.&lt;BR /&gt;
&lt;BR /&gt;
If you have to position coordinate points into your plan, I would modify a object to use two offset parameters.</description>
      <pubDate>Sat, 02 Oct 2010 03:17:37 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211419#M18960</guid>
      <dc:creator>Frank Beister</dc:creator>
      <dc:date>2010-10-02T03:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable incorrect?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211420#M18961</link>
      <description>I have the same problem but even using the GLOB_WORLD_ORIGO_OFFSET_X (&amp;amp; Y) I don't get any good result. In particular I get zero value for both the offset (but, of course, in the project there's an offset of the user origin from the fixed origin) ...&lt;BR /&gt;
any help?</description>
      <pubDate>Fri, 29 Oct 2010 09:59:57 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211420#M18961</guid>
      <dc:creator>alemanda</dc:creator>
      <dc:date>2010-10-29T09:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: Global Variable incorrect?</title>
      <link>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211421#M18962</link>
      <description>alemanda,&lt;BR /&gt;
&lt;BR /&gt;
It's ok. Gergely's earlier post tells about the reasons behind the working you're experiencing.&lt;BR /&gt;
&lt;BR /&gt;
Regs,</description>
      <pubDate>Wed, 03 Nov 2010 22:58:19 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Libraries-objects/Global-Variable-incorrect/m-p/211421#M18962</guid>
      <dc:creator>ztaskai</dc:creator>
      <dc:date>2010-11-03T22:58:19Z</dc:date>
    </item>
  </channel>
</rss>

