Repeat a macro on the next layer


I’m running a macro on a specific layer (using _-SelLayer). Everything works great, but now I’d like to loop this macro on the next layer, and then the next one, and then the next one etc.

Is there a way to do it with the macro editor?

Thanks !

Hello- the repeat character is ‘*’ so for example:

*_line 0

what is the macro you have?


Hello, Thanks for the reply

Here’s the macro

_-SelLayer Hole_0
_Pause ;BasePoint
10 ;radius
150 ;OverallHeight
_-SelLayer 01_Pannel

What I’m trying to do is to make a bunch of 20mm diameter holes in a Polysurface (a wall) and each hole has its direction dictated by a pair of points located on either side of the polysurface. Furthermore, each pair of points has its own color and its own layer named Hole_0, Hole_1, Hole_2, Hole_3, etc etc

Basically, the exercise is to come up with our own macro in order to automate the process as much as possible (I’ve never used macros or coded anything in my life). So far, the idea I’ve come up with works pretty well for a single hole, and I still have to clic on the base point of the cylinder but that’s not a big deal.

And my next goal is to avoid copying this hole macro for the 98 next holes. That’s why I’m looking for something that could allow me to repeat all the lines under ’ _-SelLayer Hole_0 ’ and apply them to the next layer Hole_1 and then Hole_2 etc.

I hope I’ve been clear

Thanks a lot

PS : Sorry for the bad code I started to use macros only today

PS.1 : My rhino is in French so a few lines are not in English

Hello- this seems like a job for scripting and not a macro. Another way might be a macro with the RoundHole command, possibly, or make one cylinder and use orient to align the cylinders on your points and then BooleanDifference all at once or in groups. But really this is something for Grasshopper or for a script.

That said, what happens if you put * in front of your macro?


etc etc



That’s what I was thinking but that’s ok, our teacher told us to try by ourselves and that we might reach the limits of macro editing.

Putting * in front of the macro only selects the pair of points in the layer Hole_0

I think you have succeeded.