Grasshopper

algorithmic modeling for Rhino

Using squish from rhino with a C#, VB or python component

Hi,

I am trying to get the squish command from rhino. I know it can be called out using a python script, but I am quite new to scripting but I cant find the squish command in the rhino script syntax.

Any help would be appreciated

Omar

Views: 8742

Replies to This Discussion

Hi Omar,

There's no Squish rhinosciptsyntax function nor RhinoCommon method.
The only thing you can do is to call Rhino's "Squish" command.

Check the attached python example.

Attachments:

Thanks djordje,

You've been of great help to me. If you wouldn't mind explaining how to select multiple surfaces instead of id of the object in the python component.

Here is the file I am trying to work on.

By the way is there any good tutorials for python scripting online. I was looking at the geometry depth website and it looks good. Do you know if it is worth subscription?

Thanks

Attachments:

Nice shape. You modeled it using T-splines?
You can't use Squish command to flatten this shape. It only takes into account surfaces (meaning parts of your shape).

I haven't tried using geometry depth, but if Giulio is one of the tutors (he's one of two guys behind the ghpython component) then it has to be a good one.
For rhinoscriptsyntax and python in general, you can also check the Rhino Python primer.

Thanks.

A friend actually modelled it in Maya, and I am trying to get it fabricated. But I did use Tsplines to convert the mesh into surfaces. I understand that squish will not work on solids. I had deconstructed the brep into smaller surfaces. I was wondering how to get them referenced in the python code instead of using the object ID (currently you are using the _selID command). Is there any way to select objects from grasshopper or do you need to select objects from the rhino viewport (like baked items) when you use the call command. See my grasshopper script, you will understand what I am trying to do.

But I guess as it uses a rhino call command it will squish all the surfaces at the origin in one go and it might be confusing to sort out which one is which. I will learn a bit of python and see if I can get it to squish the objects and place it on a grid. Its so easy to do in grasshopper, it just doesn't come as intuitively when I code. 

By the way I subscribed to the geometry depth class and it is quite interesting, well worth the money.

Thanks

rs.Command function does not work on grasshopper objects, only on Rhino objects (meaning you would have to bake your grasshopper object, and reference it to grasshopper with "guid" parameter, or simply use existing Rhino objects and then reference it to grasshopper).

Check the attached file for an example.

Attachments:

Thanks Djordje,

I was playing around with the code. I have turned decorate on in the squish command. It works quite well and then I have got both the squished surface and the decorated pattern to move along the array. But the error is that the reference pattern on the original surface also moves.

This is the modified code

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

if squish:
sc.doc = Rhino.RhinoDoc.ActiveDoc
for i,id in enumerate(ids):
rs.Command("_-Squish _SelId %s _Decorate=Yes _Enter _Enter" % id)
squishedId = rs.LastCreatedObjects()
print squishedId
squishedIdMoved = rs.MoveObjects(squishedId, [i*20,0,0])
sc.doc = ghdoc

You can see clearly see what I mean on the new definition. Is there a way to solve this?

Attachments:

Hi Omar,
Check the attached file.

Attachments:

Thanks Djordje,

You are amazing  :)

Hi djordje,

Thanks for your script that helped me a lot. Is there any way to get the squished surface as an output so I can modify it in GH ?

Thank you

Hi Julien,

Check the attached two files below.
Regards.

Attachments:

Hi, djordje!
How to insert squish settings? (SplitSeams, PreserveBoundary, etc.)
And also select points and curves?

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service