Extend specific Edges of a surface

Hello Community!

I run in a problem, which I don’t know how to solve. The task is pretty simple,
extend surfaces to a specific boundary. Only specific edges should extend.
With a C# script, I extracted the desired edges of the surfaces, but for the Extend-Method I need the IsoStatus-Flag of the surfaces. It should work with the IsIsoParametric-Method, but I don’t get the correct flags.

C#-Snippet:

Curve y = y; // just for the understanding 
DataTree<Brep> x = x ; // just for the understanding 

Plane yPlane = new Plane(AreaMassProperties.Compute(y).Centroid, Vector3d.ZAxis);

for(int i = 0 ; i < x.BranchCount ; i++)
{
  for(int j = 0 ; j < x.Branch(i).Count;j++)
  {

    Brep curSrf = x.Branch(i)[j];

    int counter = 0;

    for(int k = 0 ; k < curSrf.Edges.Count;k++)
    {
      double t = 0;

      Curve curEdge = curSrf.Edges[k].DuplicateCurve();
      curEdge.Transform(Transform.PlanarProjection(yPlane));
      y.ClosestPoint(curEdge.PointAtLength(curEdge.GetLength() / 2), out t);

      if(y.PointAt(t).DistanceTo(curEdge.PointAtLength(curEdge.GetLength() / 2)) < 0.50)
      {
        var iso = curSrf.Faces[0].IsIsoparametric(curEdge);
        IsoStat.Add(iso);
        Print(iso.ToString()); // prints "None"
        counter++; /// use counter if a surface is double-hitted , maybe a while-loop to extend multiple times
      }
    }

What do I wrong ?:smiley:

Thank you very much!
greetings,
Bumaye
Discourse_ExtendSrf-Extend.gh (19.4 KB)

Hi @bumaye,

I’m not a C# aficionado, but I guess extending won’t solve this properly?

Instead, you could search for the closest point of the mid point (blue) of each outside surface edge on the boundary polygon. If the distance between this mid and closest point is 0.0 or very near to 0.0, the surface already touches the boundary and you can move on to the next edge.
Otherwise, get the directional vector between the mid and closest point, as well as the directional vector between mid and closest point of the next edge to evaluate and previous already evaluated edge (v0, v1, v2, etc.).
It the previous vector is parallel to the current vector (e.g. v0 || v1), you can move the edge start point with that vector. Otherwise, you need to calculate the average vector between the two and use this one to move the point. The same applies for the end point (e.g. v1 not || v2)!
The moved end points can be used to construct a new line/edge, and you can loft the old and new edge to get the “extension” surface (green).

Furthermore, you might need some extra rules or strategies to skip edges that you don’t want to “extrude”.