Trim Curve / Surface

Hi,

I got a dupborder and an intersection curve and I want to use the intersection to create a new curve, see example:

Whats the best way to approach this? Sometimes the intersection curve does not meet the “end” so thats why I want to combine it with the dupborder so I can create a trim crv see the black line:

P.s. Im doing this because I want to trim 2 breps at an intersection:

And thought it would be easiest with curves.

_ExtendCrvOnSrf?

ExtendCrvOnSrf will extend to the end of the surface and will make it trim more than it should. It should follow the surface back. If I look at the top side it should still look exactly the same but no overlapping elements that are trimmed on the intersection.

A good curve is also a dupborder from both connected by the intersection curve.
But I dont know how to filter it so I can get a new closed curve.

Any tips?

Anyone knows how to create the shorter curve?

I create a dupborder, intersection curve. Now I need to trim a part off over the curve and join the other 2 together. Ican’t get the trim part off. Any help?

This is what I do now:

Dim Cr() As Geometry.Curve = Nothing    
Dim Result As Boolean = Geometry.Intersect.Intersection.BrepBrep(Brep1, Brep2, 0.01, Cr, Nothing)
Dim Crv1 As Geometry.Curve = CreateDup(Brep1) 'dupborder function


For Each c As Geometry.Curve In Cr
    Dim cutParams As New List(Of Double)
    Dim c1Ints As Geometry.Intersect.CurveIntersections = Geometry.Intersect.Intersection.CurveCurve(Crv1, c, 0.01, 0.0)
    cutParams.AddRange(From e In c1Ints Where e.IsPoint Select e.ParameterA)
    cutParams.Sort()
    
    If cutParams.Count > 1 Then
        Dim TrimCrv() As Geometry.Curve = Crv1.Split({cutParams(0), cutParams(1)})
        Dim Crv2Use As Geometry.Curve = Nothing
        For Each crv As Geometry.Curve In TrimCrv
            If Crv2Use Is Nothing Then
                Crv2Use = crv
            Else
                If crv.GetLength > Crv2Use.GetLength Then
                    Crv2Use = crv
                End If
            End If
        Next
        Dim JoinedCrv() As Geometry.Curve = Geometry.Curve.JoinCurves({Crv2Use, c}, 0.01)
        Crv1 = JoinedCrv(0)
    End If
Next

but does nog get a new closed DupBorder! After the Trim the dupborder line splits in more lines. I guess the corners but If i join them together again after the trim nothing changes. I cant filter in X, Y or Z because that variables.