STL to STEP Lossless

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
fosselius
Posts: 344
Joined: Sat Apr 23, 2016 10:03 am

Re: STL to STEP Lossless

Postby fosselius » Tue Apr 16, 2019 6:50 pm

jmaustpc wrote:
Tue Apr 16, 2019 6:52 am
adilgamedev wrote:
Tue Apr 16, 2019 1:08 am
Hi guys, I'm a 3D Artist who was given the task of converting an STL (3D Scanned) file to STEP file.
In this case the stl came from a 3d scanner. It's not a degraded file exported from a CAD format like we normally see.
my bet is on raw voxel data that just got "filled" with triangles to create a surface.

maybe: http://www.meshlab.net

see: https://www.google.com/amp/s/www.resear ... _Model/amp
wmayer
Site Admin
Posts: 14893
Joined: Thu Feb 19, 2009 10:32 am

Re: STL to STEP Lossless

Postby wmayer » Thu Apr 18, 2019 11:19 am

adilgamedev wrote:My new step (or igs) file almost always becomes lower quality after the conversion and I want to ask, how do I keep the smooth original mesh of the stl file so when I convert to the solid, it becomes exactly the same (visually) but just a solid that can be exported as a step file?
A mesh with curved surfaces can never be smooth, it can only look smooth. The smooth appearance can be achieved with some shading tricks where for the vertexes a normal is defined (built from the adjacent triangles). For more information search for "flat shading" vs. "Phong shading".
jimaustpc wrote:By the way, I think those 3d scanners can mostly at least, be set to produce a "points cloud" rather than an STL file, in fact they likely produce the STL from a points cloud internally or at least fro ma set of points.
Converting a mesh to a point cloud is a trivial step as you can use its vertexes. However, when trying to reverse-engineer a CAD model the mesh is much more helpful than a point cloud because it offers additional information about the topology and the surface normals.
It is not likely that doing would help much in complex cases, but then again perhaps it could. It may be able to provide points from which you could create a b-spline or a b-spline surface. Doing so would be a lot of work if the model is complex.
The basic idea of the reverse-engineering process is to split a mesh into several segments (e.g. planar, cylindrical, spherical, free-form) and then compute one surface for each segment. Usually the surfaces should be a bit bigger than a segment so that adjacent surfaces intersect. Afterwards they can be trimmed to each other with CAD utilities.

The splitting of the mesh into segments can be done by computing the major and minor curvature for each vertex. Based on the values it's very easy to classify them into planar (major and minor curvature are zero), cylindrical (minor curvature is zero and major curvature > zero) or spherical (major = minor curvature > zero) regions.
An alternative way requires some interaction by the user where he defines what surface is expected and selects a start facet or region (the so called seed) and a region-growing algorithm collects all adjacent facets that can be considered to be part of the surface.
jmaustpc
Posts: 9566
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: STL to STEP Lossless

Postby jmaustpc » Thu Apr 18, 2019 1:57 pm

wmayer wrote:
Thu Apr 18, 2019 11:19 am
The basic idea of the reverse-engineering process is to split a mesh into several segments (e.g. planar, cylindrical, spherical, free-form) and then compute one surface for each segment. Usually the surfaces should be a bit bigger than a segment so that adjacent surfaces intersect. Afterwards they can be trimmed to each other with CAD utilities.

The splitting of the mesh into segments can be done by computing the major and minor curvature for each vertex. Based on the values it's very easy to classify them into planar (major and minor curvature are zero), cylindrical (minor curvature is zero and major curvature > zero) or spherical (major = minor curvature > zero
Hi Werner, is this the stuff you were saying you might like to work on sometime if you get time? If so, this sounds like it would be a very popular useful feature.
Jim
adilgamedev
Posts: 6
Joined: Tue Apr 16, 2019 12:55 am

Re: STL to STEP Lossless

Postby adilgamedev » Wed May 01, 2019 2:12 am

Good Evening guys,

First of all, I want to heavily heavily apologize for coming back after like half a month, the reason why I didn't reply was because I discovered a dos program that at least let me convert stl to stp files but sadly I still got the same result.

I actually gave up and sent it to my client, but I had another problem (models were able to be opened in max but client couldn't access them)

I'm gonna now clarify the kind of model I was given to convert.

To avoid problems in the future, I was given stl files of teeth which were high quality (as checked out in max with smoothing and whatnot) but when I was given the original stps the client gave me, the problem was they felt like a low poly model that you would've baked a normal map onto lol (I'm more of a game artist and all that so forgive me for not understanding everything in stl and stp files).

I'm aware 3Ds Max isn't a nurb program so doing stp files there isn't going to work, but I'll use a screenshot from 3Ds Max to show the original stl model, the client's stp file, and the stp file i made (from left to right)

Basically,
Image
Image
Image
Image

Purple = Client's stl I have to convert
Bluish Green = Original STP client has a problem with
Red = Mine I converted successfully

I have the wireframe too in the fourth image to show.

Generally I also want to thank you people for replies, and my apologies for not replying to all.
kisolre
Posts: 1360
Joined: Wed Nov 21, 2018 1:13 pm

Re: STL to STEP Lossless

Postby kisolre » Wed May 01, 2019 6:57 am

Looking at your images the final goal is to make an extention to the tooth? Why do you (your client) actualy need that STP file? To make modifications? To 3dprint a insert for a mold? ithis was some mechamical part that you need to recreate - Ok, But this is like - I have a nice 3d scan of a broken tree trunk in the forest, how to convert it to STEP file - why? If we knew the final goal we (probably not me specificaly) could give better suggestions how to reach it.
adilgamedev
Posts: 6
Joined: Tue Apr 16, 2019 12:55 am

Re: STL to STEP Lossless

Postby adilgamedev » Sat May 04, 2019 2:19 am

I honestly do not know what his plan is, but I'm assuming it's to make 3D printed dentures that can function as he told me that last time.

Image
Image

This is what he sent me today telling me the STP files I sent him were in "mesh format" even though I converted them to a solid format.

I also heavily apologize for being slightly confusing/ getting confused as this is my first time I'm working with solids and not being familiar with file formats.

I'm just confused on how I can make solid stp files that can open.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: STL to STEP Lossless

Postby NormandC » Sat May 04, 2019 4:37 pm

If the end goal is 3D printing then going to a STEP solid is a needless, useless and wasteful intermediary step, because 3D printing still relies on meshes, the STEP file would have to be converted back to STL. There must be a different reason why your client wants a STEP file.

adilgamedev wrote:
Sat May 04, 2019 2:19 am
This is what he sent me today telling me the STP files I sent him were in "mesh format" even though I converted them to a solid format.
Converting meshes to solid in FreeCAD does not turn them into real CAD models. A CAD (or B-rep) model is made of mathematically true faces which can be analytic or algorithmic. A polygon mesh (like STL) is just an approximation using a bunch of triangles.

To get a real B-rep model from the scanned data, you have no choice but to reconstruct it from scratch using surface tools that FreeCAD does not currently have; there are a few add-ons in the Addon manager that have such advanced tools, but I have not used them.
jmaustpc
Posts: 9566
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: STL to STEP Lossless

Postby jmaustpc » Sat May 04, 2019 5:50 pm

adilgamedev wrote:
Sat May 04, 2019 2:19 am
I'm just confused on how I can make solid stp files that can open.
what do you mean by "can open"? Do you mean that will work in a given application?

If you look at your pictures the teeth look hollow, a shape like a cup, rather than a solid filled in lump of tooth. Is that what your client means by them still being a mesh, or is it like Norm said that the "curved faces" are in fact still just made up from a lot of small triangular faces (and hence not real curves just approximations)?
adilgamedev
Posts: 6
Joined: Tue Apr 16, 2019 12:55 am

Re: STL to STEP Lossless

Postby adilgamedev » Sun May 05, 2019 6:49 am

NormandC wrote:
Sat May 04, 2019 4:37 pm
If the end goal is 3D printing then going to a STEP solid is a needless, useless and wasteful intermediary step, because 3D printing still relies on meshes, the STEP file would have to be converted back to STL. There must be a different reason why your client wants a STEP file.

adilgamedev wrote:
Sat May 04, 2019 2:19 am
This is what he sent me today telling me the STP files I sent him were in "mesh format" even though I converted them to a solid format.
Converting meshes to solid in FreeCAD does not turn them into real CAD models. A CAD (or B-rep) model is made of mathematically true faces which can be analytic or algorithmic. A polygon mesh (like STL) is just an approximation using a bunch of triangles.

To get a real B-rep model from the scanned data, you have no choice but to reconstruct it from scratch using surface tools that FreeCAD does not currently have; there are a few add-ons in the Addon manager that have such advanced tools, but I have not used them.
Thing is, client literally told me he wants them to be 3D printable and just gave that, all in all what you're telling me is in order for me to make 100% lossless solid models based off those teeth is to recreate it using solid tools to make it able to be a step file?

Looks like I'll have to contact my client for that, and again I am sorry if I was being confusing or confused due to my inexperience with working with solids/3d printing due to my background being a different 3D.
wmayer
Site Admin
Posts: 14893
Joined: Thu Feb 19, 2009 10:32 am

Re: STL to STEP Lossless

Postby wmayer » Sun May 05, 2019 9:36 am

Thing is, client literally told me he wants them to be 3D printable and just gave that
If that's the only goal then as Normand said there is no need to create a B-REP model (STEP) from a mesh (STL) -- just stay at the mesh format.

All what is needed to make the mesh 3d printable is that it is a solid.
Solid means that the mesh is watertight, i.e. it mustn't contain any triangles with an edge that has no adjacent triangle (boundary edges). Or in other words it mustn't contain any holes.

In FreeCAD it's very easy to check if the mesh is a solid or not. Just open the Mesh workbench, select the imported mesh and go to Mesh > Analyze > Check solid mesh. Then a dialog will pop up that tells you if the mesh is a solid or not.

In case it's not a solid then in the property editor (under View) you can set the parameter "Open Edges" to true. This will display all boundary edges. Your task will be to close all these holes. However, at the moment FreeCAD has a very primitive method to close holes.
More advanced methods are provided by tools like Meshlab or OpenFlipper.

What might be also possible is that the mesh has some topological or geometrical defects like non-manifolds or self-intersections. I don't know how much error-tolerant 3d printing software is against such defects. If this must be fixed you will find some tools under Mesh > Analyze > Evaluate and repair mesh.

If your client insists on getting a STEP file then you should ask him why. The reason therefore cannot be that the object must be 3d printable.