# Rebuilding a 2D Brep in 3D

Hello everyone,

I was wondering whether there is a possibility to rebuild an existing two-dimensional Brep with similar three-dimensional edges/guide curves.
The background is the following:
I have two-dimensional projections of three-dimensional curves (see picture in black) and would like to create a surface with the 2D curves (e.g. by using “Boundary Surface” or rather “Brep.CreatePlanarBreps()” in C#, green in the picture). After the 2D surface is created, I would like to “pull it into the 3D space” by exchanging the 2D edges/guide curves by their 3D equivalents.
Does anyone have any idea how this could be implemented (ideally in C#)? I already tried to use CreatePlanarBreps() to create the Brep in 2D and pulled it’s vertices into 3D. However, this resulted in some strange behaviour where the edge curves are still 2D, so I guess maybe I am missing some basic understanding of how the Breps are controlled. So references about this would also be much appreciated!
Mayn thanks in advance!

Does it have to be a surface or could it be a mesh?
If it were a mesh you could probably use Kangaroo to pull mesh edge vertices from the 2d curves up to the 3d curves and then relax the mesh to get the shape of the surface.

What’s the application here? Are you going to press the shapes out of sheet metal?

Thank you for the fast reply. It can also be a mesh. What specific functions would you recommend for the suggested approach?

In the end the part is supposed to be 3d printed.

Mesh it is, then.

I don’t understand why/how you need to “use” the flat brep/surface if the 3d curves hold all the information.

Here a solution using directly the 3d curves.
By re-using an old script from here, we can do this:

mesh stuff.gh (19.9 KB)

3 Likes

Thank you very much Riccardo!
I hoped that using a 2D surface would make it easier, because CreatePlanarBreps() does such a good job in creating surfaces, but your suggestion is just perfect. Exactly what I was searching for (even in C#!). Many thanks!

OK, perfect for a mesh approach then.
Can you upload an example file?
I would try the following workflow…

from 2d curves make a boundary surface.
Triremesh to create a mesh
Project naked vertices onto 3d curves
Create new mesh with 3d vertices
Use Kangaroo to smooth the mesh using Edge Lengths or Soap Film

If you upload a file we can help more.

Try plugging in your 2d and 3d curves into this gh file and then figure out the kangaroo bit… I always have to trial and error the kangaroo

2d_to_3d.gh (21.2 KB)

Patch could be another option:
patch.gh (6.7 KB)
(the order of the patches it splits it into might vary, so you may need to select a different one of the 3 items at the end)

1 Like

Many thanks for your suggestions and inspirations! Using Kangaroo sounds interesting, but I think for now I am quite happy with the C# approach Riccardo suggested (will keep testing it).
Are you still interested in a file? If yes, did you mean of the original problem or the chosen solution?

1 Like

the original 2d and 3d curves would be interesting to try my definition!

Alright, here you go. One minimal file with the curves!

create3DSurfFrom2D.gh (12.7 KB)

Weirdly, TriReMesh doesn’t seem to be able to handle the Boundary Surface created from the two 2d curves…

So I can’t test the rest of my idea!

At least you have a solution!

That’s an issue with trimmed surfaces Vs breps. Passing it through a ‘brep’ parameter component first fixes it.

1 Like

thanks

Just for fun I used the 2 curves to make this:

Even though it is a closed BRep it would require a resin printer to print - which I don’t have. An interesting point is the final SUnion takes less time to complete when the degree of the Nurbs curves is upped from 3 to 7 (8.2 sec vs 9.3 on my system.)

Resin1.gh (30.1 KB)

TriRemesh and Kangaroo does work but there is a weird little kink on one edge…

I really like how the SoapFilm goal works.

Of course, the other solutions are much simpler and make more sense but soap film is kinda cool!
2d_to_3d.gh (24.7 KB)

2 Likes

Oh wow, that is definitively from a visual point of view the most appealing solution!
And very inspiring to see the different approaches. Thank you very much!

1 Like