Rhino has the _UntrimHoles command with an option to remove all holes below a MaximumEdgeLength. Its a nice command but works only when you select a face of a brep.
I like to have this option available for the whole brep and even better for all the breps with I select.
I made a python script with some rhinocommon commands to get all the innerloops of the brep with a MaximumEdgeLength. And show them on the screen. But what I like is to delete these inner loops from the brep. There is a methode to cull these loops. ( Brep.CullUnusedLoops) but the I have to set the m_loop_index to -1 how can I do this in the script?
BrepRemoveSmallHoles.py (2.3 KB)
I already made a script that did the job but isn’t error free and not very fast.
holesinbrep.3dm (350.4 KB)
holes1.py (4.7 KB)
What is the brep returned from this method?
Does it remove adjacent faces?
I get a null with the attached test case, any idea why?
180626 brep remove holes.gh (27.9 KB)
Is there other sample code for removing a loop from two faces, removing the obsolete face and obtaining a valid brep?
If you want to remove all holes, which is what your sample appears to be doing, then you can just do this:
private void RunScript(Brep x, double y, ref object A)
if (null != x)
A = x.RemoveHoles(y);
Does this help?
Thanks, that will meet my needs for the time being (I hadn’t noticed that method).
I still think the face method could do with some more explanation, particularly about what the resulting Brep represents.
BrepFace.RemoveHoles removes all of the inner loops (e.g. holes) from a Brep face. The function returns the newly constructed Brep sans the face loops.
Does this help?
I still have some problems with the BrepFace.RemoveHoles command.
I modified the python file but the holes are not gone.
Do I miss some information?
BrepRemoveSmallHoles1.py (1.7 KB)
Notice that BrepFace.RemoveHoles returns a new
Brep, which you are doing nothing with.
Perhaps you should just use Brep.RemoveHoles.
It works. I forgot to set the result to a variable. It delete all the holes.
BrepRemoveSmallHoles3.py (1.6 KB)
But what if I only want to delete a loop with a small edgelength like the Rhino _UntrimHoles command does.
It has an option MaximumEdgeLength with check the length of a hole edge and remove it when it is smaller than the given value. It should be nice that the Brep.RemoveHoles has an option with maximum edgelength to remove holes smaller than the given value.
An other way around may be is that I have the possibility to remove the (inner) loops (holes) I like.
Than I have the possibility to remove inner loops (holes) based on my own criteria.
I’ve added an additional
Brep.RemoveHoles override that allows you to specify the inner loops you want removed.
You’ll see this new override appear in Rhino 6 SR8.
You’ll need to write the logic which determines which loops you want, based on the length.
Hope this helps.
This helps me a lot and save us a lot of time by simplifying and optimizing very detailed equipment models from our suppliers.
Thanks in advance,