discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Import of dxf file with a circle.

K
KeithSloan52
Mon, Apr 16, 2018 1:50 PM

I am trying to debug a problem with FreeCAD import of an OpenSCAD file.
see  https://forum.freecadweb.org/viewtopic.php?f=3&t=28119&p=228042#p228042
https://forum.freecadweb.org/viewtopic.php?f=3&t=28119&p=228042#p228042
for full details.

One problem seems to be that I have a dxf file with a circle, displays as
circle in LibreCAD.
If in OpenSCAD I import it with
import(file = "file1.dxf");
OpenSCAD creates it as an 8 sided polygon.

Now I understand that OpenSCAD does not do circles just polygons, but my
question is there a way to control the number of elements of an imported dxf
file given there is no $fn involved with an import. Or am I stuck with a
default of 8.

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

I am trying to debug a problem with FreeCAD import of an OpenSCAD file. see https://forum.freecadweb.org/viewtopic.php?f=3&t=28119&p=228042#p228042 <https://forum.freecadweb.org/viewtopic.php?f=3&t=28119&p=228042#p228042> for full details. One problem seems to be that I have a dxf file with a circle, displays as circle in LibreCAD. If in OpenSCAD I import it with import(file = "file1.dxf"); OpenSCAD creates it as an 8 sided polygon. Now I understand that OpenSCAD does not do circles just polygons, but my question is there a way to control the number of elements of an imported dxf file given there is no $fn involved with an import. Or am I stuck with a default of 8. -- Sent from: http://forum.openscad.org/
TP
Torsten Paul
Mon, Apr 16, 2018 4:01 PM

On 04/16/2018 03:50 PM, KeithSloan52 wrote:

...given there is no $fn involved with an import.

There is the wrong assumption. The import module, and
specifically also the DXF import does use $fa/$fs/$fn
to convert curves to polygons.

Try import("circle.dxf", $fn = 3); and you will even
end up with a triangle instead of a circle.

ciao,
Torsten.

On 04/16/2018 03:50 PM, KeithSloan52 wrote: > ...given there is no $fn involved with an import. > There is the wrong assumption. The import module, and specifically also the DXF import does use $fa/$fs/$fn to convert curves to polygons. Try import("circle.dxf", $fn = 3); and you will even end up with a triangle instead of a circle. ciao, Torsten.
K
KeithSloan52
Sat, Apr 21, 2018 7:46 PM

If I try import("circle.dxf", $fn = 12);
I get a 12 sided polygon, but if I try import("circle.dxf", $fn = 0);
It defaults back to 8 sided.

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

If I try import("circle.dxf", $fn = 12); I get a 12 sided polygon, but if I try import("circle.dxf", $fn = 0); It defaults back to 8 sided. -- Sent from: http://forum.openscad.org/
MK
Marius Kintel
Sat, Apr 21, 2018 7:50 PM

On Apr 21, 2018, at 3:46 PM, KeithSloan52 keith@sloan-home.co.uk wrote:

If I try import("circle.dxf", $fn = 12);
I get a 12 sided polygon, but if I try import("circle.dxf", $fn = 0);
It defaults back to 8 sided.

That’s correct; $fn=0 disables $fn and it falls back to calculating the number of sides using $fs and $fa.

-Marius

> On Apr 21, 2018, at 3:46 PM, KeithSloan52 <keith@sloan-home.co.uk> wrote: > > If I try import("circle.dxf", $fn = 12); > I get a 12 sided polygon, but if I try import("circle.dxf", $fn = 0); > It defaults back to 8 sided. > That’s correct; $fn=0 disables $fn and it falls back to calculating the number of sides using $fs and $fa. -Marius
R
Rick
Sat, Apr 21, 2018 7:53 PM

Just a guess, but $fn=0; means no faces, not legal?  Going to a default
value seems like proper behaviour in that case.

On Sat, Apr 21, 2018 at 3:46 PM, KeithSloan52 keith@sloan-home.co.uk
wrote:

If I try import("circle.dxf", $fn = 12);
I get a 12 sided polygon, but if I try import("circle.dxf", $fn = 0);
It defaults back to 8 sided.

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


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

--
"Rumors of my death have been greatly exaggerated."
-- Jesus Christ

Just a guess, but $fn=0; means no faces, not legal? Going to a default value seems like proper behaviour in that case. On Sat, Apr 21, 2018 at 3:46 PM, KeithSloan52 <keith@sloan-home.co.uk> wrote: > If I try import("circle.dxf", $fn = 12); > I get a 12 sided polygon, but if I try import("circle.dxf", $fn = 0); > It defaults back to 8 sided. > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > -- "Rumors of my death have been greatly exaggerated." -- Jesus Christ
R
Rick
Sat, Apr 21, 2018 7:55 PM

Or that.

On Sat, Apr 21, 2018 at 3:50 PM, Marius Kintel marius@kintel.net wrote:

On Apr 21, 2018, at 3:46 PM, KeithSloan52 keith@sloan-home.co.uk

wrote:

If I try import("circle.dxf", $fn = 12);
I get a 12 sided polygon, but if I try import("circle.dxf", $fn = 0);
It defaults back to 8 sided.

That’s correct; $fn=0 disables $fn and it falls back to calculating the
number of sides using $fs and $fa.

-Marius


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

--
"Rumors of my death have been greatly exaggerated."
-- Jesus Christ

Or that. On Sat, Apr 21, 2018 at 3:50 PM, Marius Kintel <marius@kintel.net> wrote: > > > On Apr 21, 2018, at 3:46 PM, KeithSloan52 <keith@sloan-home.co.uk> > wrote: > > > > If I try import("circle.dxf", $fn = 12); > > I get a 12 sided polygon, but if I try import("circle.dxf", $fn = 0); > > It defaults back to 8 sided. > > > That’s correct; $fn=0 disables $fn and it falls back to calculating the > number of sides using $fs and $fa. > > -Marius > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > -- "Rumors of my death have been greatly exaggerated." -- Jesus Christ