how i can grouped a spliting object for one side of the cutting surface in python
Please provide a geometry sample of what you re trying to get. A 3dm file.
And please your script- how far did you manage to solve it.
I can imagine 2 simple approaches:
After splitting, use some sample points from the new geometry, get the closest point on the surface, check for minimum distance,
skip points that are on the splitting surface. create a vector from the 2 points and compare with the normal direction.
Take edges/ curve start / end / mid point for a start.
If no result create a rough mesh and use a few random points from it.
I would try this approach first.
If you find special case that do not filter correct post them here.
Depending on the geometry you re using it also might be a nice, visual approach to create 2 helper offset surfaces, one to each side, for better performance use rough tolerance for the offset
Now you can check for intersections…
Maybe this helps- kind regards-tom
for fil 1 the script is working but for file 2 the green surface is grouped wrong
1.3dm (605.3 KB)
2.3dm (392.2 KB)
group by split surface.py (1.5 KB)
for i, obj in enumerate(split_results):
# Add objects to alternating groups
if i % 2 == 0:
rs.AddObjectToGroup(obj, group_1)
else:
rs.AddObjectToGroup(obj, group_2)
the logic of your script, does not look robust at all:
You decide on even / odd wether to assign to each of the groups.
This seems to work if all splits resulted in two objects - one above, one below - but even this is not guaranteed.
for what you re after - I recommend to work with rhinocommon, not with rhinoscriptsyntax.
start with this sample:
split the breps one by one with
https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.brep/split
query all edges:
https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.brep/edges
see above post…
what s the context of your script ? are you just trying to learn things ? is it a professional or educational project ? just curious.
kind regards - tom
when i want to delete a group of objet by surface it take a long time to select one by one from the object so i want to make this script to split all object and divided in two group so i can delete one of this group
but what s the context of your work ? or of this workflow ? is it more academic curiosity to make the workflow nicer, or are you building city-models every day …?
i working in shoe manufacturer
split by Surface.py (2.4 KB)
this is the last modified script i think it working good