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

[Edit]Multiple GLOB_INTGUID's?

JaseBee
Advocate
So I'm getting this strange problem.

Im slowly piecing together a web of input/output commands to make my library smarter. To do this I often have to use the GLOB_INTGUID as a database key.

I have the code

 CkPlan		= REQUEST("NAME_OF_PLAN", "", sRqFileName)
ch1 = OPEN("Data", "ALTO_Database-File Names.txt",
"SEPARATOR = '\t', MODE=WA, DIALOG")
OUTPUT ch1, GLOB_INTGUID, 1, sRqFileName
CLOSE ch1


So when it runs it outputs to the text file. Labels work fine, but objects, on their first place instance they output twice, one of the outputs just seems to pluck a GUID from thin air, but if I go and delete all the entries from the text file and force a rebuild, then it only outputs once...

Thought it might be a 2d/3d script thing where the output command is running twice, but that shouldn't change the GUID which is used as the key.

I've no idea.
AC 24 5004 AUS
iMac OSX (10.13.6) 4.2ghz i7
8gb ram/8gb vram
7 REPLIES 7
JaseBee
Advocate
OK, Further to this, it's definitely nothing else I have going on in the code.

If someone would like to run a test...?

New library part with this code in the master script


ch1 = OPEN("DATA", "DataFile.txt", "SEPARATOR='\t', MODE=WA, DIALOG")

OUTPUT ch1, GLOB_INTGUID, 1, A

CLOSE ch1


And even with only that when you place the object it generates 2 entries in the text file...?

Is it something external to archicad? OS perhaps? Im on El capitan, which I have previously had issues with...

[EDIT]
Nope, same thing happens on my windows machine... 😕
AC 24 5004 AUS
iMac OSX (10.13.6) 4.2ghz i7
8gb ram/8gb vram
JaseBee
Advocate
Ok so I've tried the Application query for parameter scripts first run, that doesn't isolate it, Glob feedback mode doesn't isolate it, Glob Preview Mode doesn't help. Writing to a parameter and then using that doesn't help. HOME DB doesn't help...

I'm so stumped.

But while I was testing all these i noticed that deleting an object causes it to run through and output it's data... is there any way for it to know that this run-through of a script it prior to being deleted and able to remove itself from the data files?
AC 24 5004 AUS
iMac OSX (10.13.6) 4.2ghz i7
8gb ram/8gb vram
JaseBee
Advocate
Ok, I think I solved it, and in the process discovered a handy way to manage the data outputs and prevent redundant entries.

Turns out the answer does lie in the HOMEDB, sorta...

Consider the following code in the master script

iRqDBID = 0
sRqDBNumber = ""
sRqDBName = ""
iRqDBContext = 0
sGUID=GLOB_INTGUID
!IF GLOB_SCRIPT_TYPE <> 5 THEN
CkHomeDB = REQUEST("HOMEDB_INFO", "", iRqDBID, sRqDBNumber, sRqDBName, iRqDBContext)
!ENDIF
!IF GLOB_SCRIPT_TYPE <> 5 THEN
IF iRqDBContext > 0 THEN
ch1 = OPEN("DATA", "Data2File.txt", "SEPARATOR='\t', MODE=WA, DIALOG")
OUTPUT ch1, sGUID, 1, iRqDBID, sRqDBNumber, sRqDBName, iRqDBContext
CLOSE ch1
ELSE
ch1 = OPEN("DATA", "Data2File.txt", "SEPARATOR='\t', MODE=WA, DIALOG")
OUTPUT ch1, sGUID, -1, 0
CLOSE ch1
ENDIF
!ENDIF
PARAMETERS sGUID=sGUID

I've commented out the parameter script exclusion because that makes it not work for some reason. Even though the HOMEDB should not be used there.

But, it kinda works, only one instance gets written out, and then it deletes itself when the object is deleted.

However, when you add multiple objects it seems to get squiffy. Sometimes the duplicate entries show up as deleted records, sometimes the still just show up and the real records are deleted. Similarly if you delete multiple objects then only the first objects record will get expunged from the text file.

This is all really strange.
AC 24 5004 AUS
iMac OSX (10.13.6) 4.2ghz i7
8gb ram/8gb vram
JaseBee
Advocate
Well I can't solve it, nor can I leave it alone.

For anybody interested I've forwarded this onto Graphisoft for them to take a look as it seems to be something a bit deeper than the GDL coding level.

I'll post back here if/when they respond.
AC 24 5004 AUS
iMac OSX (10.13.6) 4.2ghz i7
8gb ram/8gb vram
JaseBee
Advocate
Well, the response I got was post your problem on the GDL centre website, the login pages aren't working for me there, and I've asked them to please have another go because I have no other ideas.

It would be nice to have confirmation that this issue is not just isolated to me, would someone be so kind to see if they can replicate it?

As it's been the holidays I've not pursued anything to do with this issue or archicad in general, so i might end up looking at it again in a week or two...
AC 24 5004 AUS
iMac OSX (10.13.6) 4.2ghz i7
8gb ram/8gb vram
Daniel Kovacs
Graphisoft Alumni
Graphisoft Alumni
Hello everyone,

We took a look into this, and found out what is happening exactly. Apparently at placement the object gets a GUID temporarily (to identify it, while it is not placed yet, but it is being placed), and then when it is placed, it gets another final GUID. We are looking into whether we can change this behaviour.

As a result, when this object is placed the script runs twice, and both GUIDs are written into the file. As a workaround for this, the best I could think of for now is to simply manually turn the writing of the txt on for the object after it was placed. Somehow like this:
if bSync then !bSync is a boolean parameter, that is off by default
	ch1 = OPEN("DATA", "RecordsFile.txt", "SEPARATOR='\t', MODE=WA, DIALOG") 
	OUTPUT ch1, GLOB_INTGUID, 1, A 
	CLOSE ch1 
endif
With this, you can place all the objects you want, and then select them all at once, and turn the switch on to write the TXT file (I tried, works perfectly like this). If you happen to find a better/automatic solution for only running this part of the script once the object is already placed, please share with us.

Also, the first empty line in the txt file is actually written by the default settings of the object. The script runs in that dialog as well, but since it doesn't have a GUID yet, it writes an empty line. The above solution solves this as well.

I hope you can go on with your projects with this. Good Luck!

Regards,
Daniel Alexander Kovacs

Professional Services Consultant

GRAPHISOFT



For Troubleshooting and useful Tips & Tricks visit
JaseBee
Advocate
Thanks for looking into that Daniel, and for proposing a solution.

I think that might be an acceptable solution, however I might go one step further and just make the bSync a variable in all the objects that can be controlled by some MVO trickery (maybe having an 'Update' MVO that could enable this write out). The reason for this would be people 'Alt Clicking' placed objects that have already had their sync enabled, and then placing new ones, essentially bypassing your workaround. In any case it's probably a little heavy handed for the less advanced users in the office, but I'll give it a go.

In an unrelated note, it seems the automatic notification of replies seems to have stopped with the site revamp, only just found your response to this now.

Thanks again Daniel.
Jase.
AC 24 5004 AUS
iMac OSX (10.13.6) 4.2ghz i7
8gb ram/8gb vram

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!