cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn to manage BIM workflows and create professional Archicad templates with the BIM Manager Program.

GDL
About building parametric objects with GDL.
SOLVED!

ADDGROUP in loops

Domagoj Lukinic
Booster

Hi all,

I am trying to merge my geometry into one, i found this:
https://community.graphisoft.com/t5/GDL/add-several-GROUPs-without-additional-lines/m-p/274202

However is ti possible to not have an error in the code ("Identical operands in group operation").

I need something like this for my code:

pen 1
material 1

group "object":
	gosub "Fixed geomety"

	gosub "Looped geometry"
endgroup

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


end:!=====================================================

"Fixed geomety":
	block 1,1,1
return

"Looped geometry":
	for i=1 to 5
		addx 1/2
		block 1,1/2,1
	next i
return

 

I tried to add an empty group but no result, any solutions?

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Pertti Paasky
Expert

I use this:


val_a=1
val_b=2
val_z=1

group "mygroup"
block val_a,val_b,val_z
endgroup

mygroup="mygroup"

for i= 1 to 3
   
group "mygroup"+str("%.0m",i)
add i*.2,i*.3,i*.1  
block val_a,val_b,val_z
del 1
endgroup

mygroup=addgroup(mygroup,"mygroup"+str("%.0m",i))
killgroup "mygroup"+str("%.0m",i)
next i

placegroup mygroup
killgroup mygroup
- AC-24 FIN - WIN 10 - HP Zbook -
“A winner is just a loser who tried one more time.”
George M. Moore, Jr.

View solution in original post

3 REPLIES 3
Jochen Suehlo
Moderator

I think the problem is the Addgroup with 2 identical Group Names. Try this:

pen 1
material 1


	group "object1"
		gosub "Fixed geomety"
		gosub "Looped geometry"
	endgroup

	group "object2"
		gosub "Fixed geomety"
		gosub "Looped geometry"
	endgroup

res = addgroup ("object1", "object2")
placegroup res 


end:!=====================================================

"Fixed geomety":
	block 1,1,1
return

"Looped geometry":
	for i=1 to 5
		addx 1/2
		block 1,1/2,1
	next i
return

 

Jochen Suehlo . AC12-27 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de

I wrote a number that gets 1 added each loop but is converted to a string for the group name. That way there is never a duplicate group name

Solution
Pertti Paasky
Expert

I use this:


val_a=1
val_b=2
val_z=1

group "mygroup"
block val_a,val_b,val_z
endgroup

mygroup="mygroup"

for i= 1 to 3
   
group "mygroup"+str("%.0m",i)
add i*.2,i*.3,i*.1  
block val_a,val_b,val_z
del 1
endgroup

mygroup=addgroup(mygroup,"mygroup"+str("%.0m",i))
killgroup "mygroup"+str("%.0m",i)
next i

placegroup mygroup
killgroup mygroup
- AC-24 FIN - WIN 10 - HP Zbook -
“A winner is just a loser who tried one more time.”
George M. Moore, Jr.