Grasshopper

algorithmic modeling for Rhino

GHPython, Select Surface based on Boolean Operation

Hello All,

I am relatively new to GHPython and Python Coding, in general. I wanted to create a Boolean Trigger/Toggle operation that if triggered to 'True' it would prompt the user to select a single surface from the Rhino document and output to use it through the rest of the Grasshopper file. I am not sure if I am approaching this correctly, however I have attached the code I have tried to run based on my investigations about python:

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino as rc

if x:
srf_obj = rs.GetObject("Select the Surface", False, True)
a = srf_obj
print a
else:
a = "False"
print a

I would appreciate any guidance, thank you.

Views: 398

Replies to This Discussion

I figured it out, however here is the ghpython script if anyone is interested in using it:

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino

if x:
sc.doc = Rhino.RhinoDoc.ActiveDoc
sel_srf = rs.GetObject("Select a single surface", 8, False, True)
sc.doc = ghdoc
a = sel_srf
print a
else:
a = "False"
print a

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service