The overloads include a couple of ‘out’ parameters and IIRC, I have to feed it some input types to get the out parameters - using clr.Strongbox. But I am not having much luck here, all I have is the test point and the mesh. Can someone remind me the correct syntax to use here? Thx.
import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
import clr
def DoSomething():
mesh_id = rs.GetObject("Select mesh", 32, True, False)
if not mesh_id: return
test_point = rs.GetPoint("Point")
if not test_point: return
m = rs.coercemesh(mesh_id, True)
p = clr.StrongBox[Rhino.Geometry.Point3d]()
n = clr.StrongBox[Rhino.Geometry.Vector3d]()
face_index = Rhino.Geometry.Mesh.ClosestPoint(m, test_point, p, n, 0.0)
if not face_index: return
line = Rhino.Geometry.Line(p.Value, n.Value, 10)
scriptcontext.doc.Objects.AddLine(line)
scriptcontext.doc.Views.Redraw()
DoSomething()
That’s pretty funny. I had basically the same as you, but I tried putting all sorts of things in the parentheses at the end of the strongbox lines - thinking that it needed some kind of value in there… The only thing I didn’t try was putting nothing…