[OpenSCAD] Working with imported STLs

nop head nop.head at gmail.com
Mon Apr 16 07:48:21 EDT 2018


This isn't true at all. An imported STL file that was manifold and had no
degenerate triangles produces just the same data structure as a polyhedron
or cylinder. OpenSCAD doesn't store objects as CSG objects, except in the
source code. I stores them using a boundary representation that is just a
fancy mesh. That is why cylinders are always faceted. They are only true
cylinders in the source code or the csg tree. To render them they are
converted to polyhedra. The only difference when exporting to STL is any
facets with more than three vertices are triangulated and the vertices
truncated to floats.

On 16 April 2018 at 11:50, Jamie Bainbridge <jamie.bainbridge at gmail.com>
wrote:

> On 16 April 2018 at 10:58, kerog <kerog777 at gmail.com> wrote:
> > I recently tried to bring in an STL with an import command and then
> slice it
> > up using difference commands in order to get something that I could make
> a
> > multicolor part.  I know I've done something like this in the past and
> had
> > it work, but even though I was able to quick render OK (F5) a full render
> > seemed to ignore the differencing that I had done.  Is there some sort of
> > restriction on using difference() on imported objects?
>
> The way I understand it, OpenSCAD doesn't work this way.
>
> When you design parts with code using CSG then export them to a
> manifold mesh, the triangles which make up the mesh are generated at
> export time. Everything is (hopefully) a valid manifold shape.
>
> However, when you import an STL you're bringing in a manifold mesh
> which is a fixed object. OpenSCAD doesn't see the STL as a CSG object
> which it can modify.
>
> Then you erase parts of the STL or tack bits on. When the mesh is
> generated at export time, your CSG objects have their triangles
> created plus the STL (or what's left of it) is defined as a separate
> shape to the SCAD CSG objects.
>
> For example, if you a hole in an STL file, you've essentially just
> erased a bunch of vertices and faces, so the part is not a manifold
> mesh anymore, plus OpenSCAD has added the "shell" of the hole as a
> separate mesh. It looks okay to the eye but as far as the software is
> concerned it's not okay at all.
>
> You can run STLs made this way through NetFabb Online Service with a
> reasonable degree of success: https://service.netfabb.com/
>
> However, I find it better to use Riham's STL-to-SCAD converter:
> http://jsfiddle.net/Riham/yzvGD/
>
> This converts the triangles of an STL mesh into an OpenSCAD polyhedron
> which IS then seen as a CSG object just like any other cube() or
> cylinder() or sphere().
>
> Now you can cut parts out of that polyhedron or add parts to it and,
> providing you code your difference()s and union()s correctly, OpenSCAD
> can generate a valid manifold mesh on export.
>
> STLs with high triangle counts will result in complex polyhedrons
> which will make your PC chug. Consider reducing the triangle count
> (known as "decimating") if it doesn't affect your part quality or
> dimensions too much. You can do this with MeshLab which is also Free
> Software: https://www.shapeways.com/tutorials/polygon_reduction_
> with_meshlab
>
> Jamie
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20180416/2e788933/attachment.html>


More information about the Discuss mailing list