BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

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

Object to lamp

Anonymous
Not applicable
If I have a regular object I made or downloaded, how can I save it as a lamp object?
10 REPLIES 10
Karl Ottenstein
Moderator
Wrathchild wrote:
If I have a regular object I made or downloaded, how can I save it as a lamp object?
Open the object and change its subtype to "Light" (US library) as seen in the attached screenshot.

Then...
Change Subtype.png
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.6, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Karl Ottenstein
Moderator
That makes a couple of things happen. One, the being now of the Lamp subtype, the object will be placed with the Lamp tool and not the generic Object tool. Two, additional lighting related parameters are added as seen in the attached screenshot - to turn the lamp on/off, change its color and intensity.

Note that these new parameters will not do anything though unless you modify the GDL code to include a lamp to emit light, tied to those parameters.

In the screenshot, I've turned a bean-bag chair into a lamp object, but it is still just a bean-bag chair.

Easiest thing for the GDL code is to just copy a snippet from an existing lamp object in the library. Getting the lamp aimed in the right direction could be the most challenging part.

Cheers,
Karl
Now a Lamp.png
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.6, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Anonymous
Not applicable
Thanks Karl. That's what I thought I should do to do but wasn't sure a light was a lamp in that dialog. Even if I had gone ahead and done it I wouldn't have known I needed to do the GDL part.
Anonymous
Not applicable
I got all that working pretty good but when I choose a color for the light the only palette I get is the one w/ the crayons. What should I do to fix it to get all the palettes?
Anonymous
Not applicable
Never mind. I got it.
Anonymous
Not applicable
Got another problem.

The light sphere is located at the bottom of my light fixture. I would like it to be in the middle.

I copied the script from a general light which has a parameter of slc for the showing the light sphere.

Do one of these numbers control where the light sphere is located?

If slc Then
For i=1 To 4
hotspot 0,0,0,unID,dist1,1+128 : unID=unID+1
hotspot 0,-1,0,unID,dist1,3 : unID=unID+1
hotspot 0,dist1,0,unID,dist1,2 : unID=unID+1

hotspot 0,0,0,unID,dist2,1+128 : unID=unID+1
hotspot 0,-1,0,unID,dist2,3 : unID=unID+1
hotspot 0,dist2,0,unID,dist2,2 : unID=unID+1
rotz 90
David Maudlin
Virtuoso
Wrathchild:

The code you posted is for some editable (movable) hotspots, which might be used for allowing the user to move the light in the model, controlling the parameters dist1 and dist2. The light would need to be transformed (moved) by these same parameters in the 3D Script, or the light could be moved without them if you don't need this feature. In short, the light needs to be transformed (moved) within the 3D Script, usually with the ADD transformation, like any other part of the 3D model. Also, you have shown only part of this subroutine, as the FOR needs a NEXT to complete the loop, so there may be other things going on in this part of the script.

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
Anonymous
Not applicable
David,

Here is the object. I found a line in the master script: j=slc

I thought that might be what I needed to work on with ADD and tried a couple things but nothing happened.

Would you mind taking a look and letting me know if this is indeed what I should be looking at and where to put the ADD.

Any help would be much appreciated as I'm still not very fluent with GDL and pretty much just muddle along.

Rick
David Maudlin
Virtuoso
Rick:

[For those who have not looked at his object, it is a .3ds file converted to a .gsm file. The 3D Script with the lantern part is about 2600 lines of code, in addition to the lamp code Rick added, which is about 100 lines of code.]

You should treat the code you added as one block or subroutine, add a transformation at the beginning of the code to move the lamp to the desired location within the lantern, then delete that transformation at the end of that code before the lantern code. This is similar to selecting one element within your model and moving it relative to the other parts.

So on this case, the start of the code should be:
…If C And G Then

AddZ zzyzx*.5 ! move light vertically 1/2 the height of the object

DIM colorRGB[3]
colorRGB[1] = D
colorRGB[2] = E
colorRGB[3] = F…

AddZ moves the local origin in the vertical direction, zzyzx is the height of the object (you can see this parameter in the library part main window), multiplying this by .5 moves the local origin 1/2 the height of the object.

And the end of the lamp code should be:

…sphere dist2
model solid
EndIf

Del 1 ! delete transformation

MUL A/0.2048950, B/0.2048979, zzyzx/0.7640000…

The Del removes the last transformation, in this case your AddZ command, so the local origin is returned to its original location for the rest of the lantern code from the .3ds file.

As for the sic and other parameters, you can look at the main library part window under the Variable column, and read their description in the Name column so you know what they do. In this case the sic parameter is for controlling the Show Light Sphere parameter under the Light Settings sub parameter list. This should help you understand what parts of the 3D (and other) Script is for in altering the object.

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
Learn and get certified!