Grasshopper

algorithmic modeling for Rhino

Hello all!

I have a python script that creates a 3d metaball around points that I have. The output of this script are the points defining the mesh of the metaball. I need to create the mesh from these points. I can do it manually by selecting all the points and entering manually "MeshFromPoints" into the command line.

Is there a possibility to import this command into a python script as for example "import Rhino.Geomtry" or "import rhinoscriptsyntax" and then choose it from the drop down menu?

Thank You in advance!

Views: 613

Replies to This Discussion

Hi Rodion,

Every Rhino command can be called through rs.Command function.
You just need to supply the ids of your baked points (the ones you used to create the mesh by running the "MeshFromPoints" command). Here is an example:

import rhinoscriptsyntax as rs

# "ids" are Rhino guids of your baked points
if len(ids) > 2:
    commandString = "_-MeshFromPoints "
    for id in ids:
        commandString = commandString + "_SelId %s " % id
    commandString = commandString + "_Enter _Enter"
    rs.Command(commandString)

Hi Rodion,

It could be that your main function is returning grasshopper ids, but I can't tell without further looking at the file.

Can you attach your .gh file please?

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service