Is there a command to select all Scaled Blocks in a Rhino file?

Hi,

Do any users know of a command which can select all Scaled Blocks and/or non-uniformly scaled blocks?

I can see there is are options for SelMirroredBlocks and also SelBlockInstanceNamed, however nothing which can select ‘Non-uniformly scaled blocks’

It would be a nice ‘quality of life’ tool to help clean a facade model.

Thanks

i have never used it but maybe BlockResetScale or ResetBlock.

Rhinoscriptsyntax has BlockInstanceXform

Copilot helped me put this code together:

import rhinoscriptsyntax as rs
import math

def has_non_unit_scale(xform, tolerance=1e-6):
    # Create basis vectors using proper Transform component access
    x_vector = rs.VectorCreate([xform.M00, xform.M01, xform.M02], [0, 0, 0])
    y_vector = rs.VectorCreate([xform.M10, xform.M11, xform.M12], [0, 0, 0])
    z_vector = rs.VectorCreate([xform.M20, xform.M21, xform.M22], [0, 0, 0])

    # Calculate scale as vector lengths
    scale_x = rs.VectorLength(x_vector)
    scale_y = rs.VectorLength(y_vector)
    scale_z = rs.VectorLength(z_vector)

    return (
        math.fabs(scale_x - 1) > tolerance or
        math.fabs(scale_y - 1) > tolerance or
        math.fabs(scale_z - 1) > tolerance
    )

# Loop through all block instances in the model
guids = rs.AllObjects()
for guid in guids:
    if rs.IsBlockInstance(guid):
        xform = rs.BlockInstanceXform(guid)
        if has_non_unit_scale(xform):
            rs.SelectObject(guid)
            print(f"Scaled block detected: {guid}")

forgot to mention that with these 2 commands you might be able to just select all blocks at once. but what if you have different blocks that are scaled? so that might require to have a file that has only one kind of block