The Global Archicad Community

Stay informed. Get help. Share your knowledge.

Topics specific to the scripting and development of Library Parts and Libraries using Param-O or the Geometric Description Language – GDL. (Example: How do you use “REQUEST” GDL commands?)

Moderators: ejrolon, Barry Kelly, Karl Ottenstein, LaszloNagy, Gordana Radonic, nbalogh, gkmethy, mnguyen, rmasaki, Akos Somorjai, Peter Baksa, Csilla Mai

User avatar
By Durval
#328343
A long time ago I have scripted some simple lamp objects in which the basic light control are shown in the settings dialog box (attached image). The UI script of this object is blank; the controls show up by default, simply because it is classified as light subtype.

Now I'm trying to write a new lamp, similar to the old one, but these controls do not show up.

I know I could write an UI script, but the default behavior of the old object is fine enough to me and I'd rather not having to go through the UI scripting, as I would have to code all other parameters.

Is there a way to make the basic controls show up without writing an UI script?

Screen Shot 2021-06-15 at 19.33.07.png
Screen Shot 2021-06-15 at 19.33.07.png (700.22 KiB) Viewed 198 times
#328346
Durval wrote: Tue Jun 15, 2021 11:51 pm A long time ago I have scripted some simple lamp objects in which the basic light control are shown in the settings dialog box (attached image). The UI script of this object is blank; the controls show up by default, simply because it is classified as light subtype.

The UI script in your object may be blank, but is it CALLing a macro in the Master script.
If that macro has a UI script, that would cause the UI to show (I am pretty sure).


Barry.
#328349
There is no macro being CALLed in the other scripts.
It’s a simple object with a pair of REVOLVEs and a LIGHT command in the 3D script.
But there are some old parameters added by default, such as C, D, E, F and G for setting the light switch, RGB color and light intensity.
If I start a new light object, these parameters have different names such as ac_light_switch etc, and these names cannot be changed.
#328351
If you are happy with the look of the old object, open it and 'Save As' a new object and then just modify what needs to change.
This way you should have the interface the way you want and you just need to modify the 2D/3D scripts.

Barry.
#328352
I found I have some old lights that show the same as yours.
It is not a user interface as such but seems to be some sort of special parameters.

When I open the old object I see this.

light_1.jpg
light_1.jpg (135.58 KiB) Viewed 174 times

The 'Type' is a special symbol and not part of the standard set of types.

At the same time with the 'Light' subtype, it creates these new parameters with the same symbols - but it is not possible to change these 'Type' to anything else.

light_2.jpg
light_2.jpg (55.39 KiB) Viewed 174 times

So it seems these new parameters have replaced the old ones.

With a new lamp object, the new parameters are used in the user interface - called by a macro ("lightMacro_m").

I don't see any way of using the old parameters or the new ones without the user interface.
Other than doing a 'Save As' to the old object - that keeps the old features.


Barry.
#328389
Thank you for your help, Barry.
Strangely enough, my old lamp object has both sets of light parameters, the old ones AND the new ones...
Maybe I should start anew and simply CALL the lightMacro_m, so that my new object does not rely on deprecated features.
Screen Shot 2021-06-16 at 11.09.04.png
Screen Shot 2021-06-16 at 11.09.04.png (968.44 KiB) Viewed 155 times
#328393
Well, even by starting a new object and CALLing lightMacro_m I did not succeed on showing the light controls.
  • Created new object (attached) and classified as Light subtype;
  • Added a very simple 3D solid with an sphere;
The light controls do not show up. So I tried to paste de macro Call also in the Parameter Script. Received messages that some variables are not valid. Anyways, no light controls showing up in the light settings dialog box...
(3.17 KiB) Downloaded 1 time
#328406
When I open a 24 light object I see that the macro seems to get called a few times - parameter script, 3D script and Interface script.
I have a hard time following Graphisoft objects though!
It looks like that macro does more than just the simple settings in your object.

I think I would just 'Save As' your original object and edit that.
It will have the new parameters and I assume you just ignore them.

I have no idea how the old controls show up in the parameter list.
Delete C,D E F & G and that interface part in the parameter list disappears - but you can not re-create it, as you can't create the old parameters with the old types again.
And it doesn't work with the new 'gs_...'parameters.
So 'Save As' an old light seems to be the only way to keep them.

You can't delete the new parameters because they are part of the light sub-type, but you can hide them - although I am not sure if that is necessary.
The object (the interface part in the parameter list) still seems to be using the old parameters.


Barry.
#328596
Yes, Laszlo, thank you. So, unless you "save as" an old object, now a UI script is mandatory for light objects, not optional anymore, as it is for other object types. Plus you have to include all parameters in the UI script, not only those related to the light. I'll have to overcome my laziness for writing UIs...