according to the docs, Brep.Trim(Brep, Double) should remove parts that are in normal direction of the cutter. However, if used with a flipped Brep as cutter, the opposite part is removed.
Example: TrimBrep.py (1008 Bytes)
IMHO this is either a bug or should be clearly stated in the docs.
Workaround: An additional BrepFaceList.Flip(True) gets rid of the flipped state and leads to the intended results.
I’m not very familiar with python, yet:
Reading the file, could it be that the second time you are trimming with the initial brep2 and not with the filled version?
doc.Objects.Add(brep2) don’t you need to collect the newly added geometry ID?
thanks for your suggestions, but in this case I am directly working with RhinoCommon objects and only add the results (and the flipped brep2) to the document to be able to see what I’m working with. That’s why I don’t collect the new GUID.
And Brep.Flip() works in place, that’s why I am using the same instance again for the second test.
OK, it was a shot in the dark as I’m only familiar with RhinoScript.
Looks a little suspicious to me. Let me take a look under the hood…
It appears that the function is looking at the surface normal instead of the direction of the face, which can be different. I’ve got this in the to-do list for a future service release.
I know it’s been more than three years of this post but I’ve found the same problem in the latest installation of RhinoCommon although in my case I’m creating the plugin running under a VB project.
Does any body know if this was solved?
I believe the above mentioned fix was made in the Rhino WIP. Have you tried it?
Welcome to Serengeti
The link you’ve sent is from 2014, and I’ve installed RhinoCommon two and half months ago, so… I don’t think I’m running an old version.
In any case, How do I check it?
I’ll download the latest version and re-install… tell you later
Dim strObject, strCutter
strObject = Rhino.GetObject("Select surface or polysurface to trim")
If Not IsNull(strObject) Then
strCutter = Rhino.GetObject("Select cutting surface or polysurface")
If Not IsNull(strCutter) Then
Rhino.TrimBrep strObject, strCutter
It’s always trim in I don’t like. The same picture 2. But i want to cutting in " Want to trim" the same picture 1.
I don’t know about it. Please help me.
Trimming relies on the natural surface normal of the surfaces involved. With open surfaces, unless you know exactly which way that points for each object, your trim will always be unpredictable. I suggest you use Split instead and then find a way to test which parts of the surface you want to keep and which you want to discard…
When I use SplitBrep it creat 2 parts of the surface. But i don’t know identifier of 2 parts. Please help me.
Dim strBrep, strCutter, d
strBrep = Rhino.GetObject("Select brep to split", 24)
strCutter = Rhino.GetObject("Select cutting brep", 24)
d = Rhino.SplitBrep(strBrep, strCutter, True)
I want to delete 1 parts of “d” which created from splitBrep.