Workflow with rhino 3dm

Hey there,

I am trying to work out the following problem:

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.

Any help or pointers appreciated.

Dan

Hi Dan,
I’m working on a sample for this. As for step (5) would it be good enough to determine if the point were in an object’s bounding box?

Hey Steve,

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?

Thanks

Dan

Hey Steve,

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?

Thanks

Dan