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

Update Add-On

Martin Walter
Enthusiast

Is there a possibility to start an update process or an automatic update?

 

That means the add-on actually is installed to

c:\Program Files\GRAPHISOFT\Archicad 27\Add-Ons\MyAddOn\MyAddOn.apx

Pressing a button in the AddOn I like to start a process, that replaces the MyAddOn.apx and copies some files to the same folder. After that the Add On should be reloaded and work as before, but with a newer version of the MyAddOn.apx

 

Is this possible?

AC22-27, Windows 11, i7-1355U, 32GB RAM, 2TB SSD
4 REPLIES 4
kolioi
Booster

That's what I am doing right now : ) 

MudratDetector
Enthusiast

Because I have a few utilities that are event driven and that process is captured when anyone on the network starts ArchiCAD, a random 'copy' at a random time during the day will likely result in 'access denied' because that file is being used by another process (ArchiCAD).

 

How we handle this:

- - put updated .apx files ready for production environment in 'staging' folders (by AC version number) on the network

- - automatically reboot all machines on the network at midnight on Friday night/Saturday morning (which we were doing anyway)

- - at 1:00am on Saturday morning, a scheduled task runs a VB Script file that scans for .apx files in the 'staging' folders and copies anything found to the appropriate version of the production folders (on the network), after making an archive of the previous version.

 

This relies on nobody working in ArchiCAD in the middle fo the night on Friday night.  And so far, has been successful.

 

All the best - 

Chris

Chris Gilmer
Intel i9-12950HX CPU @ 2.30GHz, 16 cores
NVIDIA GeForce RTX 3080
48.0 GB RAM
Windows 10 Pro 64-bit

Hi Martin,

 

I would say it's not impossible but could be quite tricky. As Chris has already mentioned, it can be especially hard if your Add-On is kept in memory by Archicad for some reason (Event handlers etc.). If you have an Add-On that is automatically unloaded (no event handlers, palettes etc.) then it would be easier probably. Otherwise you have to do some unwinding there maybe. Also I'm not sure how far you can force Archicad to unload certain handlers and palettes. (I have problems unregistering the CatchNewElement handler for example).

With that said, I think the following procedure could work (but I've not tried it myself yet):

  1. Have your add-on start a separate process to do the updating
  2. Make sure the Add-On is unloaded after starting that process
  3. The process tries to update the .apx file until it's successful (or stops after some time if not possible).

Hope that helps,
Bernd

kolioi
Booster

Archicad updates are done manually - you have to check if there is new version of the app and/or the library (go to Help --> Check for Updates...). On the other hand Visual Studio does this automatically - you see a notification like this
VS_UpdateMsg.jpg

In both cases you have to close the app and then make the update.

More details on the update - later.