How to call squish command in Rhino Script

Hi Direyes,

EDIT: only after posting I realized you are not programming in Python.
Still I leave my answer up as it might still be of use to OP or others.

I extracted the squish code out of our library.
Some lines specific for our workflow I purged so maybe that broke something, but I think it will get you on your way:

def squish_macro(objs):
    """
    run squish command on input geometry and return result
    
    squish command options:
        SplitSeams=Yes  
        PreserveBoundary=No  
        Deformation=Free  
        Material=Floppy  
        Outside=Up  
        Decorate=No
    
    """
    """
    
    Deformation
    Choose an option depending on your bias for stretching or compressing, and the ability to specify custom deformation settings.
    Free:           No preference for compression or stretching.
        
    StretchMostly:  Strong bias for expansion when the pattern is deformed into the 3-D shape.
        
    StretchOnly:    Absolutely no compression when the pattern is deformed into the 3-D shape.
        
    CompressMostly: Strong bias for compression when the pattern is deformed into the 3-D shape.
        
    CompressOnly:   Absolutely no expansion when the pattern is deformed into the 3-D shape.
        
    SQUISH HELP FILE:
    Custom deformations.
    The Custom option lets you set the parameters used by the custom deformations. There are four parameters you can set.
        BndStretch
        BndCompress
        InteriorStretch
        InteriorCompress
    
    The default value for these parameters is 1 and they can be set to any positive number.
    A larger value reduces the amount of the specified deformation compared to what happens 
    when all four parameters are equal. 
    
    For example, if you want to severely limit interior expansion, you could do something like:
    BndStretch=1
    BndCompress=1
    InteriorStretch=1
    InteriorCompress=100
    
    If you want to preserve boundary lengths you could use the settings:
    BndStretch=10
    BndCompress=10
    InteriorStretch=1
    InteriorCompress=1
    """
    
    
    
    custom_1 = 'BndStretch=10  BndCompress=10  InteriorStretch=1 InteriorCompress=1 '    
    
    cmd_str = 'Squish ' \
        'SplitSeams=Yes ' \
        'PreserveBoundary=Yes ' \
        'Deformation CustomSetup A {} _Enter ' \
        'Material=Rigid ' \
        'Outside=Up '  \
        'Decorate=No ' \
        'Enter'
        
    cmd_str = cmd_str.format(custom_1)
    
    rs.UnselectAllObjects()
    rs.SelectObjects(objs)
    rc = rs.Command(cmd_str,echo=False)
    rs.UnselectAllObjects()
    
    if rc: 
        result = rs.LastCreatedObjects()
        return result

HTH
-Willem

3 Likes