Hi,
Thanks for all of your informative responses. I am sort of overwhelmed.
Hopefully I've attached a few files, if attachments work OK on the
mailing list. As I may have mentioned, I deleted the files that were not
usable, so I've recreated a couple of test files, and included one that
did work. All of the files were originally drawn using design cad (I'm
aware that it may not save in standard dxf format either, but R12 seems
to be most successful.)
So. for shape.dxf - openscad reports
WARNING: Unsupported DXF Entity 'SEQEND' (1) in
"c:/users/ray/desktop/shape.dxf".
WARNING: Unsupported DXF Entity 'POLYLINE' (1) in
"c:/users/ray/desktop/shape.dxf".
WARNING: Unsupported DXF Entity 'VERTEX' (7) in
"c:/users/ray/desktop/shape.dxf".
but the shape could not be much simpler. Within designcad, I've no idea
how to not have polylines, vertexes, etc. , but I have not looked into
the dxf format in any detail.
can2.dxf, that loads fine into openscad. That was also drawn in
designcad (by manually tracing a background jpeg image), but I loaded
it into, and resaved via my cnc software.
I've added a couple of stl files, too.
shape.stl was the same drawing file that was saved as shape.dxf, but
saved as stl. It will not reload into designcad, nor display in meshlab.
shape2.stl is the same drawing, but within design cad it is selected and
made into a plane. That loads into meshlab fine, but not into openscad.
But, If i manipulate it in designcad to make it a solid, instead of a
plane, then it can be used by openscad.
I have numerous more complex dxf files, that I've not tried to import
into openscad - I've no requirement to do so. I'm pretty certain they
would not import, but if anyone wants them as test data, then let me know.
Best wishes.
Ray
On 27.07.2020 13:27, Ray West wrote:
So. for shape.dxf - openscad reports
WARNING: Unsupported DXF Entity 'SEQEND' (1) in
"c:/users/ray/desktop/shape.dxf".
WARNING: Unsupported DXF Entity 'POLYLINE' (1) in
"c:/users/ray/desktop/shape.dxf".
WARNING: Unsupported DXF Entity 'VERTEX' (7) in
"c:/users/ray/desktop/shape.dxf".
but the shape could not be much simpler. Within designcad, I've no idea
how to not have polylines, vertexes, etc. , but I have not looked into
the dxf format in any detail.
shape.dxf works 'straight out of the box' with dxfread
O:\STL\dxf>dxfread -scad -as shape.dxf
parser OK
reading dxf: O:\STL\dxf\shape.dxf
Layers: 0 1
building xml
building profile loops
Starting from 1 curves
Created loop from 1 curve(s). 0 curves remaining
Profile completed with 1 loop
wrote: O:\STL\dxf\shape.as (AngelCAD)
wrote: O:\STL\dxf\shape.scad (OpenSCAD)
Wrote 2 profile file(s)
I have attached the two generated files in shape.zip
As you will see in the .scad file an OpenSCAD module shape_dxf() is
generated and called + extruded. The same thing happens in the AngelCAD
.as file, with slightly different (type safe) syntax.
can2.dxf, that loads fine into openscad. That was also drawn in
designcad (by manually tracing a background jpeg image), but I loaded
it into, and resaved via my cnc software.
I think OpenSCAD silently 'repairs' that file, because the profile in
your DXF file is disconnected, it does not describe a closed loop.
Without modification, it fails ion dxfread:
O:\STL\dxf>dxfread -scad -as can2.DXF
parser OK
reading dxf: O:\STL\dxf\can2.DXF
Layers: 0
building xml
building profile loops
Starting from 17 curves
warning: non-manifold (1) point at [ 4.70644, 16.5857] id= 2,
skipping curve 1
warning: non-manifold (1) point at [ 9.9333, 16.5857] id= 3,
skipping curve 2
warning: non-manifold (1) point at [ 13.3047, 17.9433] id= 4,
skipping curve 3
warning: non-manifold (1) point at [ 14.0288, 18.0112] id= 5,
skipping curve 4
warning: non-manifold (1) point at [ 14.3003, 17.898] id= 6,
skipping curve 5
warning: non-manifold (1) point at [ 14.323, 17.6491] id= 7,
skipping curve 6
warning: non-manifold (1) point at [ 14.2325, 1.96856] id= 8,
skipping curve 7
warning: non-manifold (1) point at [ 12.9201, -0.022624] id= 9,
skipping curve 8
warning: non-manifold (1) point at [ 0.520423, 0.045257] id= 10,
skipping curve 9
warning: non-manifold (1) point at [ 0.15839, 0.271528] id= 11,
skipping curve 10
warning: non-manifold (1) point at [ 0.045254, 0.565681] id= 12,
skipping curve 11
warning: non-manifold (1) point at [ -0.067881, 0.950342] id= 13,
skipping curve 12
warning: non-manifold (1) point at [ -0.067881, 13.6215] id= 14,
skipping curve 13
warning: non-manifold (1) point at [ 0.022627, 14.1646] id= 15,
skipping curve 14
warning: non-manifold (1) point at [ 0.15839, 14.5266] id= 16,
skipping curve 15
warning: non-manifold (1) point at [ 0.362034, 14.7755] id= 17,
skipping curve 16
warning: non-manifold (1) point at [ 0.678813, 14.9113] id= 18,
skipping curve 17
Profile completed with 0 loops
Wrote 0 profile file(s)
Warning: Computed profile contains no loops, only XML can be exported.
Check layer name if specified.
Looking at the DXF file in LibreCAD, it s clear that the profile is not
closed. See attached can2_a.png and can2_b.png
In can2_c.png, you can see the line I added using LibreCAD to close the
profile. If you want a reliable transfer of such model data you must
make sure the profiles are topologically connected, the problems you are
seing with DXF is not always due to the file format itself, but rather
the data in the file.
I saved the result after eding in LibreCAD to can2_fixed.dxf and tried
again, this time it worked:
O:\STL\dxf>dxfread -scad -as can2_fixed.DXF
parser OK
reading dxf: O:\STL\dxf\can2_fixed.DXF
Layers: 0
building xml
building profile loops
Starting from 18 curves
Created loop from 18 curve(s). 0 curves remaining
Profile completed with 1 loop
wrote: O:\STL\dxf\can2_fixed.as (AngelCAD)
wrote: O:\STL\dxf\can2_fixed.scad (OpenSCAD)
Wrote 2 profile file(s)
I have attached the modified can2_fixed.DXF and the 2 generated files in
can2_fixed.zip
As you can see, the .scad file now runs ok. You can modify the extrusion
heights to obtain another thickness, what you get is the default.
I have numerous more complex dxf files, that I've not tried to import
into openscad - I've no requirement to do so. I'm pretty certain they
would not import, but if anyone wants them as test data, then let me know.
Your examples were tiny and trivial, although the can2.dxf file revealed
a typical tolerance problem that must not be taken lightly. In the
general case, you as modeller must provide unambiguous data, and
can2.dxf failed that test. In some cases it is possible to fix such
issues automatically, but this can lead to other problems, and in the
general more complex case, it may not be possible to guess what you as
modeller intended.
I think it would be very interesting to see some of your more complex
dxf files and see how they behave in OpenSCAD and dxfread. If they are
too big to attach to the list, feel free to mail them directly to me or
use some file sharing service.
Best regards
Carsten Arnholm
Hi Carsten,
Thanks for discussing. The can2.dxf file, that in reality I would not
expect openscad to import successfully, does import OK. The shape files,
which I would expect to import, do not. They do import if cleaned up by
another program. I was not aware of dxfread. I'll dig out some other dxf
files, and send them to you.. Wrt the can2.dxf, I tried various
versions, including 'hatch filling' and saving the boundary, etc. I am
aware of the necessity of 'water tight' shapes, more so than scad by the
looks of it.
Thanks again,
Best wishes,
Ray
On 27/07/2020 13:52, Carsten Arnholm wrote:
On 27.07.2020 13:27, Ray West wrote:
So. for shape.dxf - openscad reports
WARNING: Unsupported DXF Entity 'SEQEND' (1) in
"c:/users/ray/desktop/shape.dxf".
WARNING: Unsupported DXF Entity 'POLYLINE' (1) in
"c:/users/ray/desktop/shape.dxf".
WARNING: Unsupported DXF Entity 'VERTEX' (7) in
"c:/users/ray/desktop/shape.dxf".
but the shape could not be much simpler. Within designcad, I've no
idea how to not have polylines, vertexes, etc. , but I have not
looked into the
etc...
On 2020-07-27 15:55, Ray West wrote:
Thanks for discussing. The can2.dxf file, that in reality I would not
expect openscad to import successfully, does import OK.
This must be because OpenSCAD silently applies an automatic closure of
your profile containing LINE entities. It is not clear to me what the
rules are for such automatic closure.
The shape
files, which I would expect to import, do not.
This is because (unlike cand2.dxf) it contains the POLYLINE datatype
which is not supported in OpenSCAD.
They do import if
cleaned up by another program.
Which probably transforms it into a collection of LINE entities. So it
is not really a 'cleanup' in this case, just re-representing it in the
subset of DXF commands that OpenSCAD understands.
I was not aware of dxfread.
I would not expect it, it has not been officially released yet, but it
is on the agenda to happen soon.
I'll dig
out some other dxf files, and send them to you..
Thanks, much appreciated.
Wrt the can2.dxf, I
tried various versions, including 'hatch filling' and saving the
boundary, etc. I am aware of the necessity of 'water tight' shapes,
more so than scad by the looks of it.
Hatch filling would not help I think. You either need to use a datatype
with implicit profile closure (POLYLINE,LWPOLYLINE), or close it
explicitly with LINE. Of course the software on the receiving end must
support the datatype you choose to use.
Best regards
Carsten Arnholm
I opened the dxf files in QCAD and found the following:
can2.DXF contains a non closed shape made with LINEs. There exist an
offset of 0.1 between two points.
shape.dxf contains a closed shape made with one POLYLINE in a
VIEWPORT.
openSCADs dxf importer imports the shape (1.) without any error message.
For (2.) both, the POLYLINES, as well as the VIEWPORT, are unsupported
by openSCADs dxf importer.
If the POLYLINE is converted to simple LINEs it's imported with only
a warning about unsupported VIEWPORT.
Conclusion: The openSCAD dxf importer works as expected - although a
permissible offset between two points is not specified explicitly.
Am Mon, 27 Jul 2020 12:27:28 +0100
schrieb Ray West raywest@raywest.com:
Hi,
Thanks for all of your informative responses. I am sort of
overwhelmed. Hopefully I've attached a few files, if attachments work
OK on the mailing list. As I may have mentioned, I deleted the files
that were not usable, so I've recreated a couple of test files, and
included one that did work. All of the files were originally drawn
using design cad (I'm aware that it may not save in standard dxf
format either, but R12 seems to be most successful.)
So. for shape.dxf - openscad reports
WARNING: Unsupported DXF Entity 'SEQEND' (1) in >
"c:/users/ray/desktop/shape.dxf". WARNING: Unsupported DXF Entity
'POLYLINE' (1) in > "c:/users/ray/desktop/shape.dxf". WARNING:
Unsupported DXF Entity 'VERTEX' (7) in >
"c:/users/ray/desktop/shape.dxf".
but the shape could not be much simpler. Within designcad, I've no
idea how to not have polylines, vertexes, etc. , but I have not
looked into the dxf format in any detail.
can2.dxf, that loads fine into openscad. That was also drawn in
designcad (by manually tracing a background jpeg image), but I load
ed it into, and resaved via my cnc software.
I've added a couple of stl files, too.
shape.stl was the same drawing file that was saved as shape.dxf, but
saved as stl. It will not reload into designcad, nor display in
meshlab.
shape2.stl is the same drawing, but within design cad it is selected
and made into a plane. That loads into meshlab fine, but not into
openscad. But, If i manipulate it in designcad to make it a solid,
instead of a plane, then it can be used by openscad.
I have numerous more complex dxf files, that I've not tried to impo
rt into openscad - I've no requirement to do so. I'm pretty certain
they would not import, but if anyone wants them as test data, then
let me know .
Best wishes.
Ray
--
Mit freundlichen Grüßen
Best Regards
Peter Ragosch
Looks like the POLYLINE import does work with the new import
code (https://github.com/openscad/openscad/pull/3006).
ciao,
Torsten.
Hi Carsten,
On 27/07/2020 15:17, arnholm@arnholm.org wrote:
Hatch filling would not help I think.
I can hatch fill a shape. If it is not complete, the hatch leaks out. By
judicious resizing, and placing sections of the shape on the screen, it
can hatch to boundary and to screen edge, so can narrow down the region
of the gap/s. It can be quicker than zooming in and micro stepping
around the boundary. Also, it can hatch fill as a boundary is drawn, and
then remove the hatching, leaving a watertight boundary. All a bit
clunky, but it gets the job done.
A number of my dxf files are not shapes, just lines, tool paths and the
like. I guess they won't load either.
It sounds like a rethinking of the design process to take advantage of
parametric CAD might be a time-saving exercise.
Using functions and loops to create complex shapes and fill patterns
might be easier compared to fixing disjointed polygons.
Would it make any sense to generate a large fill pattern and import only
the outline and then use a boolean function to trim the fill to only be
retained inside the polygon.
https://openhome.cc/eGossip/OpenSCAD/BooleanOperationsHull.html
https://www.openscad.org/cheatsheet/snapshot.html
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/CSG_Modelling#intersection
Never tested this and others might point out flaws in my logic.
I hope that this helps.
On 2020-07-27 11:04 a.m., Ray West wrote:
Hi Carsten,
On 27/07/2020 15:17, arnholm@arnholm.org wrote:
Hatch filling would not help I think.
I can hatch fill a shape. If it is not complete, the hatch leaks out.
By judicious resizing, and placing sections of the shape on the
screen, it can hatch to boundary and to screen edge, so can narrow
down the region of the gap/s. It can be quicker than zooming in and
micro stepping around the boundary. Also, it can hatch fill as a
boundary is drawn, and then remove the hatching, leaving a watertight
boundary. All a bit clunky, but it gets the job done.
A number of my dxf files are not shapes, just lines, tool paths and
the like. I guess they won't load either.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
--
Ron Wheeler
Artifact Software
438-345-3369
rwheeler@artifact-software.com
On 27.07.2020 17:04, Ray West wrote:
A number of my dxf files are not shapes, just lines, tool paths and the
like. I guess they won't load either.
Yes, that will cause problems. I would strongly suggest keeping gemetry
isolated in one or more DXF layers and such things like graphic lines,
text or tool paths in other layers. dxfread can read selected layers so
that would solve many issues.
Still, the geometry must be 'water tight'.
Regards
Carsten Arnholm
Interesting that your shape.dxf will read into AutoCAD and your can2.dxf will
not.
The can2 produces the error "Omitted group 12 line 84"
--
Sent from: http://forum.openscad.org/