Scale objects by volume centroid

Hey guys,

Is there a way to select multiple single objects and scale them all at the same time from their relative individual centres?

Cheers

Andy

Not sure if you can in Rhino alone but you can use the Grasshopper plugin to do that easily.

My Grasshopper experience is zero… Sadly

basically zero? or absolute zero?

because it really is a simple one to do in grasshopper.

in rhino alone, you’ll have to scale them one at a time since Scale accepts only a single origin point.

1 Like

Hi - you can use BoxEdit command with option to use individual bboxes and their centers. That should do it.

hth,

–jarek

BoxEdit? sounds neat…

i haven’t been able to try that one before :wink:

Hmmm… I’m working with surfaces so tried it with area:

It’s scaling the whole thing as it does with regular scale…

My mistake… It was joined.

Just trying to work out why when scaling in the negative the parts get bigger :smiley:

And now how to apply… I really should start using Grasshopper! :slightly_smiling:

to scale smaller, you’d set to something in between 0.0 & 0.999…

if you keep going in the negative direction past 0, it flips…

right-click on Scale and choose Bake.

Here’s a Python that might help-

import rhinoscriptsyntax as rs
import Rhino
import scriptcontext as sc


def ScaleEach():
    factor=2
    objrefs = []
    if sc.sticky.has_key("SCALEFACTOR"):
        factor = sc.sticky["SCALEFACTOR"]
    while True:
        go = Rhino.Input.Custom.GetObject()
        go.AcceptNumber(True, False)
        optFactor = Rhino.Input.Custom.OptionDouble(factor)
        go.AddOptionDouble("Scale",optFactor)
        
        get_rc = go.GetMultiple(1, 0)


        if go.CommandResult()!=Rhino.Commands.Result.Success:

            return go.CommandResult()
            
        if get_rc==Rhino.Input.GetResult.Object:
            for n in range(go.ObjectCount):
                objrefs.append(go.Object(n))
            break
            
        elif get_rc == Rhino.Input.GetResult.Number:
            factor = go.Number()
            sc.sticky["SCALEFACTOR"] = factor
            
        elif get_rc==Rhino.Input.GetResult.Option:
            factor = optFactor.CurrentValue
            sc.sticky["SCALEFACTOR"] = factor
            continue
            
    factor = sc.sticky["SCALEFACTOR"]
    if len(objrefs) == 0: return
    
    rs.EnableRedraw(False)
    for objref in objrefs:
        Id = objref.ObjectId
        obj = sc.doc.Objects.Find(Id)
        bbCen = obj.Geometry.GetBoundingBox(True).Center
        rs.ScaleObject(Id,bbCen,[factor, factor, factor],False)
    rs.EnableRedraw(True)

ScaleEach()

-Pascal

2 Likes

Thank you guys! So simple… When you know what you’re doing :slightly_smiling:

3 Likes