cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
Ben Cohen
Advocate

Where to store a dynamically changing image ?

Hello All

 

I have a bit of a tricky one here.

I have created an add-on that creates a dynamicimage that my library parts UI loads.

So depending on the shape of the object, the image will change and reflect this shape.

It works really really well. 

The problem is where to keep the image.

  • I can keep it in my library folder, but as soon as another user puts the folder in a write-protected position in their file system, it will not work.
  • I can keep the image in the ArchiCAD data folder, but I don’t want to have to load the ArchiCAD data folder as a library (ACAPI_LibraryPart_Register() only works if saved in an already loaded library).
  • I can keep it in the embedded library - but this will not work for teamwork and is not working anyway.
  • I can’t place it as an asset in my add-on - because they are read-only.
  • I don’t want to write it to the pln file as custom data - that would be stupid yeah?.

 

Any suggestions would be greatly appreciated. 🙏

Ben Cohen
Mac and PC
Archicad (Latest Version) aus
www.4DLibrary.com.au
4 Replies 4
Tamas Polyak
Graphisoft
Graphisoft

Hi Ben,

 

I've created a support ticket from your question, I'll ask a couple of my colleagues to mull over the problem, and try to come up with ideas.

 

Regards,

Tamás

Ben Cohen
Advocate

Thanks Tamás.. appreciate it

Ben Cohen
Mac and PC
Archicad (Latest Version) aus
www.4DLibrary.com.au
Miha Nahtigal
Expert

Why is writing it to pln as custom data stupid?

I use in-memory sqlite that gets saved on demand into project data.

BIMquants.comBETA - Free Plugin for Quantities and Costs Estimation in Archicad.
Tamas Polyak
Graphisoft
Graphisoft

Hi Ben,

 

The developers came up with a couple of ideas:

 

A suggestion is that you should use the temporary folder: generate your images in a subfolder, add it temporarily as a library, and remove it on exit. In this case, the generated images will be lost (or maybe reused if that folder is used again and was not deleted between ArchiCAD sessions), but I suppose you do not need to keep them.

API_SpecFolderID specID = API_TemporaryFolderID;  
IO::Location tempFolder;  
ACAPI_ProjectSettings_GetSpecFolder (&specID, &tempFolder);  

 

A second idea would be the image section of your library parts.

RESULT_IF (selectedObject->GetGDLPictures ())
{
	modifier.SetGDLPictures (*result);
}

This is a special section in a library part; image(s) stored in it can be referenced by indices, and we typically use these to store small icons for the interface script (not dynamically so far). For syntax, see the picture_reference parameter of the UI_ commands. This would also require your library parts to be editable, but you can make sure they are if you copy them to the temporary folder already mentioned and use them from there (this is quite complicated because you have to unload the original first and add the temporary one). We use this method for custom component collections, where we need to add new lines to the scripts each time a new custom component is created.

 

Hope this helps!

Regards,

Tamás

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!