Grasshopper

algorithmic modeling for Rhino

Hi all,

I'm working with GHPython and I would like to evaluate the center of a referenced surface and then do other stuffs (please see attached files).

The problem is that when I access to the rs.SurfaceAreaCentroid(surface) it returns a "Null" value.

Seems that GhPy can't access to the surface - object ID.

Is there any work-around to avoid this problem?

Thanks in advance.

Views: 479

Attachments:

Replies to This Discussion

Hi J

this is an issue deriving from using RhinoScriptSyntax mixed with RhinoCommon objects. In this case, it is the type hint 'Surface' that does not work with RhinoScriptSyntax. To fix this, just use the default hint: 'ghdoc objects when geometry (rhinoscriptsyntax)'. Then your script will work.

Secondly, please note that the output of these functions contains also the error value. So, you need to actually extract the first parameter out of the return value.

Finally, adding a little error checking might be useful to improve the script. See the attached file for examples.

I hope this helps,

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Attachments:

Problem solved!

Can I ask you what is the difference between RhinoScriptSyntax and RhinoCommon?

I searched in the RhinoPython Primer but I found no answer.

Thanks for your useful answer.

 Here is to introduce

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service