Forgot password?

Create an account!

Forum

« back

RhinoScript – Script for volumetric design?

Messages

Please log in to write a message.

  • 3. ledisnomad (Jan 16, 2012 21.31):

    This is a really quick script that only works on rectangles that are aligned with the current cplane's x- and y-axes. You select two corners to define one side of the rectangle, enter a new length, and it will scale it correctly using the first picked point as the origin. Not a very flexible script, but I thought if it did what you wanted, then you are good to go.

    Option Explicit
    'Script written by Damon Sidel
    'Script copyrighted by Damon Sidel
    'Script version Monday, January 16, 2012

    Call ScaleRectWConstantArea()
    Sub ScaleRectWConstantArea()
           
            Dim strRect : strRect = Rhino.GetObject("Select a rectangle to scale")
            If IsNull(strRect) Then Exit Sub
           
            Dim p1 : p1 = Rhino.GetPoint("Select first corner along length to measure")
            If IsNull(p1) Then Exit Sub
           
            Dim p2 : p2 = Rhino.GetPoint("Select second corner along length to measure")
            If IsNull(p2) Then Exit Sub
           
            Dim dblArea : dblArea = Rhino.CurveArea(strRect)
            If IsNull(dblArea) Then Exit Sub
           
            Call Rhino.Print("Area = " & dblArea(0))
           
            Dim d0 : d0 = Rhino.Distance(p1,p2)
           
            Call Rhino.Print("Current length = " & d0)
           
            Dim d1 : d1 = Rhino.GetReal("Enter new length")
            If IsNull(d1) Then Exit Sub
           
            Dim d0, d1, l0, l1, x, y
           
            l0 = dblArea(0)/d0
            l1 = dblArea(0)/d1
            x = d1/d0
            y = l1/l0

            Call Rhino.ScaleObject(strRect,p1,Array(x,y,0))

    End Sub
  • 2. Johannes (Jan 15, 2012 12.30):

    sounds like a mathematical projects. In case of basic geometrical shapes (square, box, triangle,...) you can fix the area/volume, scale the object and recalculate the other dimensions based on an origin... Would be nice to see that script over here ;)

  • 1. Bonza (Jan 15, 2012 11.43):

    Hello,

    Does anyone know of a script that will let you draw a shape such as a square and then let you lock in a determined area value so that no matter how you stretch the square (i.e make it into a long rectangle) the area stays the same?

    Thanks

Recommend

Why are these buttons gray?