Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Date of placing object - problem

Anonymous
Not applicable
Hi,

I'm trying to create object which displays it's creation date as a text.

Creation date means moment when object is placing on 2d view. I'm trying different conditions which prevent changing date after first run, with no effect.

Can anyone tell me if is that ever possible?

Here is example of one of my attempts:
IF GLOB_VIEW_TYPE = 2 THEN			!do only in 2D 
		IF firstRun THEN				!parameter that allow to run code only once 
			ch = OPEN ("DateTime", "", "%Y/%m/%d, %H:%M%P") 
			n = INPUT (ch, "", "", date) 
			CLOSE (ch) 
			parameters firstRun = 0	!prevents running code again
			parameters date = date 
		ENDIF 
ENDIF 
2 REPLIES 2
Barry Kelly
Moderator
Firstly you need to set the default value of your 'firstRun' parameter to "1" or anything other than zero.
However I would change this to ...
IF GLOB_VIEW_TYPE = 2 THEN         !do only in 2D 
      IF firstRun = 0 THEN            !parameter that allow to run code only once 
         ch = OPEN ("DateTime", "", "%Y/%m/%d, %H:%M%P") 
         n = INPUT (ch, "", "", date) 
         CLOSE (ch) 
         parameters firstRun = 1   !prevents running code again 
         parameters date = date 
      ENDIF 
ENDIF 
Because the default value for 'firstRun' if not set will already be zero.



Having said that I am not sure if this is a bug or not.
GLOB_VIEW_TYPE = 2 does not work as the 'firstRun' parameter is set while you are in the library part editor and you can not change it.
Try and change it manually in the parameter list and you can't.
If you change it to GLOB_VIEW_TYPE = 3 (just as an experiment) you will find that you can change the parameter value.

You need a way to block the library part editor from running this part of the script.
Back in version 18 (and before) we could use 'IF GLOB_CONTEXT <> 1' but this is no longer available in 19/20.
And there is no equivalent command to detect that you are in the library part editor any more.

Barry.
One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Anonymous
Not applicable
Thanks for help Barry,

sadly I have tried before everything what you wrote and even more. It looks like there is no way to do this in AC19+ ;/