cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

creating new parameters with FOR NEXT loop?

Palawat
Advocate
Hi everyone,

I'm trying to create rectangular symbol and give movable hotspot for each rect.

My code looks like this:
!-------------------------------------------------------------------------

nRect = 3
unID = 100

for i = 1 to nRect
add2 1.5, 0

hotspot2 0, moveY, unID, moveX, 1+128 :unID = unID+1 ! Move X
hotspot2 moveX, moveY, unID, moveX, 2+256 :unID = unID+1
hotspot2 -1, moveY, unID, moveX, 3 :unID = unID+1

hotspot2 moveX, 0, unID, moveY, 1+128 :unID = unID+1 ! Move Y
hotspot2 moveX, moveY, unID, moveY, 2+256 :unID = unID+1
hotspot2 moveX, -1, unID, moveY, 3 :unID = unID+1

add2 moveX, moveY
rect2 -A/2, -B/2, A/2, B/2
del 1
next i
del nRect

!-------------------------------------------------------------------------

What I aim for is that, each hotspot can move each rect attached to it freely, not all at the same time. Right now I can create new parameters like "moveX1" , "moveY1", ... and use them for each rect (using subroutine)....something like :

if nRect = 1 then gosub "rect1"
if nRect = 2 then gosub "rect2"

Then I realize, if I want nRect to be 20, I will have to create 40 more parameters.

Is there a smarter way, something that works like unID=unID+1, maybe? Any comment is appreciated.
Archicad 26, Windows 10, Corei7 3.4 GHz, 16 GB Ram.
https://www.indigofigs.com
https://www.facebook.com/indigofigs
2 REPLIES 2
Anonymous
Not applicable
Hi Palawat,

you have to use arrays for moveX/moveY.

The unID is right.
Palawat
Advocate
Thank you very much, ila2.

I'll look into it.
Archicad 26, Windows 10, Corei7 3.4 GHz, 16 GB Ram.
https://www.indigofigs.com
https://www.facebook.com/indigofigs