Grasshopper

algorithmic modeling for Rhino

Getting conversion to Point3D error when I try to use rs.BoundingBox in GH

What I first do is collect the geometry that I'd like to determine the bounding box of using the Geometry component, and I try to use the GUIDs (inside a list) as input to the rs.BoundingBox() function. However, I sometimes get the following error:

I'm not entirely sure what's causing this, as I've tried using rs.BoundingBox() on the same geometry (collected using rs.GetObjects()) with the EditPythonScript editor and there appears to be no problem. This error only pops up when I use GH, and not all the time. What do I need to do to the geometry beforehand to prevent this error from happening? I am mostly dealing with points and curves (line curves, polycurves)

Views: 537

Replies to This Discussion

It appears to be more a conversion error from GUID (which when I checked for the object type, sometimes (!!!) returns None). I've solved it somewhat by using Rhino geometry instead and feeding those into the Bounding Box command, which returns about the same result I needed. 

Hmm, I'm not sure if I'm doing that actually. The gh file is attached here to help clear things up. What's supposed to happen here is that I have a conversion code that takes Geometry and converts it into a custom object (this conversion is done by the component 'Geometry to Shape'). The output is fed into the next component 'Apply All', where R is a set of instructions that change the custom object.

I was getting the error around line 47, when I try to use a list of GUIDs to get their collective bounding box. Sometimes it works, sometimes the conversion error we're discussing here happens. So far, I've tried using the Rhino geometry objects instead, and that seems to work? So I'm not sure what's going on with the GUID.

Attachments:

How would I go about getting the Bounding Box for a set of specific Rhino geometries (not all that are present in the active doc), rather than just a single geometry every time? This is what I perceive to be the advantage of using rs in this case, since using GetBoundingBox only allows for single item bounding boxes. 

Thanks for the suggestion, With that in mind, one thing I've been encountering is that when I look for the corresponding geometry in the Rhino document for a specific GUID, I sometimes get None returned. The objects exist in the Rhino view port, and I don't get errors when I use rs methods. What am I overlooking here?

To illustrate, when I use the command rhObj = rhdoc.Objects.Find(obj) where obj is a GUID, it returns None. 

Samples below. My goal is to use the geometry component specifically as the input to the custom component, rather than have to pass it through GUIDs or other components.

Attachments:

I think I didn't see the second part of this message. Admittedly I'm more well versed in Python rather than in RhinoCommon, so I'm still pretty much a beginner. 

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service