2D Scale - Tangent 4 Lines

I have an airfoil shape I need to scale to dozens of different sized boxes. The boxes are rotated at various random angles. I need to scale each so that the airfoil shape fills the box and is tangent to all 4 sides. Here is links to before and after image and example Rhino file. I’m still using Rhino v4.

screen shot

rhino file


@pascal, any ideas here?

I think… use two sides of each box to set a plane and then BoundingBox the foil curve based on the plane…? Will that do it? Should be scriptable, I’ll have a try.

@The10thMan, is the red box in the attached file what you want?

Just in case that is correct, here is a script that should work to automate this- To use the script, extract and save the .rvb file from the attached zip archive, then drag and drop the saved rvb over an open Rhino v5 window. This will load the script, set it up to load on startup in the future and register the alias


that will run the script much like a regular command. An alias can be typed or added to a toolbar button or keyboard shortcut (F-key).


scaletan_PG.3dm (51.0 KB)

FrameAirfoils.zip (760 Bytes)

scaletan.3dm won’t open in v4

The script FrameAirfoils asks to select boxes. I select A box and hit enter. I get the following error. I get same error when selecting multiple boxes.

Yep, I see- I am using something from V5 only… let me see if I can make it work in V4. Meantime, here is the 3dm file in V4 format.

scaletan_PG_V4.3dm (53.0 KB)

The red box is not what is needed.

The box stays unchanged. The airfoil shape needs to be scaled to fit the box. Scaling in one direction will be different than the other.

like this

Got it- that is also possible, I think.
OK, @The10thMan, see how this works- replace the earlier script with this one, and restart rhino or drag and drop again.

FrameAirfoils.rvb (2.4 KB)

doesn’t work right. shape isn’t tangent to any of the boxes lines. on some box sizes the airfoil rotates to fit the box. That is unwanted. MUST scale straight in X and in Y.

Ah, well, I fixed getting the tangency right, that was just dumb scripting, but that is an extra hoop to jump through - I’ll see if I have time to figure something out.



I’m guessing no solution?

I do not see an exact solution, myself. It would be a matter of jiggling the thing into place with multiple iterations (somehow) and getting it to be ‘good enough’.