We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

Images in Objects user interface.

Anonymous
Not applicable
I know I'm going to regret asking this, but I notice that in some object's user interface code (e.g. "Fronded_tree_ui_macro-10" - the UI for the tree objects), the image name is referred to by an index number. The numbers 50 & 51 in this example -
	if bBranches then
		ui_pict 51, x, y, 114, 180, 1		! ui_Fronded_tree2
	else
		ui_pict 50, x, y, 114, 180, 1		! ui_Fronded_tree1
	endif
If I wanted to use the same image in another object, how would I do it, as the image doesn't seem to be in the macro library?

Many thanks!
7 REPLIES 7
Karl Ottenstein
Moderator
Hi Peter,

I'd never noticed this. Manual says the index refers to an image embedded within the library part itself - not in the loaded lib.

I couldn't find a lib part in gsm format (production lib) that does this to look at - do you have the name of one?

The LibDevToolKit has some XML examples - where an XML tag refers to an external image and assigns it an index number. Apparently the XML converter then does the image embedding. Wonder if the gsm-to-XML converter can extract the image for you?

Here's the small bit of documentation I found:
The XML source of a library part may contain the following reference (you have to change the filename, mime type and the SubIdent fields) :

<GDLPict MIME="image/png" path="foldername/filename.png" SubIdent="3" platform="Win" SectVersion="19" SectionFlags="0">
</GDLPict>

You can create a reference to this image via the SubIdent (here it is 3) in the GDL script :

UI_INFIELD "parName", 0, 5, 302, 54,
1, 3, 5, 1, ! a "3"
56, 50, 40, 40,
1, "",
2, "",
3, "",
4, "",
5, ""
In one XML sample part, I found a bunch of <GDLPict> definitions, and corresponding UI_Pict uses, referring to the same index/SubIdent numbers.

Cheers,
Karl
One of the forum moderators
AC 28 USA and earlier   •   macOS Sonoma 14.7.1, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
David Maudlin
Rockstar
Karl wrote:
I couldn't find a lib part in gsm format (production lib) that does this to look at - do you have the name of one?
The Picture command has a similar description. The Picture 14 has an example, at line 174 is this code:
if gs_picture_custom = 0 then
	picture 1, a - 2*bIsFrame*gs_frame_width, zzyzx - 2*bIsFrame*gs_frame_width, 1
else
	if gs_picture_name <> "" then
		picture gs_picture_name, a - 2*bIsFrame*gs_frame_width, zzyzx - 2*bIsFrame*gs_frame_width, 1
	else
		picture 1, a - 2*bIsFrame*gs_frame_width, zzyzx - 2*bIsFrame*gs_frame_width, 1
	endif
endif
Which, if I understand it correctly, is calling for Image Index 1 when no custom image is called. This may give you an object to play with to try to sort out how it works.

HTH,

David
David Maudlin / Architect
www.davidmaudlin.com
Digital Architecture
AC27 USA • iMac 27" 4.0GHz Quad-core i7 OSX11 | 24 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14
There is a Urban house model in depository AFAIK that uses the embedded images (no separate images but the ui does have them inside)
Unfortunately it has locked scripts so will not be usefull as example.

Best Regards,
Piotr
Ralph Wessel
Mentor
Peter wrote:
If I wanted to use the same image in another object, how would I do it, as the image doesn't seem to be in the macro library?
As others have said, the image is imbedded in the object and cannot be used by other objects. I used imbedded images in the modular joinery object for some parts of the UI.

You can create embedded images by saving the image(s) from ArchiCAD as a GSM. This can be merged into other objects by converting the GSM to XML, pasting the image section into the recipient XML file, and converting back to GSM.
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
Many thanks for all the info, but I'm still not entirely sure what I need to do to be able to use the image elsewhere!

My reason for asking was that I was trying to recreate the 2d symbol part of the User Interface in another tree object that has no UI. The specific object I was looking at was the "Tree Deciduous 01 14" object, which itself calls the "Fronded_tree_ui_macro-10" macro.

I have successfully got the plan symbol to change correctly, it was just the image in the UI not displaying.

This is the specific section starting on line 238. The picture index is 57 and is meant to show the 40 different tree symbols.
if bSymbol then  
		ui_outfield `Symbol Type`, 240, 40, 140, rowy  
		ui_infield "type", 240, 60, 200, 200,  
			1, 57, 40, 8,				! Fronded_tree_symbol  
			88, 95, 80, 80,  
			1,	"",  
			2,	"",  
			3,	"",  
			4,	"",  
			5,	"",  
			6,	"",  
			7,	"",  
			8,	"",  
			9,	"",  
			10,	"",  
			11, "",  
			12,	"",  
			13,	"",  
			14,	"",  
			15,	"",  
			16,	"",  
			17,	"",  
			18,	"",  
			19,	"",  
			20,	"",  
			21,	"",  
			22,	"",  
			23,	"",  
			24,	"",  
			25,	"",  
			26,	"",  
			27,	"",  
			28,	"",  
			29,	"",  
			30,	"",  
			31,	"",  
			32,	"",  
			33,	"",  
			34,	"",  
			35,	"",  
			36,	"",  
			37,	"",  
			38,	"",  
			39,	"",  
			40,	""  
	endif  


Unfortunately, I have no knowledge of XML or GDL to XML conversion, so is it possible to actually extract the image back out again? I'd appreciate it if someone could do this for me, or would GS be interested in posting the original perhaps? I'd also be interested in knowing why was it embedded in the first place. It seems strange that some images are embedded, and some aren't even within the same object.

(@ Karl) There are several other images referred to by their index in this script as well, if you are looking for examples. I presume it is the same object in the US library?

Thanks for all the interest and help!
Jochen Suehlo
Moderator
I found the symbol from the AC 11 library als jpg; is this the same?

Fronded_tree_symbol_11.jpg

p.s. extracting with XML Converter is not possible (as fa as I know)
Jochen Suehlo . AC12-27 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de
Anonymous
Not applicable
Joachim wrote:
I found the symbol from the AC 11 library als jpg; is this the same?

Fronded_tree_symbol_11.jpg

p.s. extracting with XML Converter is not possible (as fa as I know)
Well done! That looks like the one.

Many thanks for taking the time to find it. I might get this object finished sometime before 2012 now!