discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

FW: Rendering problem about importing dxf file

O
OzAtMichael
Fri, Jan 12, 2018 12:37 AM

This bounced. Resending to list.

-----Original Message-----
From: ericlau [mailto:cylaumail@gmail.com]
Sent: Fri, 12 Jan 2018 10:21
To: discuss@lists.openscad.org
Subject: Rendering problem about importing dxf file

I'm a new user of OpenSCAD and just met a rendering problem. Could you help
to solve it?

Rendering success:

  • Use linear_extrude() for a dxf file and display a sphere.
  • Only use rotate_extrude() for a dxf file.

Rendering fail:

  • Use rotate_extrude() for a dxf file and display a
    sphere.

Here is the error message:
ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion
violation! Expr: e->incident_sface() != SFace_const_handle() File:
/Users/kintel/code/OpenSCAD/openscad/../libraries/install/include/CGAL/Nef_S2/SM_const_decorator.
h
Line: 329

Here is my source code:
/**************
**************/
module loadFile() {
rotate_extrude()
import("import_exercise.dxf");
}

module loadSphere() {
translate([0,0,-30])
sphere(10);
}

loadFile();
loadSphere();
/**************
**************/

Here is the scad file:
https://drive.google.com/file/d/1dT84jAzTGn-FxavEXamVivUwODelRqLS/view?usp=sharing
https://drive.google.com/file/d/1dT84jAzTGn-FxavEXamVivUwODelRqLS/view?usp=sharing

Here is the dxf file:
https://drive.google.com/file/d/1XhjWkydDVEnrn-vYcJOT5-yIjSRtdQaT/view?usp=sharing
https://drive.google.com/file/d/1XhjWkydDVEnrn-vYcJOT5-yIjSRtdQaT/view?usp=sharing

http://forum.openscad.org/file/t2130/screenshot_preview.png

http://forum.openscad.org/file/t2130/screenshot_render.png

http://forum.openscad.org/file/t2130/screenshot_render_success.png

Thank you!

--
Sent from: http://forum.openscad.org/

This bounced. Resending to list. > -----Original Message----- > From: ericlau [mailto:cylaumail@gmail.com] > Sent: Fri, 12 Jan 2018 10:21 > To: discuss@lists.openscad.org > Subject: Rendering problem about importing dxf file > > I'm a new user of OpenSCAD and just met a rendering problem. Could you help > to solve it? > > Rendering success: > - Use linear_extrude() for a dxf file and display a sphere. > - Only use rotate_extrude() for a dxf file. > > Rendering fail: > - Use rotate_extrude() for a dxf file and display a > sphere. > > Here is the error message: > ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion > violation! Expr: e->incident_sface() != SFace_const_handle() File: > /Users/kintel/code/OpenSCAD/openscad/../libraries/install/include/CGAL/Nef_S2/SM_const_decorator. > h > Line: 329 > > Here is my source code: > /************** > **************/ > module loadFile() { > rotate_extrude() > import("import_exercise.dxf"); > } > > module loadSphere() { > translate([0,0,-30]) > sphere(10); > } > > loadFile(); > loadSphere(); > /************** > **************/ > > Here is the scad file: > https://drive.google.com/file/d/1dT84jAzTGn-FxavEXamVivUwODelRqLS/view?usp=sharing > <https://drive.google.com/file/d/1dT84jAzTGn-FxavEXamVivUwODelRqLS/view?usp=sharing> > > Here is the dxf file: > https://drive.google.com/file/d/1XhjWkydDVEnrn-vYcJOT5-yIjSRtdQaT/view?usp=sharing > <https://drive.google.com/file/d/1XhjWkydDVEnrn-vYcJOT5-yIjSRtdQaT/view?usp=sharing> > > <http://forum.openscad.org/file/t2130/screenshot_preview.png> > > <http://forum.openscad.org/file/t2130/screenshot_render.png> > > <http://forum.openscad.org/file/t2130/screenshot_render_success.png> > > Thank you! > > > > -- > Sent from: http://forum.openscad.org/
C
cbernhardt
Fri, Jan 12, 2018 2:16 AM

I am not really sure why the DXF will not render with the sphere since it
will render by itself, but I know how to fix it. The image on the left side
of the picture below is the DXF file loaded into AutoCAD.  The blue squares
are the vertices of the figure.  The vertex with the coordinates shown
beside it shows that the X coordinate is 0.000.  If you move this vertex
just slightly in the positive X direction, then it renders with the sphere
with no error message (right side of picture).  I assume the problem lies in
the fact that the DXF file is rotated about the Z axis passing through X=0,
Y=0.
http://forum.openscad.org/file/t1309/import_exercise_dxf.jpg

--
Sent from: http://forum.openscad.org/

I am not really sure why the DXF will not render with the sphere since it will render by itself, but I know how to fix it. The image on the left side of the picture below is the DXF file loaded into AutoCAD. The blue squares are the vertices of the figure. The vertex with the coordinates shown beside it shows that the X coordinate is 0.000. If you move this vertex just slightly in the positive X direction, then it renders with the sphere with no error message (right side of picture). I assume the problem lies in the fact that the DXF file is rotated about the Z axis passing through X=0, Y=0. <http://forum.openscad.org/file/t1309/import_exercise_dxf.jpg> -- Sent from: http://forum.openscad.org/
A
arnholm@arnholm.org
Fri, Jan 12, 2018 8:22 AM

I'm a new user of OpenSCAD and just met a rendering problem. Could you
help
to solve it?

Rendering success:

  • Use linear_extrude() for a dxf file and display a sphere.
  • Only use rotate_extrude() for a dxf file.

Rendering fail:

  • Use rotate_extrude() for a dxf file and display a
    sphere.

The problem is that after rotate_extrude, the solid created is
self-intersecting. This is not detected until you attempt to perform a
boolean operation on it, i.e. union with the sphere. To avoid this
problem, make sure the profile you rotate_extrude is not crossing or
touching the x-axis.

For example
translate([0.1,0.0,0.0])import("import_exercise.dxf");

Carsten Arnholm

>> I'm a new user of OpenSCAD and just met a rendering problem. Could you >> help >> to solve it? >> >> Rendering success: >> - Use linear_extrude() for a dxf file and display a sphere. >> - Only use rotate_extrude() for a dxf file. >> >> Rendering fail: >> - Use rotate_extrude() for a dxf file and display a >> sphere. The problem is that after rotate_extrude, the solid created is self-intersecting. This is not detected until you attempt to perform a boolean operation on it, i.e. union with the sphere. To avoid this problem, make sure the profile you rotate_extrude is not crossing or touching the x-axis. For example translate([0.1,0.0,0.0])import("import_exercise.dxf"); Carsten Arnholm
E
ericlau
Fri, Jan 12, 2018 6:36 PM

cbernhardt wrote

I am not really sure why the DXF will not render with the sphere since it
will render by itself, but I know how to fix it. The image on the left
side
of the picture below is the DXF file loaded into AutoCAD.  The blue
squares
are the vertices of the figure.  The vertex with the coordinates shown
beside it shows that the X coordinate is 0.000.  If you move this vertex
just slightly in the positive X direction, then it renders with the sphere
with no error message (right side of picture).  I assume the problem lies
in
the fact that the DXF file is rotated about the Z axis passing through
X=0,
Y=0.
<http://forum.openscad.org/file/t1309/import_exercise_dxf.jpg>

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list

Discuss@.openscad

Thanks cbernhardt. It works! The problem is solved after I add
"translate([1,0,0])" under "rotate_extrude()".

--
Sent from: http://forum.openscad.org/

cbernhardt wrote > I am not really sure why the DXF will not render with the sphere since it > will render by itself, but I know how to fix it. The image on the left > side > of the picture below is the DXF file loaded into AutoCAD. The blue > squares > are the vertices of the figure. The vertex with the coordinates shown > beside it shows that the X coordinate is 0.000. If you move this vertex > just slightly in the positive X direction, then it renders with the sphere > with no error message (right side of picture). I assume the problem lies > in > the fact that the DXF file is rotated about the Z axis passing through > X=0, > Y=0. > &lt;http://forum.openscad.org/file/t1309/import_exercise_dxf.jpg&gt; > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@.openscad > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org Thanks cbernhardt. It works! The problem is solved after I add "translate([1,0,0])" under "rotate_extrude()". -- Sent from: http://forum.openscad.org/
E
ericlau
Fri, Jan 12, 2018 6:37 PM

cacb wrote

I'm a new user of OpenSCAD and just met a rendering problem. Could you
help
to solve it?

Rendering success:

  • Use linear_extrude() for a dxf file and display a sphere.
  • Only use rotate_extrude() for a dxf file.

Rendering fail:

  • Use rotate_extrude() for a dxf file and display a
    sphere.

The problem is that after rotate_extrude, the solid created is
self-intersecting. This is not detected until you attempt to perform a
boolean operation on it, i.e. union with the sphere. To avoid this
problem, make sure the profile you rotate_extrude is not crossing or
touching the x-axis.

For example
translate([0.1,0.0,0.0])import("import_exercise.dxf");

Carsten Arnholm


OpenSCAD mailing list

Discuss@.openscad

Thanks cacb. It works! The problem is solved after I add
"translate([1,0,0])" under "rotate_extrude()".

--
Sent from: http://forum.openscad.org/

cacb wrote >>> I'm a new user of OpenSCAD and just met a rendering problem. Could you >>> help >>> to solve it? >>> >>> Rendering success: >>> - Use linear_extrude() for a dxf file and display a sphere. >>> - Only use rotate_extrude() for a dxf file. >>> >>> Rendering fail: >>> - Use rotate_extrude() for a dxf file and display a >>> sphere. > > The problem is that after rotate_extrude, the solid created is > self-intersecting. This is not detected until you attempt to perform a > boolean operation on it, i.e. union with the sphere. To avoid this > problem, make sure the profile you rotate_extrude is not crossing or > touching the x-axis. > > For example > translate([0.1,0.0,0.0])import("import_exercise.dxf"); > > Carsten Arnholm > > _______________________________________________ > OpenSCAD mailing list > Discuss@.openscad > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org Thanks cacb. It works! The problem is solved after I add "translate([1,0,0])" under "rotate_extrude()". -- Sent from: http://forum.openscad.org/
C
cbernhardt
Fri, Jan 12, 2018 8:11 PM

ericlau:

I'm not sure if this matters in your application, but you might like to
know.  Your DXF file contains what AutoCAD calls a "POLYLINE".  In your case
the POLYLINE is a series of connected line segments.  POLYLINES can also
contain connected line segments and arc segments, but OpenSCAD cannot
properly display the arc  segments unless you "EXPLODE" the POLYLINE into
separate lines and arcs.  I changed the line segments in your DXF file into
arc segments and imported it into OpenSCAD.  You can see the difference in
the picture below.
Charles
http://forum.openscad.org/file/t1309/arcs_lines.jpg

--
Sent from: http://forum.openscad.org/

ericlau: I'm not sure if this matters in your application, but you might like to know. Your DXF file contains what AutoCAD calls a "POLYLINE". In your case the POLYLINE is a series of connected line segments. POLYLINES can also contain connected line segments and arc segments, but OpenSCAD cannot properly display the arc segments unless you "EXPLODE" the POLYLINE into separate lines and arcs. I changed the line segments in your DXF file into arc segments and imported it into OpenSCAD. You can see the difference in the picture below. Charles <http://forum.openscad.org/file/t1309/arcs_lines.jpg> -- Sent from: http://forum.openscad.org/