Reply To: What is the proper replacement for GLOB_​​​CONTEXT=1?

Home Forums Problems and solutions in GDL Informations from the environment What is the proper replacement for GLOB_​CONTEXT=1? Reply To: What is the proper replacement for GLOB_​​CONTEXT=1?

#2601
Barry Kelly
Participant

This has just cropped up again in ArchicadTalk … http://archicad-talk.graphisoft.com/viewtopic.php?t=53078

I was having a bit of a play again and noticed if ‘GLOB_VIEW_TYPE = 2’ is used (in master or parameter script) then whatever script is run after that command will run while in the library part editor.
For example …
IF GLOB_VIEW_TYPE = 2 THEN !do only in 2D
IF firstRun = 0 THEN !parameter that allow to run code only once
parameters firstRun = 1 !prevents running code again
ENDIF
ENDIF

So if there is a boolean parameter in the parameter list called ‘firstRun’ then it is automatically set to ‘1’ and you can’t manually change it.

If you alter the script to … IF GLOB_VIEW_TYPE = 3
or any other value then it is not run and you can manually change the parameter.

Is this a bug that GLOB_VIEW_TYPE = 2 is ignored while in the library part editor? – seeing as technically it is not a 2D view and this part of the script should be ignored.
Just as it is ignored if GLOB_VIEW_TYPE = 3 (or any other value) is used.
Just finding it hard to see any logic here.

To test this I used this code in the master script.

IF GLOB_VIEW_TYPE = 2 THEN         !do only in 2D 
      IF firstRun = 0 THEN            !parameter that allow to run code only once 
         parameters firstRun = 1   !prevents running code again 
      ENDIF 

	!SET STYLE "switch"
	!!! ---------- show Selector hotspot----------
		HSID=HSID+1
		hotspot2 0, 0    , HSID, firstRun, 1    ! base
		HSID=HSID+1
		hotspot2 0,0-1    , HSID, firstRun, 3    ! ref
		HSID=HSID+1
		hotspot2 0, firstRun, HSID, firstRun, 2    ! moving
		HSID=HSID+1     
	
	TEXT2 0,0,firstRun 

ENDIF 

IF GLOB_VIEW_TYPE = 3 THEN         !do only in 2D 
      IF firstRun = 0 THEN            !parameter that allow to run code only once 
         parameters firstRun = 1   !prevents running code again 
      ENDIF 

	!SET STYLE "switch"
	!!! ---------- show Selector hotspot----------
		HSID=HSID+1
		hotspot 0, 0,0    , HSID, firstRun, 1    ! base
		HSID=HSID+1
		hotspot 0,0-1,0    , HSID, firstRun, 3    ! ref
		HSID=HSID+1
		hotspot 0, firstRun,0, HSID, firstRun, 2    ! moving
		HSID=HSID+1     
	
	DEFINE STYLE "text" "Arial", 150, 5, 0
	SET STYLE "text"
	TEXT 0.001,0,firstRun 
	
	ENDIF 

The hotspots in 2D and 3D views allow me to adjust the value.
So that is working fine.
However in the object settings dialogue the parameter can not be altered and it the script editor it can not be altered either unless I comment out the section for ‘GLOB_VIEW_TYPE = 2’

I hope I have explained this problem OK.

Barry.

Versions 6.5 to 22
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision M6800 - i7 4700MQ @ 2.40GHz, 16GB RAM, AMD FirePro M6100 (2GB), Windows 7 64bit