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

Moveable Hotspot Error

Anonymous
Not applicable
Hi everybody, Happy Holidays!!

We use a very basic marker for doors in plan. To create the most basic I saved Archicad11 door script as my own and made some changes. My utmost concern was keeping the text readable regardless of the SYMB_ROTANGLE and WALL_DIRECTION. Once I accomplished this I couldn't leave well enough alone!! In some situations we need to move the text to a different spot so I added the "Movable Hotspot". I've used this before and never had a problem. In the case of this door though I keep getting these "Duplicate unID" warnings. This object seems to work fine but I can't stand the fact that I'm getting these warnings. I've attached a screen shot of the warnings and the script I added is below. The text statements at the end of the script were used to figure out in which situations I needed to rotate the text to my liking. (by the way, I have a feeling that the script I wrote could be done more efficiently. If so please let me know). Any insight would be appreciated.

Doug

IF WALL_DIRECTION >90 AND WALL_DIRECTION<270 AND SYMB_ROTANGLE=0 THEN
ROT2 180
ADD2 0, WALL_THICKNESS
ENDIF
IF WALL_DIRECTION <90 AND SYMB_ROTANGLE=180 THEN
ROT2 180
ADD2 0, WALL_THICKNESS
ENDIF
IF WALL_DIRECTION>270 AND SYMB_ROTANGLE=180 THEN
ROT2 180
ADD2 0, WALL_THICKNESS
ENDIF
verti=verti + 2 1/2" - WALL_THICKNESS/2
unID=1
!_________________________moving it horizontally
hotspot2 0,verti,unID,horz,1+128 : unID=unID+1
hotspot2 -1,verti,unID,horz,3 : unID=unID+1
hotspot2 horz,verti,unID,horz,2+256 : unID=unID+1

!_________________________moving it vertically
hotspot2 horz,0,unID,verti,1+128 : unID=unID+1
hotspot2 horz,-1,unID,verti,3 : unID=unID+1
hotspot2 horz,verti,unID,verti,2+256 : unID=unID+1

define style 'covtext' arial,1.75,2,0
set style 'covtext'
text2 horz,verti,FPT
PEN 121
TEXT2 0,6",SYMB_ROTANGLE
PEN 126
TEXT2 0,16",STR("%0.16FFI",WALL_THICKNESS)
PEN 125
TEXT2 0,26",WALL_DIRECTION
END

Duplicate unID's.PNG
12 REPLIES 12
Anonymous
Not applicable
Try this

.... cut .....

verti=verti + 2 1/2" - WALL_THICKNESS/2

unID=12345 + unID ! ;@)
!_________________________moving it horizontally
hotspot2 0,verti,unID,horz,1+128 : unID=unID+1
hotspot2 -1,verti,unID,horz,3 : unID=unID+1
hotspot2 horz,verti,unID,horz,2+256 : unID=unID+1

.... cut ....
Anonymous
Not applicable
You know when I saw the wink and the 12345 I thought you were messing with me turns out it worked! So I'm assuming that the unID can be any number I choose as long as it doesn't match any other. (that would expain the term "Unique")I gotta be honest...I've used this movable hotspot more than once but I never claimed to fully understand how it works!
vistasp
Advisor
4thorns wrote:
I'm assuming that the unID can be any number I choose as long as it doesn't match any other.
Absolutely!
= v i s t a s p =
bT Square Peg
https://archicadstuff.blogspot.com
https://www.btsquarepeg.com
| AC 9-27 INT | Win11 | Ryzen 5700 | 32 GB | RTX 3050 |
Anonymous
Not applicable
unID = 12345 + unID



"12345" is a joke but
"+unID" is very important.
I'm assuming that the unID can be any number I choose as long as it doesn't match any other.
Correct, but, in your case you start with the same ID number, "1".
verti=verti + 2 1/2" - WALL_THICKNESS/2
unID=1
Archicad (not only your object) cannot have more than a hotspot "1".

Make it dynamic.
vistasp
Advisor
CU wrote:
Archicad (not only your object) cannot have more than a hotspot "1".

Make it dynamic.
CU Micro, I don't understand. What happens then if you insert the same object more than once?
= v i s t a s p =
bT Square Peg
https://archicadstuff.blogspot.com
https://www.btsquarepeg.com
| AC 9-27 INT | Win11 | Ryzen 5700 | 32 GB | RTX 3050 |
Anonymous
Not applicable
Hello Vistasp,
I just did the following experiment.
I created a new object and typed
the following code in the 2D script.

Pen 10

hotspot2 0,0,1

hotspot2 0,0,1

circle2 0,0,1"

I then checked script and got the error message
Duplicate unique IDs at line yada yada
But the 2D window processed with no run time errors.

So, apparently, this triggers a check script error but does not
prevent the 2D script from running.

Peter Devlin
Karl Ottenstein
Moderator
vistasp wrote:
CU wrote:
Archicad (not only your object) cannot have more than a hotspot "1".

Make it dynamic.
CU Micro, I don't understand. What happens then if you insert the same object more than once?
To clarify: the uniqueness of hotspot ID's is an issue only within a single placed object. There can only be one hotspot "1" in any particular object. But, all objects can have a hotspot "1".

However, when an object calls macros, those macros are in essence part of the same object... they are all interpreted in order to generated the representation of the object. So, all hotspots across all called macros must be unique.

It seems that in Doug's case, some other code - perhaps the door itself that called his marker (not really sure what he modified - the marker or the door) - already started numbering hotspots 1, 2, 3 ... so he needed to start someplace higher.

Putting UnID=UnID+12345 does not make sense, because UnID is not defined in the current object. It may work through AC 12 (undefined variables are interpreted as zero, so that statement is the same as UnID=12345) - but from another thread, we know that this behavior may not continue in the future.

Simply put UnID=500 (or whatever) to initialize your ID's someplace higher than those that GS used. (It would be nice if there was a document listing ranges of hotspot numbers used in GS macros and some standard saying that users were free to use those greater than X. But, just pick a number that works.)

Cheers,
Karl
One of the forum moderators
AC 28 USA and earlier   •   macOS Sequoia 15.2, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Karl Ottenstein
Moderator
Peter wrote:

I just did the following experiment.
I created a new object and typed
the following code in the 2D script.
Pen 10 
hotspot2 0,0,1 
hotspot2 0,0,1 
circle2 0,0,1" 

I then checked script and got the error message
Duplicate unique IDs at line yada yada
But the 2D window processed with no run time errors.
Hi Peter,

The reason you did not get an error when you displayed the 2D symbol is because your hotspot (HOTSPOT2 x, y, unID) does NOT create an editable hotspot in the user interface.

Thus, Checkscript warns you - but there will be no runtime errors.

To get a runtime error, you must create an editable hotspot by associating a parameter and flags with the extended syntax as in the examples earlier in the thread or here:
http://download.graphisoft.com/ftp/gdl/manual/12/wwhelp/wwhimpl/js/html/wwhelp.htm

Cheers,
Karl
One of the forum moderators
AC 28 USA and earlier   •   macOS Sequoia 15.2, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Anonymous
Not applicable
Hello Karl,
Doug wrote:
"though I keep getting these "Duplicate unID" warnings. This object seems to work fine"
He was scripting editable hotspots with their extended parameters to
create editable hotspots.
You wrote:
"To get a runtime error, you must create an editable hotspot by associating a parameter and flags with the extended syntax"

So, it seems that even though, you write an editable hotspot, that
contains a duplicate ID, it does not cause a runtime error and the
2D script runs without error.

I am a bit puzzled .
Thanks,
Peter Devlin