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

2d picture/image with alpha channel

Anonymous
Not applicable
howdy

looking to do the following

i have 4 or 5 images (people/ animals)

i want to use them in elevations/ sections (2D only.... no need for 3D)

the images themselves will have alpha channels

how do i go about scripting an object that allows me to:
- have a parameter to scale the image
- allow the image to be the correct size at different scales
- turn the alpha channel on/off
- get the alpha channel image into the lib part (better to use external images that are called in... or embed them in fragments?)

HUGE thanks in advance

yukioMishima
3 REPLIES 3
Laszlo Nagy
Community Admin
Community Admin
I checked the GDL Manual. There is a PICTURE command for placing images in 3D, and there is a PICTURE2 command for placing pictures in 2D. You would probably need the PICTURE2 command.
However, it seems to me that alpha channel is very limited in the PICTURE2 command. It has a variation, the PICTURE2{2} command, which makes it posibble to use the alpha channel for transparency, but that is all.

If you have A and B as the two main parameters of the Object, then its width and height can be scripted to be set by these parameters and so you can distort it any way you like.

If you want it to be like 1 meter (1 meter is the project not on paper) at all scales, that will happen by default. If you want it to be something like 100 millimeters (always 100 millimeters on paper) at all scales, then you will have to use the GLOB_SCALE variable of GDL to resize it depending on the current scale.

The name of the external picture file has to be a parameter string-type. Check the Picture 11.gsm file so see how it is done. I don't knowright now if you can give a full path tho the file's location or it must be in the loaded libraries and you can just give the file name.
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac28
Anonymous
Not applicable
Hello,

1] Import the desired pics to the plan adjusting the size and transparency settings (see attachment)

2] Put the pics on top of each other near the origin

3] Select the pile of pics and "Save as object..." -> this includes the pics in the object binary, each of them has a different layer/index

4] Open the object to be edited and add two new parameters;
"pict_no" type= integer & "trans" type= checkbox

5] Add to 2D-code; picture2{2} pict_no, a, b, trans

That's it - the pict_no can be between 1 and the number of the
saved pics. The trans-parameter adjusts the white pixel transparency.


If you want to have the pict in the 3D too just add to 3D-code;

rotx 90 !<-----needed only for upright position
hotspot 0, 0, 0
hotspot a, 0, 0
hotspot a, b, 0
hotspot 0, b, 0
picture pict_no, a, b, trans
del 1 !<-----needed only for upright position


Hope this helps, I post one example object in the next post

--

Best Regards, Juha
Anonymous
Not applicable
Here's a picture object (version 10)


--
Regards, Juha