GDL
About building parametric objects with GDL.
SOLVED!

add several GROUPs without additional lines

A_ Smith
Expert
Hi.
I have an object that consists of several parts (bricks) - for eg. 5 pieces. Let's imagine it's bricks of different sizes. They are placed like stories in building (kinda block of flats with 5 levels). 1st and 5th brick are the same - equal, but have a different placement. If I want to make this object smooth in 3D (user won't see edges/lines of detaching each part to another one), I need, as far as I know, to make 5 GROUPs and make 5 times ADDGROUP.
group "1": block 1,1,1
group "2": ADDz 1: block 2,2,2
group "3": ADDz 1+2: block 3,3,3
group "4": ADDz 1+2+3: block 4,4,4
group "5": ADDz 1+2+3+4: block 1,1,1
result=addgroup ("1", "2")
result=addgroup (result, "3")
result=addgroup (result, "4")
result=addgroup (result, "5")
placegroup result

In that case (above) no vertical lines between bricks. But it isn't very good to duplicate group "1" twice, just with different placement (especially, when it's long code). I figured out that outcome will be the same, but with one additional edge/line (in case of a complex object, their amount increases rapidly).

group "1": block 1,1,1
group "2": ADDz 1: block 2,2,2
group "3": ADDz 1+2: block 3,3,3
group "4": ADDz 1+2+3: block 4,4,4
result=addgroup ("1", "2")
result=addgroup (result, "3")
result=addgroup (result, "4")
placegroup result
ADDZ 1+2+3+4
placegroup "1"
DEL 1
The whole reason of using groups here was to decrese amount of edges...
Is there any other way to make this object without additional edges in more "right" and convenient way?
AC 22, 24 | Win 10
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Dominic Wyss
Booster
I tried this:
All volumes as one group.
Then add the group to itself.
group "object":
	block 1,1,1

	ADDz 1
	block 2,2,2
	del 1

	ADDz 1+2
	block 3,3,3
	del 1

	ADDz 1+2+3
	block 4,4,4
	del 1

	ADDz 1+2+3+4
	block 1,1,1
	del 1

endgroup

res = addgroup ("object", "object")
placegroup res
All inner edges were removed.
AC27 CHE - macOS Ventura M1

View solution in original post

5 REPLIES 5
Solution
Dominic Wyss
Booster
I tried this:
All volumes as one group.
Then add the group to itself.
group "object":
	block 1,1,1

	ADDz 1
	block 2,2,2
	del 1

	ADDz 1+2
	block 3,3,3
	del 1

	ADDz 1+2+3
	block 4,4,4
	del 1

	ADDz 1+2+3+4
	block 1,1,1
	del 1

endgroup

res = addgroup ("object", "object")
placegroup res
All inner edges were removed.
AC27 CHE - macOS Ventura M1
A_ Smith
Expert
Thank you. Never tried before to add some group to itself.
I wish there were better solution. Because in my case instead of that "block 1,1,1" I have 30 rows of code...
AC 22, 24 | Win 10
use loop statements to make it more efficient
Creator of Cadswift's parametric GDL libraries
Creator of Infinite Openings and Component Catalogues
Push the envelope & watch it bend
website: https://cadswift.com.au/
YouTube: https://www.youtube.com/user/CADSwift/playlists
Dominic Wyss
Booster
A. wrote:
I wish there were better solution. Because in my case instead of that "block 1,1,1" I have 30 rows of code...
I would use subroutines so you can use identical parts several times.

group "object":
	gosub "geometry_1"

	addz dist_2
	gosub "geometry_2"

	addz dist_3
	gosub "geometry_3"

	...

	addz dist_5
	gosub "geometry_1"

endgroup

res = addgroup ("object", "object")
placegroup res

killgroup res
killgroup "object"

AC27 CHE - macOS Ventura M1
A_ Smith
Expert
Thank everybody for your time and help.
AC 22, 24 | Win 10