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

Repeating 'stretchy' element object

Erwin Edel
Rockstar
I'm having some trouble with MUL code.

I have a bunch of LIN_ lines I want to copy around in a grid, but I want to adjust the height and width of the copies a bit to fit the height and width of the object.

I have the following code, but it bugs out:
pen gs_cont_pen											
aa=0.3466! this is the actual width of the original
zz=0.4041!this is the actual height of the original
n1=round_int(a/aa)!divide A by the original width to get a round number
n2=round_int(zzyzx/zz)!divide ZZYZX by original height to get a round number
aaa=a/n1!this should calculate the new width of element
zzz=zzyzx/n2!this should calculate the new height of element

for herh2 = 1 to n2 !repeat vertical
for herh1 = 1 to n1 !repeat horizontal
MULX aa/aaa!adjust width to new width
MULZ zz/zzz!adjust heigh to new height

!! here are all the LIN_ statements for my shape for sake of simplicity, one line
LIN_ 0,0,0, 0.3466,0,0.4041
addx aaa !move in x direction
next herh1
del n1
addz zzz !move in y direction
next herh2
Does anyone know where I've made a mistake in the code?
Erwin Edel, Project Lead, Leloup Architecten
www.leloup.nl

ArchiCAD 9-26NED FULL
Windows 10 Pro
Adobe Design Premium CS5
1 REPLY 1
Erwin Edel
Rockstar
Still playing around with this bit of code
pen gs_cont_pen                                  

aa=0.3466! this is the actual width of the original 
zz=0.4041!this is the actual height of the original 
n1=round_int(a/aa)!divide A by the original width to get a round number 
n2=round_int(zzyzx/zz)!divide ZZYZX by original height to get a round number 

aaa=a/n1!this should calculate the new width of element 
zzz=zzyzx/n2!this should calculate the new height of element 

MULX aa/aaa!adjust width to new width 
MULZ zz/zzz!adjust heigh to new height 
for herh2 = 1 to n2 !repeat vertical 
for herh1 = 1 to n1 !repeat horizontal 

!! here are all the LIN_ statements for my shape for sake of simplicity, one line 
BODY -1
LIN_ 0,0,0, 0,0,zz 
LIN_ 0,0,0, aa,0,0

addx aa !move in x direction 

next herh1 
del n1
addz zz !move in y direction 
next herh2
Small modification, but it still doesn't work like I want it to.

Does anyone have an idea how to make it work?
Erwin Edel, Project Lead, Leloup Architecten
www.leloup.nl

ArchiCAD 9-26NED FULL
Windows 10 Pro
Adobe Design Premium CS5