Python script to scale, copy and move to created layer(s)


#1

I need help with a script. I have looked at the sample script "CopyObjectsToLayer’. I have a script that copies & scales the object. I can create the layers & sub-layers. What I am wondering, is how to combine them and in which order to do each task. So;

  1. copy object and scale 3D from 1mm to 3mm in 0.1mm increments, thus having 20+ objects.
  2. create a separate layer & sublayer for each of the above objects.
  3. move each object to the correct layer.

I have 4 separate objects to do this to. Possibly more in the future, hence my desire to figure out a script and not end up doing this by hand.

Thanks in advance,
Randy

ps; my copy & scale script attached, anyway to simplify this?Copy&ScaleObjects.py (1.2 KB)


Flow along a surface and scale objects proportionally
#2

Hi Randy,

ScaleObject works by using a scale vector. Meaning side(s) of your objects will be scaled by certain percentage, not by Rhino unit.

For example: scale vector of: [1.1,1.1,1.1] will just scale up your object by 10%. If your object is let’s say a cube of dimensions: 1x1x1cm, then the mentioned scale vector will enlarge it by 10mm in all three directions.
Otherwise if your object has some other dimensions, the increase corresponds to the 10% of those dimensions.

Try attached recursion function.

scaleObjectRec.py (1.1 KB)


#3

Thanks djordje,

I am trying to set up files with Gemstone sizes i use. My round ‘diamond’ is 1mm in diameter and i can use any size from that to 3.0mm increased by .10mm & also by .25. So 1mm, 1.10mm, 1.20mm, 1.25mm etc…
I would like to scale my original by 10%, so your file works great, Thanks. Lots of things to learn.

I was thinking of a list also, Recursion is more what I was after.

Randy