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

GDL
About building parametric objects with GDL.
SOLVED!

Problem with SUBGROUP

Jim Allen
Advisor

I'm building a parametric component for a modular battery storage unit. Everything works in terms of basic geometry creation, but I want to finish the component with some additional details - recessed handles and grooves.

 

This is what the 'dumb' component looks like:

 

Screenshot 2023-02-20 at 15.10.40.png

This is the parametric one:

Screenshot 2023-02-20 at 15.10.15.png

I need to undertake a subtraction to create the grooves and handles. I've created groups, and looked up the SUBGROUP syntax, but I'm getting an error.

 

This is my script:

 

"top":

GROUP "topsection"

ADDZ (footheight*2) + baseheight + modoffset +((modoffset + modheight)* modcopies)
material mat2
!curved corner 1

ADDX footheight !footheight is same dimension as corner radius
ADDY footheight
CYLIND topheight, footheight 
del 2

!curved corner 2
ADDX A-footheight
ADDY footheight
CYLIND topheight, footheight
del 2

!curved corner 3
ADDX footheight
ADDY B-footheight
CYLIND topheight, footheight
del 2

!curved corner 4
ADDX A-footheight
ADDY B-footheight
CYLIND topheight, footheight
del 2

SLAB 4, topheight, 
footheight, 0, 0,
A-footheight,0, 0,
A-footheight,B, 0,
footheight, B, 0

SLAB 4, topheight, 
0, footheight, 0,
A, footheight, 0,
A, B-footheight, 0,
0, B-footheight, 0

ENDGROUP

GROUP "topgrooves"

!groove1
material mat3
ADDX footheight
SLAB 4, topheight, 
0, 0, 0,
GrooveWidth, 0, 0,
GrooveWidth, GrooveDepth, 0,
0, GrooveDepth, 0
Del 1

!groove2
material mat3
ADDX A - GrooveWidth - footheight
SLAB 4, topheight, 
0, 0, 0,
GrooveWidth, 0, 0,
GrooveWidth, GrooveDepth, 0,
0, GrooveDepth, 0
Del 1

!groove3
material mat3
ADDX A - GrooveWidth - footheight
ADDY B - GrooveDepth
SLAB 4, topheight, 
0, 0, 0,
GrooveWidth, 0, 0,
GrooveWidth, GrooveDepth, 0,
0, GrooveDepth, 0
Del 2

!groove4
material mat2
ADDX footheight
ADDY B- GrooveDepth
SLAB 4, topheight, 
0, 0, 0,
GrooveWidth, 0, 0,
GrooveWidth, GrooveDepth, 0,
0, GrooveDepth, 0
Del 2
ENDGROUP

topcomplete = SUBGROUP (topsection, topgrooves)

del top

RETURN

 

I've checked the syntax, but when I run the Check Script function, I get this error:

 

Group name or group type expression required at line 249 in the 3D script of file BYD Battery Box LVS.gsm.

 

I'm not sure what I'm doing wrong - any ideas?

 

Archicad 27 UKI | OS X 12.7.1 Monterey
11 REPLIES 11
Jim Allen
Advisor

Thanks for everyone's help on this!

 

There are lots of subtleties in terms of where you use single quotes, where you can use double quotes, where you shouldn't use quotes, and the order in which you place commands including KILLGROUP.

 

The 3d elements and parameters of the object are complete:

Screenshot 2023-02-22 at 10.47.12.png

I have the 2d view to script.

This is my first parametric object which can create alternative configurations of something.

 

I'll upload this to BIMComponents when it's complete, so I'm really grateful for everyone's generosity in terms of taking time to help.

 

I have a list of objects I want to build, including glass patch fittings, spur shelving, school coat hooks, cycle hoops and a half hexagon table.

Archicad 27 UKI | OS X 12.7.1 Monterey

Single quotes ' or double quotes " - there is no real difference when creating a group name so long as they are used in pairs.

 

When you create a group the name must be in quotes i.e. GROUP "group_1".

If you place that group the name must also be in quotes.

Basically if it has quotes, every time you use that name it must be in quotes.

 

However, when you create a new group by merging 2 groups - i.e. newgroup = ADDGROUP("group_1", "group_2"), then that new group does not have quotes.

Now when ever you use that new group name, you do not need to use quotes.

 

It is a little confusing I agree, but is just the way GDL works.

 

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