Welcome! Log In Create A New Profile

Advanced

Openscad outut curves to DXF

Posted by Miamicraft 
Openscad outut curves to DXF
May 05, 2013 01:34PM
I'm using Nophead's great mendel90 project to build a larger version of his machine. Everything works as expected except that the Openscad's output DXF's do not output circles for holes but instead output line segments approximating circles. The 2mm circle (attached) is generated as a 13 sided figure. The dimensions are correct in that if a circle is generated from the vertexes the diameter is 2mm. The PDF's generated from the scad are generated as true circles.

Typical code (I think) used to generate holes:
module frame_screw_hole() {
cylinder(r = frame_nuts ? screw_clearance_radius(frame_screw) : screw_pilot_hole(frame_screw), h = 100, center = true);
}

Is there any options I can set to correct this? I was planning on using a laser to cut the sheets and it much prefers circles over segments.

Roger
Attachments:
open | download - 2mmHole.dxf (172.8 KB)
Re: Openscad outut curves to DXF
May 05, 2013 02:59PM
If the holes are created by openscad code ( rather than just imported DXF from somewhere else ) then you could try importing the scad files into FreeCAD, its a newish feature, but may work. You will need FreeCAD 0.13 not the old 0.12. There is a parameter in FreeCAD that you can set that determines if a polygon becomes a circle or not see https://sourceforge.net/apps/mediawiki/free-cad/index.php?title=OpenSCAD_AddOpenSCADElement#Initial_set_up_from_within_FreeCAD
If you can get the part into FreeCAD okay then there are the odd speed bumps in exporting to DXF see the FreeCAD forums.

As I wrote a lot of the code, I would be interested to hear how you get on.

Edited 2 time(s). Last edit at 05/05/2013 03:02PM by KeithSloan.
Re: Openscad outut curves to DXF
May 05, 2013 03:20PM
Openscad won't export true circles. The reason they are circles in the PDF is because I wrote a Python script to detect circular polygons and work out the centre and radius. It then writes an SVG which gets converted to PDF by Inkscape.

It would be easy to make a script that writes DXF again with true circles instead of SVG. Curves that are not complete circles would still be segmented though.

Note that I have had acrylic laser cut with those files and I mill Dibond with them so I don't see what the problem is with segments on subtractive machines. There are enough of them to make the error minute.


[www.hydraraptor.blogspot.com]
Re: Openscad outut curves to DXF
May 05, 2013 03:49PM
nophead Wrote:
-------------------------------------------------------
> The reason
> they are circles in the PDF is because I wrote a
> Python script to detect circular polygons and work
> out the centre and radius. It then writes an SVG
> which gets converted to PDF by Inkscape.

Could he not just use Inkscape to convert the SVG to DXF, rather than use OpenSCAD?
Re: Openscad outut curves to DXF
May 05, 2013 05:23PM
Thanks Nophead,
I've found, after using it for years, that Sheetcam which I use to generate 2D g-code has the ability to change polygons to circles and export DXF. This solves my immediate problem. I had thought I was doing something wrong or missed something in Openscad.

Openscad is amazing. I'm still trying to get my head around how you managed to build a parametric machine this way. My previous experience was Inventor ($6K+) and it couldn't easily do what you have managed. I'm in process of adding support in your script for 3/8x1/2x1" Acetal bushings for my machine as a learning exercise and to take advantage of inexpensive fractional drill rod.

I can't thank you enough for all your contributions to RepRap.

Roger
Re: Openscad outut curves to DXF
May 24, 2013 11:21PM
nophead Wrote:
-------------------------------------------------------
> Openscad won't export true circles. The reason
> they are circles in the PDF is because I wrote a
> Python script to detect circular polygons and work
> out the centre and radius. It then writes an SVG
> which gets converted to PDF by Inkscape.
>
> It would be easy to make a script that writes DXF
> again with true circles instead of SVG. Curves
> that are not complete circles would still be
> segmented though.
>
> Note that I have had acrylic laser cut with those
> files and I mill Dibond with them so I don't see
> what the problem is with segments on subtractive
> machines. There are enough of them to make the
> error minute.

Is your python script shared anywhere? I've got a machine designed using flat parts for waterjet cutting, but the waterjet guy won't accept it with the segmented curves. My boss is trying to get me to redo it all in solidworks, but I hate solidworks so much... after using Openscad for years, it feels like trying to do CAD in MS Paint.


[whosawhatsis.com]
Re: Openscad outut curves to DXF
May 24, 2013 11:23PM
BTW, I tried the FreeCAD solution, but I had two major problems:

1: It doesn't work at all in the Mac version.
2: It doesn't support hull(), which I've been using a lot...


[whosawhatsis.com]
Re: Openscad outut curves to DXF
May 25, 2013 04:20PM
What Mac version did you download? A user compiled a binary from FreeCAD 0.13.1830 (final release) but it's only compatible with MacOS X 10.8, and it suffers from bugs the Windows and Linux version do not have. Unfortunately for you, Mac is the worst OS to use FreeCAD on. Ubuntu is the best BTW... winking smiley

[sourceforge.net]

Even if I am no SolidWorks lover, comparing it to MS Paint is rich. I feel the same way about OpenSCAD. winking smiley
Re: Openscad outut curves to DXF
May 25, 2013 05:22PM
Thanks, that solved the inability to import. It still doesn't support hull(), which I use a lot, so I'm not sure how useful it will end up being, but at least I can experiment with it now.


[whosawhatsis.com]
Re: Openscad outut curves to DXF
May 25, 2013 06:34PM
Oh, so that's probably why keithsloan (original author of FreeCAD's OpenSCAD module) is asking about convex hull support in the FreeCAD developers forum.

I've never seen use of convex hulls in CAD programs I've worked with (actually never heard of them before today winking smiley). When using a GUI I don't see much use for this as modeling is done very differently.
Re: Openscad outut curves to DXF
May 25, 2013 06:41PM
NormandC Wrote:
-------------------------------------------------------
>...When using a GUI I don't
> see much use for this as modeling is done very
> differently.

I noticed that when I tried to use solidworks. Thus the "MS Paint" comment.

I've been developing a workflow using DraftSight (another Dassault product that at least has a command line, so I find it more bearable) to post-process OpenSCAD DXFs to replace facets with true arcs. That python script to automatically convert the circles would make the job a lot easier though...


[whosawhatsis.com]
Re: Openscad outut curves to DXF
July 07, 2013 07:26AM
@KeithSloan

I can't get FreeCAD to read OpenSCAD files under Windows 7. No way. Do you have any idea or tips about special issues with that under Windows?
Re: Openscad outut curves to DXF
July 07, 2013 12:28PM
Robert,

Have you done these two necessary steps:

- Install OpenSCAD
- In FreeCAD's Preferences, under the OpenSCAD section, define the OpenSCAD executable path (the OpenSCAD module needs to be active for this panel to show in the preferences)

Edit: nevermind, I just noticed you mentioned you did in a new separate topic.

Edited 1 time(s). Last edit at 07/07/2013 12:30PM by NormandC.
Re: Openscad outut curves to DXF
July 07, 2013 01:29PM
NormandC Wrote:
-------------------------------------------------------
...
> Edit: nevermind, I just noticed you mentioned you
> did in a new separate topic.


Nevertheless: Thanks for your answer.
Sorry, only registered users may post in this forum.

Click here to login