cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Begin your Archicad journey with our free learning path - perfect for newcomers and experienced users looking to strenghten their skills.

Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

Teamwork Issues when Updating Files in the Embedded Library

Hi!

I'm developing an Archicad Add-On for client of mine and we are facing a Teamwork issue for a long time. Unfortunately the Developer Support wasn't yet able to help us and it's been a while since we got an answer. Originally it only occurred in AC27 but in the meantime also in AC26 & AC28. 

The issues happen in Teamwork when updating (text-)files in the embedded library.

There seem to be two conflicting issues:

  1. We have to delete embedded .txt-files before overwriting them. Otherwise the files are reset to their previous state after closing and reopening the project. This issue happens both for Non-Teamwork and Teamwork files. As a workaround we started to first delete the embedded .txt-file and then copy the updated file into the embedded library.  This workaround works in both cases.

  2. Point 1 sometimes (not always) leads to Teamwork errors. ("Error in the last Teamwork Operation ....").


Here's some pseudocode of our current approach:

ReceiveChanges
ReloadLibraries

GetLockableStatus (ExistingLibItemRefGuid)
if (lockableExists) { ReserveLockable (ExistingLibItemRefGuid) }

DeleteEmbeddedLibItem // Seems necessary to properly update embedded lib items

CopyFileIntoLibrary   // (with overwrite=true but probably not relevant bc. we delete it anyway)

// ERROR happens in this following line
ReleaseLockable (NewLibItemRefGuid)

ReloadLibraries
SendChanges


We've tested several orders of operations of deleting/overwriting/copying/receiving/releasing/reserving/sending but haven't yet found any error-free approach. Does anybody have any tip or hint what I might be missing?
@Viktor Kovacs @Tibor Lorantfy @Akos Somorjai maybe you have some special insights into this?

Thanks in advance!
Bernd

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com
1 ACCEPTED SOLUTION

Accepted Solutions
Solution

The solution is to register the .txt file as a macro library part (ACAPI_LibPart_Register) after copying it into the library and before releasing the library item. Then it's no longer necessary to delete the file beforehand. So far this approach solved all teamwork issues we had and didn't lead to any others.

I also dropped the reload library commands as they were no longer necessary.

Huge thanks to @Viktor Kovacs for the hint!

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com

View solution in original post

1 REPLY 1
Solution

The solution is to register the .txt file as a macro library part (ACAPI_LibPart_Register) after copying it into the library and before releasing the library item. Then it's no longer necessary to delete the file beforehand. So far this approach solved all teamwork issues we had and didn't lead to any others.

I also dropped the reload library commands as they were no longer necessary.

Huge thanks to @Viktor Kovacs for the hint!

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com