I've been thinking about the advantages of generating stl formatted
files, compared to, say, polyhedrons outside of openscad. In the
experiments that I have made (not many) it seems that much of the
specification for stls is superfluous wrt opnscad import of ascii stl files.
The following is acceptable by openscad, for example when imported as an
stl (all of it between the *****)
solid generated by testing lets call it anything/nothing
outer loop
vertex 4 4 4 straight line
vertex 5 5 5
vertex 80 80 80
outer loop
vertex 5 2 10
vertex 8 8 0
vertex 1 7 7
outer loop
vertex 6 6 6
vertex 1 -8 4
vertex 5 9 0
endsolid whatever
Not sure if it can be further simplified. If it is exported again by
openscad, it is exported as a binary, and most other stl readers
recognise it. In the above remove the text 'straight line', and the line
is drawn, but as it has zero width, it won't be seen, but ctrl-shift-V
will increase the view area to include it. It seems that any text, other
than keywords, seems to comment out the whole loop.
On 01.09.22 00:40, Raymond West wrote:
I have made (not many) it seems that much of the
specification for stls is superfluous wrt opnscad
import of ascii stl files.
Well, the full argument is:
With the current specific OpenSCAD version I'm running, this
file happens to read successfully and produce the same result
as a similar "valid" file. That may change at any time without
warning or notice.
As STL is badly defined, "valid" is a bit of a gray area
already.
ciao,
Torsten.
On 01/09/2022 06:40, Raymond West wrote:
I've been thinking about the advantages of generating stl formatted
files, compared to, say, polyhedrons outside of openscad. In the
experiments that I have made (not many) it seems that much of the
specification for stls is superfluous wrt opnscad import of ascii stl
files.
The following is acceptable by openscad, for example when imported as
an stl (all of it between the *****)
solid generated by testing lets call it anything/nothing
outer loop
vertex 4 4 4 straight line
vertex 5 5 5
vertex 80 80 80
outer loop
vertex 5 2 10
vertex 8 8 0
vertex 1 7 7
outer loop
vertex 6 6 6
vertex 1 -8 4
vertex 5 9 0
endsolid whatever
Not sure if it can be further simplified. If it is exported again by
openscad, it is exported as a binary, and most other stl readers
recognise it. In the above remove the text 'straight line', and the
line is drawn, but as it has zero width, it won't be seen, but
ctrl-shift-V will increase the view area to include it. It seems that
any text, other than keywords, seems to comment out the whole loop.
STL models are 'triangle soup', but that they have specific requirements
on the vertices and edges and most apps require them to be 'water tight'
(i.e. no holes).
In other words it is simply a mesh.
Any reasonably complex model can have huge number of triangles, STL
files in the megabytes are common. As such, it is normally not 'manually
typed' unlike csg command based representations e.g. OpenSCAD files.
On 01/09/2022 06:40, Raymond West wrote:
I've been thinking about the advantages of generating stl formatted
files, compared to, say, polyhedrons outside of openscad. In the
experiments that I have made (not many) it seems that much of the
specification for stls is superfluous wrt opnscad import of ascii stl
files.
The following is acceptable by openscad, for example when imported as
an stl (all of it between the *****)
solid generated by testing lets call it anything/nothing
outer loop
vertex 4 4 4 straight line
vertex 5 5 5
vertex 80 80 80
outer loop
vertex 5 2 10
vertex 8 8 0
vertex 1 7 7
outer loop
vertex 6 6 6
vertex 1 -8 4
vertex 5 9 0
endsolid whatever
Not sure if it can be further simplified. If it is exported again by
openscad, it is exported as a binary, and most other stl readers
recognise it. In the above remove the text 'straight line', and the
line is drawn, but as it has zero width, it won't be seen, but
ctrl-shift-V will increase the view area to include it. It seems that
any text, other than keywords, seems to comment out the whole loop.
Wikipedia
https://en.wikipedia.org/wiki/STL_(file_format)
https://en.wikipedia.org/wiki/STL_(file_format)
has a nice article about it.
Found another article about STL rules
https://ebrary.net/158117/engineering/format_specifications
https://ebrary.net/158117/engineering/format_specifications
"Facet orientation: The facet defines the surface of a three-dimensional
object. As such, each facet is part of the boundary between the inside
and the outside of the object. The orientation of the facets (which path
is “out” and which path is “in”) is given redundantly in two ways that
must be consistent. The direction of the normal is outward, first.
Second, the vertices are seen in the anti-clockwise order when looking
at the object from the outside (right-hand rule). These rules are shown
in Figure 2.2."
"Vertex-to-vertex rule: Each triangle must share two vertices with each
of its neighboring triangles. In other words, the vertex of one triangle
cannot lie on the other side. This is shown in Figure 2.3. The object
shown must be placed in the all-positive octant. In other words, all
vertex coordinates must be positive-defined (non-negative and non-zero)
numbers."
'water tight' I'd guess is not specified in the rules. But that for
'true solids' I'd guess the STL triangle mesh surfaces must wrap the
solid such that there is 'no holes'.
I think i came across some articles which mentioned that some of the
meshes, i.e. the 'holes' can be repaired. Some algorithms and apps
apparently has features to do that.