discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Extrude curve generated elsewhere

S
superaorta@gmail.com
Tue, Jan 19, 2016 7:07 PM

I want to generate a shape according to an equation and somehow get this into
openscad and then extrude it into a 3d form.

The curve consists of lots and lots of points and while I could script up
something to generate code like this:

polygon([[0,0],[0,0.1].............) it would be a huge pain in the arse on
account of the number of points I want to use.

I've tried rendering the 2-d slice as a .png and then using surface to load it
(this would be ok for my purposes) but surface insists on sticking voxels
where the height=0 which I don't want and something went wrong in openscad
because openscad rapidly needed 13Gb RAM to import my .png so I gave up.

Next I thought I'd try rendering the bit map in something that could vectorise
it and then save as .dxf format but openscad did not like the dxf inkscape
produced (unsupported entity SEQEND VERTEX POLYLINE).

Next I thought I'd script the shape generation in .off format but while I can
produce a nice 2d shape using import("myfile.off") I cannot extrude it into 3D
because openscad chokes on it complaining "WARNING: Ignoring 3D child object
for 2D operation ".

I can't generate the points in openscad because the proceedure is too complex.

Suggestions please as to how I can load points into open scad, convert them to
a polygon and extrude them please!

Thanks

SASA

I want to generate a shape according to an equation and somehow get this into openscad and then extrude it into a 3d form. The curve consists of lots and lots of points and while I could script up something to generate code like this: polygon([[0,0],[0,0.1].............) it would be a huge pain in the arse on account of the number of points I want to use. I've tried rendering the 2-d slice as a .png and then using surface to load it (this would be ok for my purposes) but surface insists on sticking voxels where the height=0 which I don't want and something went wrong in openscad because openscad rapidly needed 13Gb RAM to import my .png so I gave up. Next I thought I'd try rendering the bit map in something that could vectorise it and then save as .dxf format but openscad did not like the dxf inkscape produced (unsupported entity SEQEND VERTEX POLYLINE). Next I thought I'd script the shape generation in .off format but while I can produce a nice 2d shape using import("myfile.off") I cannot extrude it into 3D because openscad chokes on it complaining "WARNING: Ignoring 3D child object for 2D operation ". I can't generate the points in openscad because the proceedure is too complex. Suggestions please as to how I can load points into open scad, convert them to a polygon and extrude them please! Thanks SASA
F
fred
Tue, Jan 19, 2016 7:14 PM

SASA, have you tried using Inkscape to create your 2d shape, followed with the Inkscape extension for OpenSCAD? I've had good success with the limited projects I've created.

On Tuesday, January 19, 2016 2:08 PM, "superaorta@gmail.com" <superaorta@gmail.com> wrote:

I want to generate a shape according to an equation and somehow get this into
openscad and then extrude it into a 3d form.

The curve consists of lots and lots of points and while I could script up
something to generate code like this:

polygon([[0,0],[0,0.1].............) it would be a huge pain in the arse on
account of the number of points I want to use.

I've tried rendering the 2-d slice as a .png and then using surface to load it
(this would be ok for my purposes) but surface insists on sticking voxels
where the height=0 which I don't want and something went wrong in openscad
because openscad rapidly needed 13Gb RAM to import my .png so I gave up.

Next I thought I'd try rendering the bit map in something that could vectorise
it and then save as .dxf format but openscad did not like the dxf inkscape
produced (unsupported entity SEQEND VERTEX POLYLINE).

Next I thought I'd script the shape generation in .off format but while I can
produce a nice 2d shape using import("myfile.off") I cannot extrude it into 3D
because openscad chokes on it complaining "WARNING: Ignoring 3D child object
for 2D operation ".

I can't generate the points in openscad because the proceedure is too complex.

Suggestions please as to how I can load points into open scad, convert them to
a polygon and extrude them please!

Thanks

SASA


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

SASA, have you tried using Inkscape to create your 2d shape, followed with the Inkscape extension for OpenSCAD? I've had good success with the limited projects I've created. On Tuesday, January 19, 2016 2:08 PM, "superaorta@gmail.com" <superaorta@gmail.com> wrote: I want to generate a shape according to an equation and somehow get this into openscad and then extrude it into a 3d form. The curve consists of lots and lots of points and while I could script up something to generate code like this: polygon([[0,0],[0,0.1].............) it would be a huge pain in the arse on account of the number of points I want to use. I've tried rendering the 2-d slice as a .png and then using surface to load it (this would be ok for my purposes) but surface insists on sticking voxels where the height=0 which I don't want and something went wrong in openscad because openscad rapidly needed 13Gb RAM to import my .png so I gave up. Next I thought I'd try rendering the bit map in something that could vectorise it and then save as .dxf format but openscad did not like the dxf inkscape produced (unsupported entity SEQEND VERTEX POLYLINE). Next I thought I'd script the shape generation in .off format but while I can produce a nice 2d shape using import("myfile.off") I cannot extrude it into 3D because openscad chokes on it complaining "WARNING: Ignoring 3D child object for 2D operation ". I can't generate the points in openscad because the proceedure is too complex. Suggestions please as to how I can load points into open scad, convert them to a polygon and extrude them please! Thanks SASA _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
TP
Torsten Paul
Tue, Jan 19, 2016 7:29 PM

On 01/19/2016 08:07 PM, superaorta@gmail.com wrote:

I want to generate a shape according to an equation and somehow get this into
openscad and then extrude it into a 3d form.

[snip]

I can't generate the points in openscad because the proceedure is too complex.

If the equation is not secret, maybe post it anyway? Someone might have
a solution how to do it in OpenSCAD.

Suggestions please as to how I can load points into open scad, convert them to
a polygon and extrude them please!

If you already have the points as text data, you can just stick those into a file,
e.g. as points.scad

[ x1, y1 ],
[ x2, y2 ],
...

and include this into some other OpenSCAD file

points = [
include <points.scad>
];
polygon(points);

ciao,
Torsten.

On 01/19/2016 08:07 PM, superaorta@gmail.com wrote: > I want to generate a shape according to an equation and somehow get this into > openscad and then extrude it into a 3d form. > [snip] > > I can't generate the points in openscad because the proceedure is too complex. > If the equation is not secret, maybe post it anyway? Someone might have a solution how to do it in OpenSCAD. > Suggestions please as to how I can load points into open scad, convert them to > a polygon and extrude them please! > If you already have the points as text data, you can just stick those into a file, e.g. as points.scad [ x1, y1 ], [ x2, y2 ], ... and include this into some other OpenSCAD file points = [ include <points.scad> ]; polygon(points); ciao, Torsten.
S
superaorta@gmail.com
Tue, Jan 19, 2016 7:40 PM

Torsten,

Ok that's a nice suggestion I'll give it a go -

The "equation" isn't secret but is a lengthy matlab script with lots of calls
to library functions that would be a big undertaking to redo in openscad.

Thanks,

SASA

On Tuesday 19 Jan 2016 20:29:09 Torsten Paul wrote:

On 01/19/2016 08:07 PM, superaorta@gmail.com wrote:

I want to generate a shape according to an equation and somehow get this
into openscad and then extrude it into a 3d form.

[snip]

I can't generate the points in openscad because the proceedure is too
complex.

If the equation is not secret, maybe post it anyway? Someone might have
a solution how to do it in OpenSCAD.

Suggestions please as to how I can load points into open scad, convert
them to a polygon and extrude them please!

If you already have the points as text data, you can just stick those into a
file, e.g. as points.scad

[ x1, y1 ],
[ x2, y2 ],
...

and include this into some other OpenSCAD file

points = [
include <points.scad>
];
polygon(points);

ciao,
Torsten.


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

Torsten, Ok that's a nice suggestion I'll give it a go - The "equation" isn't secret but is a lengthy matlab script with lots of calls to library functions that would be a big undertaking to redo in openscad. Thanks, SASA On Tuesday 19 Jan 2016 20:29:09 Torsten Paul wrote: > On 01/19/2016 08:07 PM, superaorta@gmail.com wrote: > > I want to generate a shape according to an equation and somehow get this > > into openscad and then extrude it into a 3d form. > > [snip] > > > I can't generate the points in openscad because the proceedure is too > > complex. > If the equation is not secret, maybe post it anyway? Someone might have > a solution how to do it in OpenSCAD. > > > Suggestions please as to how I can load points into open scad, convert > > them to a polygon and extrude them please! > > If you already have the points as text data, you can just stick those into a > file, e.g. as points.scad > > [ x1, y1 ], > [ x2, y2 ], > ... > > and include this into some other OpenSCAD file > > points = [ > include <points.scad> > ]; > polygon(points); > > ciao, > Torsten. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
S
superaorta@gmail.com
Tue, Jan 19, 2016 7:42 PM

Fred,

I haven't tried this extension but I think I'll try Torsten's suggestion first
as this is more suited to scripting.

thanks anyway,

SASA

On Tuesday 19 Jan 2016 19:14:53 fred wrote:

SASA, have you tried using Inkscape to create your 2d shape, followed with
the Inkscape extension for OpenSCAD? I've had good success with the limited
projects I've created.

 On Tuesday, January 19, 2016 2:08 PM, "superaorta@gmail.com"

superaorta@gmail.com wrote:

I want to generate a shape according to an equation and somehow get this
into openscad and then extrude it into a 3d form.

The curve consists of lots and lots of points and while I could script up
something to generate code like this:

polygon([[0,0],[0,0.1].............) it would be a huge pain in the arse on
account of the number of points I want to use.

I've tried rendering the 2-d slice as a .png and then using surface to load
it (this would be ok for my purposes) but surface insists on sticking
voxels where the height=0 which I don't want and something went wrong in
openscad because openscad rapidly needed 13Gb RAM to import my .png so I
gave up.

Next I thought I'd try rendering the bit map in something that could
vectorise it and then save as .dxf format but openscad did not like the dxf
inkscape produced (unsupported entity SEQEND VERTEX POLYLINE).

Next I thought I'd script the shape generation in .off format but while I
can produce a nice 2d shape using import("myfile.off") I cannot extrude it
into 3D because openscad chokes on it complaining "WARNING: Ignoring 3D
child object for 2D operation ".

I can't generate the points in openscad because the proceedure is too
complex.

Suggestions please as to how I can load points into open scad, convert them
to a polygon and extrude them please!

Thanks

SASA


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

Fred, I haven't tried this extension but I think I'll try Torsten's suggestion first as this is more suited to scripting. thanks anyway, SASA On Tuesday 19 Jan 2016 19:14:53 fred wrote: > SASA, have you tried using Inkscape to create your 2d shape, followed with > the Inkscape extension for OpenSCAD? I've had good success with the limited > projects I've created. > > > On Tuesday, January 19, 2016 2:08 PM, "superaorta@gmail.com" > <superaorta@gmail.com> wrote: > > > > > I want to generate a shape according to an equation and somehow get this > into openscad and then extrude it into a 3d form. > > The curve consists of lots and lots of points and while I could script up > something to generate code like this: > > polygon([[0,0],[0,0.1].............) it would be a huge pain in the arse on > account of the number of points I want to use. > > I've tried rendering the 2-d slice as a .png and then using surface to load > it (this would be ok for my purposes) but surface insists on sticking > voxels where the height=0 which I don't want and something went wrong in > openscad because openscad rapidly needed 13Gb RAM to import my .png so I > gave up. > > Next I thought I'd try rendering the bit map in something that could > vectorise it and then save as .dxf format but openscad did not like the dxf > inkscape produced (unsupported entity SEQEND VERTEX POLYLINE). > > Next I thought I'd script the shape generation in .off format but while I > can produce a nice 2d shape using import("myfile.off") I cannot extrude it > into 3D because openscad chokes on it complaining "WARNING: Ignoring 3D > child object for 2D operation ". > > I can't generate the points in openscad because the proceedure is too > complex. > > Suggestions please as to how I can load points into open scad, convert them > to a polygon and extrude them please! > > Thanks > > SASA > > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
MK
Marius Kintel
Tue, Jan 19, 2016 8:13 PM

Hey,

[…] but openscad did not like the dxf inkscape
produced (unsupported entity SEQEND VERTEX POLYLINE).

You may have more luck with exporting as "Desktop Cutting Plotter (R13) (*.dxf)”

We also have an SVG importer in the works, but it requires a bit more work: https://github.com/openscad/openscad/pull/834

..and there’s the Inkscape plugin for saving OpenSCAD files: http://www.thingiverse.com/thing:25036

-Marius

Hey, > […] but openscad did not like the dxf inkscape > produced (unsupported entity SEQEND VERTEX POLYLINE). You may have more luck with exporting as "Desktop Cutting Plotter (R13) (*.dxf)” We also have an SVG importer in the works, but it requires a bit more work: https://github.com/openscad/openscad/pull/834 ..and there’s the Inkscape plugin for saving OpenSCAD files: http://www.thingiverse.com/thing:25036 -Marius
S
superaorta@gmail.com
Tue, Jan 19, 2016 8:34 PM

Thanks everyone!

Torsten's suggestion is working perfectly and is well suited to my needs.

My scad file now looks like this:

p1=[ include <points_1.scad> ];
linear_extrude(height=10)polygon(p1);
p2=[ include <points_2.scad> ];
linear_extrude(height=10)polygon(p2);
p3=[ include <points_3.scad> ];
linear_extrude(height=10)polygon(p3);
p4=[ include <points_4.scad> ];
linear_extrude(height=10)polygon(p4);
...

If anyone knows how I might parameterise this neatly so I could do something
like

for i=1:20
p(i)=[ include <points_$i.scad];
linear_extrude(height=10)polygon(p(i));
end

That would be great, but for now it works perfectly...

SASA

On Tuesday 19 Jan 2016 15:13:39 Marius Kintel wrote:

Hey,

[…] but openscad did not like the dxf inkscape
produced (unsupported entity SEQEND VERTEX POLYLINE).

You may have more luck with exporting as "Desktop Cutting Plotter (R13)
(*.dxf)”

We also have an SVG importer in the works, but it requires a bit more work:
https://github.com/openscad/openscad/pull/834

..and there’s the Inkscape plugin for saving OpenSCAD files:
http://www.thingiverse.com/thing:25036

-Marius


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

Thanks everyone! Torsten's suggestion is working perfectly and is well suited to my needs. My scad file now looks like this: p1=[ include <points_1.scad> ]; linear_extrude(height=10)polygon(p1); p2=[ include <points_2.scad> ]; linear_extrude(height=10)polygon(p2); p3=[ include <points_3.scad> ]; linear_extrude(height=10)polygon(p3); p4=[ include <points_4.scad> ]; linear_extrude(height=10)polygon(p4); ... If anyone knows how I might parameterise this neatly so I could do something like for i=1:20 p(i)=[ include <points_$i.scad]; linear_extrude(height=10)polygon(p(i)); end That would be great, but for now it works perfectly... SASA On Tuesday 19 Jan 2016 15:13:39 Marius Kintel wrote: > Hey, > > > […] but openscad did not like the dxf inkscape > > produced (unsupported entity SEQEND VERTEX POLYLINE). > > You may have more luck with exporting as "Desktop Cutting Plotter (R13) > (*.dxf)” > > We also have an SVG importer in the works, but it requires a bit more work: > https://github.com/openscad/openscad/pull/834 > > ..and there’s the Inkscape plugin for saving OpenSCAD files: > http://www.thingiverse.com/thing:25036 > > -Marius > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
TP
Torsten Paul
Tue, Jan 19, 2016 9:15 PM

On 01/19/2016 09:34 PM, superaorta@gmail.com wrote:

If anyone knows how I might parameterise this neatly so I could do something
like

for i=1:20
p(i)=[ include <points_$i.scad];
linear_extrude(height=10)polygon(p(i));
end

That would be great, but for now it works perfectly...

Add another dimension to the array and import into a single
variable?

ciao,
Torsten.

On 01/19/2016 09:34 PM, superaorta@gmail.com wrote: > If anyone knows how I might parameterise this neatly so I could do something > like > > for i=1:20 > p(i)=[ include <points_$i.scad]; > linear_extrude(height=10)polygon(p(i)); > end > > That would be great, but for now it works perfectly... > Add another dimension to the array and import into a single variable? ciao, Torsten.
S
superaorta@gmail.com
Thu, Jan 21, 2016 8:17 AM

I've developed another problem trying to do this that probably resides outside
openscad but in case anyone is familiar with it here goes:

I generate my family of curves in openscad and and it looks fine - I export the
curves as .stl and load into cura and it looks file, I then look at the tool
path and some of the curves are missing.  I suspect my feature size is a bit
small but other smaller features produced using primitive shapes (cube) always
get rendered correctly and only the polygons that get missed.

While I realise there is probably some setting in cura responsible rather than
openscad and that I'm probably posting in the wrong place I just wondered if
anyone had an idea...

Ta SASA

On Tuesday 19 Jan 2016 22:15:34 Torsten Paul wrote:

On 01/19/2016 09:34 PM, superaorta@gmail.com wrote:

If anyone knows how I might parameterise this neatly so I could do
something like

for i=1:20

p(i)=[ include <points_$i.scad];
linear_extrude(height=10)polygon(p(i));
end

That would be great, but for now it works perfectly...

Add another dimension to the array and import into a single
variable?

ciao,
Torsten.


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

I've developed another problem trying to do this that probably resides outside openscad but in case anyone is familiar with it here goes: I generate my family of curves in openscad and and it looks fine - I export the curves as .stl and load into cura and it looks file, I then look at the tool path and some of the curves are missing. I suspect my feature size is a bit small but other smaller features produced using primitive shapes (cube) always get rendered correctly and only the polygons that get missed. While I realise there is probably some setting in cura responsible rather than openscad and that I'm probably posting in the wrong place I just wondered if anyone had an idea... Ta SASA On Tuesday 19 Jan 2016 22:15:34 Torsten Paul wrote: > On 01/19/2016 09:34 PM, superaorta@gmail.com wrote: > > If anyone knows how I might parameterise this neatly so I could do > > something like > > > > for i=1:20 > > > > p(i)=[ include <points_$i.scad]; > > linear_extrude(height=10)polygon(p(i)); > > end > > > > That would be great, but for now it works perfectly... > > Add another dimension to the array and import into a single > variable? > > ciao, > Torsten. > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
TH
Triffid Hunter
Fri, Jan 22, 2016 8:12 AM

See what happens when you slice it with slic3r

On 21 January 2016 at 16:17, superaorta@gmail.com wrote:

I've developed another problem trying to do this that probably resides
outside
openscad but in case anyone is familiar with it here goes:

I generate my family of curves in openscad and and it looks fine - I
export the
curves as .stl and load into cura and it looks file, I then look at the
tool
path and some of the curves are missing.  I suspect my feature size is a
bit
small but other smaller features produced using primitive shapes (cube)
always
get rendered correctly and only the polygons that get missed.

While I realise there is probably some setting in cura responsible rather
than
openscad and that I'm probably posting in the wrong place I just wondered
if
anyone had an idea...

Ta SASA

On Tuesday 19 Jan 2016 22:15:34 Torsten Paul wrote:

On 01/19/2016 09:34 PM, superaorta@gmail.com wrote:

If anyone knows how I might parameterise this neatly so I could do
something like

for i=1:20

 p(i)=[ include <points_$i.scad];
 linear_extrude(height=10)polygon(p(i));
 end

That would be great, but for now it works perfectly...

Add another dimension to the array and import into a single
variable?

ciao,
Torsten.


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

See what happens when you slice it with slic3r On 21 January 2016 at 16:17, <superaorta@gmail.com> wrote: > > > > I've developed another problem trying to do this that probably resides > outside > openscad but in case anyone is familiar with it here goes: > > I generate my family of curves in openscad and and it looks fine - I > export the > curves as .stl and load into cura and it looks file, I then look at the > tool > path and some of the curves are missing. I suspect my feature size is a > bit > small but other smaller features produced using primitive shapes (cube) > always > get rendered correctly and only the polygons that get missed. > > While I realise there is probably some setting in cura responsible rather > than > openscad and that I'm probably posting in the wrong place I just wondered > if > anyone had an idea... > > Ta SASA > > > > > > > > > > > > > > > > On Tuesday 19 Jan 2016 22:15:34 Torsten Paul wrote: > > On 01/19/2016 09:34 PM, superaorta@gmail.com wrote: > > > If anyone knows how I might parameterise this neatly so I could do > > > something like > > > > > > for i=1:20 > > > > > > p(i)=[ include <points_$i.scad]; > > > linear_extrude(height=10)polygon(p(i)); > > > end > > > > > > That would be great, but for now it works perfectly... > > > > Add another dimension to the array and import into a single > > variable? > > > > ciao, > > Torsten. > > > > > > _______________________________________________ > > OpenSCAD mailing list > > Discuss@lists.openscad.org > > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >