Squish + curves via Python

Hi, I am trying to automate the “squish” command on multiple meshes, but I would need for every mesh to transform also a set of curves (as the command normally allow as second input). While I manage squishing the mesh I can’t find a way to select the curves.

This is where I got to with the code:

import rhinoscriptsyntax as rs

meshSurface = rs.GetObject("mesh",32)
crvs = rs.GetObjects("crvs", 4)

rs.Command("_-Squish _SelId %s _Decorate=Yes _Enter _SelId %s _Enter " % (meshSurface,crvs), False)

What I have and what I would like to achieve ( file attached as well)

I guess the issue is the string I have to input in rs.command to be able to select multiple ids for the curves after the mesh is selected. Any suggestions on how to do this?

as always many many thanks in advance

squish with crvs.3dm (417.3 KB)

This chain might be helpful? How to call squish command in Rhino Script - #2 by Willem

This might even be easier, i was able to use it to squish both a surface and associated curve:

Thanks Henry, I had seen these but they don’t seem to address my issue, namely how to select the curves to be squished together with the main geometry. Any ideas?

Maybe add the guids as a separate input to the list of commands using string formatting %?
(I have to step away from the computer for a while, but will try this when I get back)

That is what I did in my code above, but it doesn’t seem to work:

```
rs.Command("_-Squish _SelId %s _Decorate=Yes _Enter _SelId %s _Enter " % (meshSurface,crvs), False)

I got it to work for one curve:


Have to change the order of the ‘SelId’ it seems?
Results:
image
Would have to put some thinking into how to enumerate for all the curves (apart from some bruteforce methods)

Thanks Henry, I actually found a way eventually!

import rhinoscriptsyntax as rs

meshSurface = rs.GetObject("mesh",32)
crvs = rs.GetObjects("crvs", 4)

curvesInput = "".join("_SelID " + str(crv) for crv in crvs)

rs.Command("_-Squish _SelID %s _Decorate=Yes %s _Enter _Enter" % (meshSurface,curvesInput), False)

Hi, I want to squish mesh in a tree, points, and curves on mesh can group together. could you share me GH file, Thanks a lot!