1 - Open existing .3dm file
2 - Get objects from a specific layer
3 - Select a specific object
4- generate some random points in space
5 - determine if any of these points are within object from step 3
I have been able to do this with rhinosyntax and Iron python, but I was hoping to work with some other python packages in further steps (IE numpy and scipy). Additionally I have hundreds of created rhino files to work with.
the bounding box may be problematic, as the shape may be fairly complex (it is a building shape, that has overhangs etc…) so the bounding box volume may be larger than the shape.
I had good sucess with the rhinoscriptsyntax IsPointInSurface. is ther a Rhino.compute similar function available?
I have managed to work up a work flow, with some caveats. So far I manually set the url of the object I want to investigate in the model, which I can then find via the objects table.
import rhino3dm as rh
model = rh.File3dm.Read(file)
object_table = model.Objects # generate object table
for object in object_table:
# find desired object from non null url attribute.
# Have to manually set this in the model
if len(object.Attributes.Url) > 0:
model_brep = object
point_eval = rh.Point3d(1,4,5)
import compute_rhino.Brep
in_object_status = compute_rhino.Brep.IsPointInside(model_brep.Geometry,point_eval, 0.01, True)
As you can tell I am skipping the “layer” portion I mentioned before. I would still like the ability to find objects on a specific layer. Do you have any insight into this?