Is there a way to reverse edge of a brep? I am trying to make a c# component that creates Sweep2 similar to what rhino does - keeping edges for continuity. So i am giving it brep and edge indices of that brep to not lose edges by converting them to curves.
But the problem is - i do not see any method for reversing edges (even though we have methods for splitting and joining edges). So my sweep comes out wrong.
I think you might have to duplicate the edge to a curve.
Then flip the curve and try to re-construct the brep from this curve and the rest of the edges.
nevermind, it seems that i got the wrong idea in the first place. Sweep2 does not have inbuilt continuity matching, it uses System.Boolean CreateFromMatch(BrepEdge edge, IEnumerable targetCurves, MatchSrfSettings settings, out Brep matched, out Brep target)
right after it. So it seems to be the way in gh too.
This worked exactly as you described. Replacing edge helps, you solved it.
After replacing edge with flipped curve, it breaks brep - but edge is flipped successfully. So i just apply repair, and edge obtains reverse flag, and brep becomes valid.
I am leaving component here in case someone needs it
Hi Volker! Thank you for your take. No, that was not the task:) I was testing what surface creating components in api will change their outputs if you give them edge instead of curve as input. And for some components i needed to flip edge as you would flip curve, because they were producing incorrect results.
Because my work is often related with making parts with good continuity, i am trying to explore workflows that would allow me to create such parts in grasshopper. So far, I found NetworkSurface to be able to react with continuous results. For that i give it brep, and indices of edges i want to use for surface creation. Its the same in rhino - if you try to create network surface with edges and curves, you will see that chosing edges allows you to have continuity, while curves do not support that. Because edges are part of brep, and allow method’s solver to access information such as adjacent surface and its normals
The second might not look the best, i made its 4th curve a line on purpose. But it is the key for creation of parts with continuity between surfaces. You can see that it reacts to surface normals
I would have assumed that Network Surface treats BRep edges just like any curve, using its perp frames to make the surface. I do know that you need to be careful about pushing curves through curve containers because you do not necessarily get the same curve back… or maybe this was just as I was pushing a curve through a line container and I got a different domain.
take a note, that both grasshopper component and c# component use same method. c# does not deconstruct brep or does anything with it. Only difference is that inside c# component we can use brep edge data type. Because as soon as you take edges out of brep into grasshopper, it becomes simple curve.
That happens because inputs to components have curve input data type. I would assume it casts edges to curves on the entrance to the component. Iater i will try to use eges by treating them as objects