Grasshopper

algorithmic modeling for Rhino

Hi all,

Don't check in here very often anymore (sorry)...  I wanted to project some curves to a terrain mesh, and I was sure that the Project component would do it...  Nope, only takes BReps to project to...  Didn't find any other way to do it with stock GH...  Am I being really dumb (probably) and did I miss something obvious? 

I did with a Python component - its a 2 liner...

import rhinoscriptsyntax as rs
projCrv=rs.ProjectCurveToMesh (crv, mesh, vec)

I was just surprised that it wasn't already there in GH... 

However, although the above works fine with multiple curves and one mesh, or one curve and multiple meshes, it does not work correctly with multiple curves and multiple meshes...  I guess the python component won't automatically create the implied double For loops?

Cheers,

--Mitch

Views: 11480

Replies to This Discussion

Hi Mitch,

there's loads of SDK methods that haven't (yet) been wrapped for Grasshopper. This appears to be one of them.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

OK, thanks, as long as I haven't missed something obvious...  I'm going to check out how to get the Python component working with multiple curve+mesh inputs...

Cheers, --Mitch

Hi Mitch,

one way would be to accept both inputs as lists and do the double loop yourself. Otherwise, the usual cross reference method in Grasshopper should work, too (if that's the looping logic you need).

Thanks,

- Giulio
________________
giulio@mcneel.com

Hi Giulio,

Yeah, thanks, that finally occurred to me as I was driving home from work... :-) 

I'd completely forgotten that those choices were also available in the Python component.

Cheers, --Mitch

Did this work for you? I haven't had any luck making this Python Script work.

import rhinoscriptsyntax as rs
projCrv = rs.ProjectCurveToMesh (crv1, mesh1, (0,0,-1))

I get this error:

{0;0}
0. Runtime error (TypeErrorException): iteration over non-sequence of type NoneType
1. Traceback:
line 2299, in ProjectCurveToMesh, "C:\Users\alex\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\curve.py"
line 2, in script

Thanks,

Alex

Attachments:

Yeah, I don't know what's going on here, I get the same.  It works fine with a normal Python script (not in GH) but does not seem to be working anymore inside GH (latest GH and Python plug-ins)

I am having the same problem in the grasshopper component with 

rs.ProjectPointToSurface

the error is similar.

Runtime error (TypeErrorException): iteration over non-sequence of type PlaneSurface

Did you manage to solve it? I really need to get it working...Grr

No luck. Could try using closest point, but it's only going to work in some circumstances.

Alright. Here's a way to work around this:

Use intersect mesh| ray.

Hi to everybody!

I am trying to do the same (project a curve or a line to a mesh) as Mitch, but I am scripting my component with C# not with Python:

I am wondering whether RhinoCommon library has such function, because I cuoldn't find it.

The only similar class I can find is pull to mesh a polycurve. Is this true or am I missing something?

thanks for the help

matteo

That should be :

Rhino.Geometry.Curve.ProjectToMesh(curves, meshes, direction, tolerance)

Cheers,--Mitch

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2022   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service