Hi, I’m writing a code with a conditional statement and I’m struggling to reference a Rhino Geometry surface in the GHPython script.
This is what I have,
I do not get the prompt to select the surface on rhino in line 14 “Select floorArea”
I’m now trying to reference it using Rhino geometry but I can’t figure out how to
Hello! I’m not sure why your script isn’t working as expected in Grasshopper, but I’ve identified a potential solution that might be helpful for you. Here’s a more detailed code snippet that could assist you in obtaining a selected mesh:
import Rhino
import scriptcontext as sc
# Get the active Grasshopper document
gh_doc = sc.doc
# Prompt the user to select a mesh
obj_ref = Rhino.Input.Custom.GetObject()
obj_ref.GeometryFilter = Rhino.DocObjects.ObjectType.Mesh
obj_ref.Get()
# Check if the user made a selection
if obj_ref.CommandResult() == Rhino.Commands.Result.Success:
selected_mesh = obj_ref.Object(0).Mesh()
In this script, Rhino library is used to interact with Grasshopper. The code prompts the user to select a mesh, and if the selection is successful, it stores the selected mesh in the selected_mesh
variable. Make sure to integrate this code into your solution and see if it resolves the issue you are facing.