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

2D Symbol Insertion Point using GDL scripting

Anonymous
Not applicable
Hi everyone,

I'm fairly new to GDL and scripting in Archicad all together but I'm in urgent need of creating this specific type of door for my project. This door began as a Revit door which I was able to import using the Import RFA as GDL plugin. I was able to tidy up the door and I'm fairly happy with it but I also wanted to add an extra feature in the door's settings to be able to switch between the door's level of detail of its 2D symbol in plan view.

Revit has the ability to show coarse, medium and fine views of its elements. If you look at what I'm trying to do, I've added some scripting where I can choose between 3 levels of details. I then exported the door's 2d symbol from Revit for all 3 settings, saved each as an object in Archicad and was able to copy the 2D code that defines each symbol.

My issue is now how do I make each symbol insert and snap to the overall door's width and thickness? If you look at my screenshots, the symbols just float because the code is currently picking a random x and y insertion points. Can anyone help me, please?

Thanks
19 REPLIES 19
Barry Kelly
Moderator
Lingwisyer wrote:
You want your second value in the MUL command to be 1, not 0.
My mistake.
I have amended the original post.

I am always doing that.
Don't need it - make it zero, but in this case it must be 1 to keep the scale as it is.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Anonymous
Not applicable
Thanks for the replies everyone I think we are nearly there. We now have no errors in the code but there seems to be an issue with the scipt. The code now has resized the 2D view to a very small scale and it does not change at all when you change the width of the window. Have I missed out on anything in the code?

I've attached some images to show what I mean. The 2D symbol remains the same size even after I've resized the window to 3000mm or 4000mm.

Below is the code I have thus far.
A = -0.09045
B = 19.90796

IF LOD = "Coarse" THEN
!
!   Name     : New Object 1.gsm
!   Date     : Wednesday, 11 September 2019
!   Version  : 22.00
!   Written by ARCHICAD 
!

add2     A,B
MUL2 A3.0, 1
line_property       0
line2    1.540449512792, -20.08295636262, 1.535449512792, -20.08295636262
line2    1.495651223507, -20.08295636262, 0.1612478020773, -20.08295636262
line2    0.1214495127919, -20.08295636262, 0.1164495127919, -20.08295636262
line2    0.06444951279192, -20.08295636262, -1.359550487208, -20.08295636262
line2    -1.409550487208, -20.08295636262, -1.359550487208, -20.08295636262
line2    -1.359550487208, -20.08295636262, -1.359550487208, -20.05422889551
line2    -1.359550487208, -20.05422889551, -1.390350487208, -20.05422889551
line2    -1.390350487208, -20.05422889551, -1.390350487208, -20.01008382972
line2    -1.390350487208, -20.01008382972, -1.359550487208, -20.01008382972
line2    -1.359550487208, -20.01008382972, -1.359550487208, -19.98135636262
line2    -1.359550487208, -19.98135636262, -1.409550487208, -19.98135636262
line2    -1.409550487208, -19.98135636262, -1.409550487208, -20.08295636262
line2    1.501550899651, -20.01785659294, 1.530551204182, -20.01785659294
line2    1.530551204182, -20.01785659294, 1.530444444816, -20.05273660423
line2    1.530444444816, -20.05273660423, 1.540449512792, -20.05273660423
line2    1.540449512792, -20.05273660423, 1.540449512792, -20.08295636262
line2    1.540449512792, -20.08295636262, 1.590449512792, -20.08295636262
line2    1.590449512792, -20.08295636262, 1.590449512792, -19.98135636262
line2    1.590449512792, -19.98135636262, 1.540449512792, -19.98135636262
line2    1.540449512792, -19.98135636262, 1.540449512792, -20.00885659294
line2    1.540449512792, -20.00885659294, 1.499950899651, -20.00885659294
line2    1.499950899651, -20.00885659294, 1.499950899651, -20.02725659271
line2    1.499950899651, -20.02725659271, 1.489950898762, -20.02725659271
line2    1.489950898762, -20.02725659271, 1.489950898762, -20.0288565859
line2    1.489950898762, -20.0288565859, 1.504154523548, -20.0288565859
arc2     1.504150031969, -20.0280565965, 0.0008000020113974, 270.3216865704,           90
line2    1.504150031969, -20.02725659449, 1.501550899651, -20.02725659449
line2    1.501550899651, -20.02725659449, 1.501550899651, -20.01785659294
line2    0.06444951279192, -20.08295636262, 0.1164495127919, -20.08295636262
line2    0.1164495127919, -20.08295636262, 0.1164495127919, -20.05288660423
line2    0.1164495127919, -20.05288660423, 0.1264495127919, -20.05288660423
line2    0.1264495127919, -20.05288660423, 0.1264495127919, -20.01800659294
line2    0.1264495127919, -20.01800659294, 0.1553467308704, -20.01800659294
line2    0.1553467308704, -20.01800659294, 0.1553467308704, -20.02740659449
line2    0.1553467308704, -20.02740659449, 0.1527475985522, -20.02740659449
arc2     0.1527475985522, -20.0282065965, 0.0008000020113972,           90, 269.6783134337
line2    0.1527431069727, -20.0290065859, 0.1669467311665, -20.0290065859
line2    0.1669467311665, -20.0290065859, 0.1669467311665, -20.02740659271
line2    0.1669467311665, -20.02740659271, 0.1569467308704, -20.02740659271
line2    0.1569467308704, -20.02740659271, 0.1569467308704, -20.00900659294
line2    0.1569467308704, -20.00900659294, 0.1164495127919, -20.00900659294
line2    0.1164495127919, -20.00900659294, 0.1164495127919, -19.98135636262
line2    0.1164495127919, -19.98135636262, 0.06444951279192, -19.98135636262
line2    0.06444951279192, -19.98135636262, 0.06444951279192, -20.08295636262
line2    -1.369550487208, -20.04465636262, 0.06444951279192, -20.04465636262
line2    0.06444951279192, -20.03865636262, -1.369550487208, -20.03865636262
line2    -1.369550487208, -20.03865636262, -1.369550487208, -20.04465636262
line2    -1.369550487208, -20.02565636262, 0.06444951279192, -20.02565636262
line2    0.06444951279192, -20.01965636262, -1.369550487208, -20.01965636262
line2    -1.369550487208, -20.01965636262, -1.369550487208, -20.02565636262
line2    0.1541467240547, -20.03299548126, 0.154146710613, -20.04885548023
line2    0.154146710613, -20.04885548023, 0.1561467240548, -20.04885547875
line2    0.1561467240548, -20.04885547875, 0.1561467238532, -20.05784547853
line2    0.1561467238532, -20.05784547853, 0.1338295127919, -20.05784547853
line2    0.1338295127919, -20.05784547853, 0.1338295127919, -20.05584547867
arc2     0.133079512652, -20.05584547867, 0.0007500001399308,            0,          180
line2    0.132329511552, -20.05584547871, 0.132329512792, -20.07603548841
line2    0.132329512792, -20.07603548841, 0.1214495127919, -20.07603548841
line2    0.1214495127919, -20.07603548841, 0.1214495127919, -20.08299547712
line2    0.1214495127919, -20.08299547712, 0.1612478020773, -20.0829954799
line2    0.1612478020773, -20.0829954799, 0.1910916593197, -20.07499884245
line2    0.1910916593197, -20.07499884245, 0.1910916593197, -20.03334046532
line2    0.1910916593197, -20.03334046532, 0.1713268075086, -20.03299546854
line2    0.1713268075086, -20.03299546854, 0.1541467240547, -20.03299548126
line2    1.502752301529, -20.03299548126, 1.485572218075, -20.03299546854
line2    1.485572218075, -20.03299546854, 1.465807366264, -20.03334046532
line2    1.465807366264, -20.03334046532, 1.465807366264, -20.07499884245
line2    1.465807366264, -20.07499884245, 1.495651223507, -20.0829954799
line2    1.495651223507, -20.0829954799, 1.535449512792, -20.08299547712
line2    1.535449512792, -20.08299547712, 1.535449512792, -20.07603548841
line2    1.535449512792, -20.07603548841, 1.524569512792, -20.07603548841
line2    1.524569512792, -20.07603548841, 1.524569514032, -20.05584547871
arc2     1.523819512932, -20.05584547867, 0.0007500001399876,            0,          180
line2    1.523069512792, -20.05584547867, 1.523069512792, -20.05784547853
line2    1.523069512792, -20.05784547853, 1.500752301731, -20.05784547853
line2    1.500752301731, -20.05784547853, 1.500752301529, -20.04885547875
line2    1.500752301529, -20.04885547875, 1.502752314971, -20.04885548023
line2    1.502752314971, -20.04885548023, 1.502752301529, -20.03299548126
line2    0.1910916593197, -20.06875636262, 1.465807366264, -20.06875636262
line2    1.465807366264, -20.06275636262, 0.1910916593197, -20.06275636262
line2    0.1910916593197, -20.04975636262, 1.465807366264, -20.04975636262
line2    1.465807366264, -20.04375636262, 0.1910916593197, -20.04375636262
hotspot2 -1.409550487208, -20.08295636262
hotspot2 1.590449512792, -20.08295636262

DEL TOP

ENDIF
Lingwisyer
Guru
Studioverde wrote:
MUL2 A3.0, 1

You have removed the divide. Also, it should probably be your original width. A negative A value makes no sense as that would mean that your window has no width or negative width.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660
Barry Kelly
Moderator
Almost there.

Usually 'A' is the width of the window opening and 'B' is the height.
They are the length and height parameters in the info box and settings dialogue.

You are then changing their values in the 2D script and using them for the ADD2 to move the frame.
It will be better to create new variables for these and leave 'A' as the width of the window.

The MUL2 command is missing the 'divide' symbol.
The frame that you have drawn and used should be default 3.0 long, so when you set A as 3.0 in the settings it will be exactly the right size.
Then as you adjust the 'A' parameter the window frame will stretch.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Anonymous
Not applicable
Barry wrote:
Almost there.

Usually 'A' is the width of the window opening and 'B' is the height.
They are the length and height parameters in the info box and settings dialogue.

You are then changing their values in the 2D script and using them for the ADD2 to move the frame.
It will be better to create new variables for these and leave 'A' as the width of the window.

The MUL2 command is missing the 'divide' symbol.
The frame that you have drawn and used should be default 3.0 long, so when you set A as 3.0 in the settings it will be exactly the right size.
Then as you adjust the 'A' parameter the window frame will stretch.

Barry.
Perfect, this worked a charm. The new slight issue now is that when the window is at 3m, the size the 2D symbol was saved originally, it looks fine. When I try and change that to 2m, the 2d symbol does not constrain to the nodes at each end of the wall opening. See image.

The new code looks like this.
C = -0.09045
D = 19.90796

IF LOD = "Coarse" THEN
!
!   Name     : New Object 1.gsm
!   Date     : Wednesday, 11 September 2019
!   Version  : 22.00
!   Written by ARCHICAD 
!

add2     C,D
MUL2 A/3, 1
line_property       0
line2    1.540449512792, -20.08295636262, 1.535449512792, -20.08295636262
line2    1.495651223507, -20.08295636262, 0.1612478020773, -20.08295636262
line2    0.1214495127919, -20.08295636262, 0.1164495127919, -20.08295636262
line2    0.06444951279192, -20.08295636262, -1.359550487208, -20.08295636262
line2    -1.409550487208, -20.08295636262, -1.359550487208, -20.08295636262
line2    -1.359550487208, -20.08295636262, -1.359550487208, -20.05422889551
line2    -1.359550487208, -20.05422889551, -1.390350487208, -20.05422889551
line2    -1.390350487208, -20.05422889551, -1.390350487208, -20.01008382972
line2    -1.390350487208, -20.01008382972, -1.359550487208, -20.01008382972
line2    -1.359550487208, -20.01008382972, -1.359550487208, -19.98135636262
line2    -1.359550487208, -19.98135636262, -1.409550487208, -19.98135636262
line2    -1.409550487208, -19.98135636262, -1.409550487208, -20.08295636262
line2    1.501550899651, -20.01785659294, 1.530551204182, -20.01785659294
line2    1.530551204182, -20.01785659294, 1.530444444816, -20.05273660423
line2    1.530444444816, -20.05273660423, 1.540449512792, -20.05273660423
line2    1.540449512792, -20.05273660423, 1.540449512792, -20.08295636262
line2    1.540449512792, -20.08295636262, 1.590449512792, -20.08295636262
line2    1.590449512792, -20.08295636262, 1.590449512792, -19.98135636262
line2    1.590449512792, -19.98135636262, 1.540449512792, -19.98135636262
line2    1.540449512792, -19.98135636262, 1.540449512792, -20.00885659294
line2    1.540449512792, -20.00885659294, 1.499950899651, -20.00885659294
line2    1.499950899651, -20.00885659294, 1.499950899651, -20.02725659271
line2    1.499950899651, -20.02725659271, 1.489950898762, -20.02725659271
line2    1.489950898762, -20.02725659271, 1.489950898762, -20.0288565859
line2    1.489950898762, -20.0288565859, 1.504154523548, -20.0288565859
arc2     1.504150031969, -20.0280565965, 0.0008000020113974, 270.3216865704,           90
line2    1.504150031969, -20.02725659449, 1.501550899651, -20.02725659449
line2    1.501550899651, -20.02725659449, 1.501550899651, -20.01785659294
line2    0.06444951279192, -20.08295636262, 0.1164495127919, -20.08295636262
line2    0.1164495127919, -20.08295636262, 0.1164495127919, -20.05288660423
line2    0.1164495127919, -20.05288660423, 0.1264495127919, -20.05288660423
line2    0.1264495127919, -20.05288660423, 0.1264495127919, -20.01800659294
line2    0.1264495127919, -20.01800659294, 0.1553467308704, -20.01800659294
line2    0.1553467308704, -20.01800659294, 0.1553467308704, -20.02740659449
line2    0.1553467308704, -20.02740659449, 0.1527475985522, -20.02740659449
arc2     0.1527475985522, -20.0282065965, 0.0008000020113972,           90, 269.6783134337
line2    0.1527431069727, -20.0290065859, 0.1669467311665, -20.0290065859
line2    0.1669467311665, -20.0290065859, 0.1669467311665, -20.02740659271
line2    0.1669467311665, -20.02740659271, 0.1569467308704, -20.02740659271
line2    0.1569467308704, -20.02740659271, 0.1569467308704, -20.00900659294
line2    0.1569467308704, -20.00900659294, 0.1164495127919, -20.00900659294
line2    0.1164495127919, -20.00900659294, 0.1164495127919, -19.98135636262
line2    0.1164495127919, -19.98135636262, 0.06444951279192, -19.98135636262
line2    0.06444951279192, -19.98135636262, 0.06444951279192, -20.08295636262
line2    -1.369550487208, -20.04465636262, 0.06444951279192, -20.04465636262
line2    0.06444951279192, -20.03865636262, -1.369550487208, -20.03865636262
line2    -1.369550487208, -20.03865636262, -1.369550487208, -20.04465636262
line2    -1.369550487208, -20.02565636262, 0.06444951279192, -20.02565636262
line2    0.06444951279192, -20.01965636262, -1.369550487208, -20.01965636262
line2    -1.369550487208, -20.01965636262, -1.369550487208, -20.02565636262
line2    0.1541467240547, -20.03299548126, 0.154146710613, -20.04885548023
line2    0.154146710613, -20.04885548023, 0.1561467240548, -20.04885547875
line2    0.1561467240548, -20.04885547875, 0.1561467238532, -20.05784547853
line2    0.1561467238532, -20.05784547853, 0.1338295127919, -20.05784547853
line2    0.1338295127919, -20.05784547853, 0.1338295127919, -20.05584547867
arc2     0.133079512652, -20.05584547867, 0.0007500001399308,            0,          180
line2    0.132329511552, -20.05584547871, 0.132329512792, -20.07603548841
line2    0.132329512792, -20.07603548841, 0.1214495127919, -20.07603548841
line2    0.1214495127919, -20.07603548841, 0.1214495127919, -20.08299547712
line2    0.1214495127919, -20.08299547712, 0.1612478020773, -20.0829954799
line2    0.1612478020773, -20.0829954799, 0.1910916593197, -20.07499884245
line2    0.1910916593197, -20.07499884245, 0.1910916593197, -20.03334046532
line2    0.1910916593197, -20.03334046532, 0.1713268075086, -20.03299546854
line2    0.1713268075086, -20.03299546854, 0.1541467240547, -20.03299548126
line2    1.502752301529, -20.03299548126, 1.485572218075, -20.03299546854
line2    1.485572218075, -20.03299546854, 1.465807366264, -20.03334046532
line2    1.465807366264, -20.03334046532, 1.465807366264, -20.07499884245
line2    1.465807366264, -20.07499884245, 1.495651223507, -20.0829954799
line2    1.495651223507, -20.0829954799, 1.535449512792, -20.08299547712
line2    1.535449512792, -20.08299547712, 1.535449512792, -20.07603548841
line2    1.535449512792, -20.07603548841, 1.524569512792, -20.07603548841
line2    1.524569512792, -20.07603548841, 1.524569514032, -20.05584547871
arc2     1.523819512932, -20.05584547867, 0.0007500001399876,            0,          180
line2    1.523069512792, -20.05584547867, 1.523069512792, -20.05784547853
line2    1.523069512792, -20.05784547853, 1.500752301731, -20.05784547853
line2    1.500752301731, -20.05784547853, 1.500752301529, -20.04885547875
line2    1.500752301529, -20.04885547875, 1.502752314971, -20.04885548023
line2    1.502752314971, -20.04885548023, 1.502752301529, -20.03299548126
line2    0.1910916593197, -20.06875636262, 1.465807366264, -20.06875636262
line2    1.465807366264, -20.06275636262, 0.1910916593197, -20.06275636262
line2    0.1910916593197, -20.04975636262, 1.465807366264, -20.04975636262
line2    1.465807366264, -20.04375636262, 0.1910916593197, -20.04375636262
hotspot2 -1.409550487208, -20.08295636262
hotspot2 1.590449512792, -20.08295636262

DEL TOP

ENDIF
Lingwisyer
Guru
That would be due to the ADD2 C, D. Why are you creating new variables anyway? The purpose of these is to shift the reference point from the center of the object to the corner. So it should be ADD2 A/2, Z/2. Z being the thickness of your window. You really should read the documentation instead of blindly adding things.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win11 | i9 10850K | 64GB | RX6600 Win10 | R5 2600 | 16GB | GTX1660
Barry Kelly
Moderator
Simple solution - we need to scale the offset as well.
So swap the ADD2 and MUL2 lines around so the MUL2 happens before the ADD2.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Anonymous
Not applicable
Perfect. It is now working perfectly and see below for the final script. I just wanted to ask for a final favour. Is there no way to add any script to the existing 2D code to force Archicad to scale the width of the 2D symbol from the panel of the window and not the frames? Obviously, as you guys have stated earlier, the current code scales everything including the width of the frames. I know that it is too late to fix this the right way given that the project hand over is scheduled in 5 days times but if there is any way that anyone can think of that does not require days of changing code, I would really appreciate it.

I think this exercise has shown me how much I need to learn GDL to make better use of Archicad and that I will be doing in the near future.
Barry Kelly
Moderator
Studioverde wrote:
Is there no way to add any script to the existing 2D code to force Archicad to scale the width of the 2D symbol from the panel of the window and not the frames?
No, not easily.
You would have to isolate the code that draws each of the frames.
ADD2 the left frame negative half of the opening width.
ADD2 the right frame positive half of the opening width.
The centre one can stay at 0,0.

The horizontal panel lines in between you probably won't want to MULL any more - you would alter them to half the window width less the frame width.

But you will also have to take into consideration your C & D offsets.
Then I believe you have 3 other LOD scripts that you would need to do the same for.

When ever you create a window from lines on a plan (or you can even model it from slabs, walls, etc.), it is better to centre it on the project origin to avoid the offsets.
In the HelpCentre you will find how to model the windows from slabs and save as a window.

https://helpcenter.graphisoft.com/knowledgebase/25564/

Again these will not be parametric (adjustable) but all the ADDs and MULs will be taken care of for you.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Anonymous
Not applicable
I can now understand what you mean. Thank you all who contributed to my thread and helped me out with this. I hope to learn more GDL and to help somebody else on this forum someday. I really appreciate the help.