A
AdrianSchlatter
Wed, May 8, 2019 5:01 PM
I‘m looking for a way to render a .scad file and get the number of rendered
volumes in a machine-readable way - i.e. on the cmdline. Purpose: unit
testing. I‘m creating a library of threads (hundreds) and want to verify
that nuts and bolts are created as exactly one part each, and that a bolt
does not collide with its mating nut. Idea: render nut + bolt. Check number
of volumes:
1: what the Heck?!
2: collision
3: ok
=4: Something is detached (e.g. thread not attached to bolt)
My problem: OpenSCAD prints the number of volumes when run in GUI. I have
not found a way to make it print that info on cmd line. Any ideas?
Best regards, Adrian
--
Sent from: http://forum.openscad.org/
I‘m looking for a way to render a .scad file and get the number of rendered
volumes in a machine-readable way - i.e. on the cmdline. Purpose: unit
testing. I‘m creating a library of threads (hundreds) and want to verify
that nuts and bolts are created as exactly one part each, and that a bolt
does not collide with its mating nut. Idea: render nut + bolt. Check number
of volumes:
1: what the Heck?!
2: collision
3: ok
>=4: Something is detached (e.g. thread not attached to bolt)
My problem: OpenSCAD prints the number of volumes when run in GUI. I have
not found a way to make it print that info on cmd line. Any ideas?
Best regards, Adrian
--
Sent from: http://forum.openscad.org/
CA
Carsten Arnholm
Wed, May 8, 2019 7:51 PM
On 08.05.2019 19:01, AdrianSchlatter wrote:
My problem: OpenSCAD prints the number of volumes when run in GUI. I have
not found a way to make it print that info on cmd line. Any ideas?
The first problem seems to be that the number of volumes OpenSCAD prints
is incorrect. For example
cubes.scad
n=5;
for(i=[1:n]) {
echo(i);
translate([i*20,0,0])cube(10);
}
You get 5 echoes, but in the GUI console it says
Simple: yes
Vertices: 40
Halfedges: 120
Edges: 60
Halffacets: 60
Facets: 30
Volumes: 6
Rendering finished.
So the number of volumes reported by OpenSCAD is off by one. Aside from
that minor issue, you can use an external program to count the volumes
in a machine-readable way if OpenSCAD can not do it.
Here is one way to do it:
Assuming the OS is Linux (similar for Windows), prepare 2 files in the
same folder, a bash script and a minimal .as file.
Note that the term 'lump' below is equivalent to OpenSCAD 'volume'.
count_lumps.sh
#!/bin/bash
openscad -o temp_file.off $1
as_csg ./count_lumps.as > /dev/null
xcsg --stl temp_file.xcsg | grep lump
rm temp_file.*
count_lumps.as
void main() {
polyhedron("temp_file.off").write_xcsg("temp_file");
}
Run count_lumps.sh with OpenSCAD input
$ ./count_lumps.sh cubes.scad
ECHO: 1
ECHO: 2
ECHO: 3
ECHO: 4
ECHO: 5
...result model contains 5 lumps.
...lump 1: 8 vertices, 12 polygon faces.
...lump 2: 8 vertices, 12 polygon faces.
...lump 3: 8 vertices, 12 polygon faces.
...lump 4: 8 vertices, 12 polygon faces.
...lump 5: 8 vertices, 12 polygon faces.
What happens in the script is
- openscad generates .off file from .scad
- as_csg converts .off to .xcsg (silently)
- xcsg reads .xcsg and prints (filtered with grep here)
- Temporary files are removed (silently)
If you skip piping to grep you get more detailed information. If you
instead replace 'grep lump' with 'grep lumps' you get only the
information you asked for:
...result model contains 5 lumps.
as_csg and xcsg are installed with AngelCAD
https://github.com/arnholm/angelcad/releases
Kind Regards
Carsten Arnholm
On 08.05.2019 19:01, AdrianSchlatter wrote:
> My problem: OpenSCAD prints the number of volumes when run in GUI. I have
> not found a way to make it print that info on cmd line. Any ideas?
The first problem seems to be that the number of volumes OpenSCAD prints
is incorrect. For example
cubes.scad
---
n=5;
for(i=[1:n]) {
echo(i);
translate([i*20,0,0])cube(10);
}
---
You get 5 echoes, but in the GUI console it says
Simple: yes
Vertices: 40
Halfedges: 120
Edges: 60
Halffacets: 60
Facets: 30
Volumes: 6
Rendering finished.
So the number of volumes reported by OpenSCAD is off by one. Aside from
that minor issue, you can use an external program to count the volumes
in a machine-readable way if OpenSCAD can not do it.
Here is one way to do it:
Assuming the OS is Linux (similar for Windows), prepare 2 files in the
same folder, a bash script and a minimal .as file.
Note that the term 'lump' below is equivalent to OpenSCAD 'volume'.
count_lumps.sh
---
#!/bin/bash
openscad -o temp_file.off $1
as_csg ./count_lumps.as > /dev/null
xcsg --stl temp_file.xcsg | grep lump
rm temp_file.*
---
count_lumps.as
---
void main() {
polyhedron("temp_file.off").write_xcsg("temp_file");
}
---
Run count_lumps.sh with OpenSCAD input
$ ./count_lumps.sh cubes.scad
ECHO: 1
ECHO: 2
ECHO: 3
ECHO: 4
ECHO: 5
...result model contains 5 lumps.
...lump 1: 8 vertices, 12 polygon faces.
...lump 2: 8 vertices, 12 polygon faces.
...lump 3: 8 vertices, 12 polygon faces.
...lump 4: 8 vertices, 12 polygon faces.
...lump 5: 8 vertices, 12 polygon faces.
What happens in the script is
1. openscad generates .off file from .scad
2. as_csg converts .off to .xcsg (silently)
3. xcsg reads .xcsg and prints (filtered with grep here)
4. Temporary files are removed (silently)
If you skip piping to grep you get more detailed information. If you
instead replace 'grep lump' with 'grep lumps' you get only the
information you asked for:
...result model contains 5 lumps.
as_csg and xcsg are installed with AngelCAD
https://github.com/arnholm/angelcad/releases
Kind Regards
Carsten Arnholm
RD
Revar Desmera
Wed, May 8, 2019 11:06 PM
I believe the extra volume is that which is NOT bound by the part. The perimeter of the part divides all space into 2 separate volumes.
On May 8, 2019, at 12:51 PM, Carsten Arnholm arnholm@arnholm.org wrote:
On 08.05.2019 19:01, AdrianSchlatter wrote:
My problem: OpenSCAD prints the number of volumes when run in GUI. I have
not found a way to make it print that info on cmd line. Any ideas?
The first problem seems to be that the number of volumes OpenSCAD prints is incorrect. For example
cubes.scad
n=5;
for(i=[1:n]) {
echo(i);
translate([i*20,0,0])cube(10);
}
You get 5 echoes, but in the GUI console it says
Simple: yes
Vertices: 40
Halfedges: 120
Edges: 60
Halffacets: 60
Facets: 30
Volumes: 6
Rendering finished.
So the number of volumes reported by OpenSCAD is off by one. Aside from that minor issue, you can use an external program to count the volumes in a machine-readable way if OpenSCAD can not do it.
Here is one way to do it:
Assuming the OS is Linux (similar for Windows), prepare 2 files in the same folder, a bash script and a minimal .as file.
Note that the term 'lump' below is equivalent to OpenSCAD 'volume'.
count_lumps.sh
#!/bin/bash
openscad -o temp_file.off $1
as_csg ./count_lumps.as > /dev/null
xcsg --stl temp_file.xcsg | grep lump
rm temp_file.*
count_lumps.as
void main() {
polyhedron("temp_file.off").write_xcsg("temp_file");
}
Run count_lumps.sh with OpenSCAD input
$ ./count_lumps.sh cubes.scad
ECHO: 1
ECHO: 2
ECHO: 3
ECHO: 4
ECHO: 5
...result model contains 5 lumps.
...lump 1: 8 vertices, 12 polygon faces.
...lump 2: 8 vertices, 12 polygon faces.
...lump 3: 8 vertices, 12 polygon faces.
...lump 4: 8 vertices, 12 polygon faces.
...lump 5: 8 vertices, 12 polygon faces.
What happens in the script is
- openscad generates .off file from .scad
- as_csg converts .off to .xcsg (silently)
- xcsg reads .xcsg and prints (filtered with grep here)
- Temporary files are removed (silently)
If you skip piping to grep you get more detailed information. If you instead replace 'grep lump' with 'grep lumps' you get only the information you asked for:
...result model contains 5 lumps.
as_csg and xcsg are installed with AngelCAD
https://github.com/arnholm/angelcad/releases
Kind Regards
Carsten Arnholm
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
I believe the extra volume is that which is NOT bound by the part. The perimeter of the part divides all space into 2 separate volumes.
- Revar
> On May 8, 2019, at 12:51 PM, Carsten Arnholm <arnholm@arnholm.org> wrote:
>
> On 08.05.2019 19:01, AdrianSchlatter wrote:
>> My problem: OpenSCAD prints the number of volumes when run in GUI. I have
>> not found a way to make it print that info on cmd line. Any ideas?
>
> The first problem seems to be that the number of volumes OpenSCAD prints is incorrect. For example
>
> cubes.scad
> ---
> n=5;
> for(i=[1:n]) {
> echo(i);
> translate([i*20,0,0])cube(10);
> }
> ---
>
> You get 5 echoes, but in the GUI console it says
>
> Simple: yes
> Vertices: 40
> Halfedges: 120
> Edges: 60
> Halffacets: 60
> Facets: 30
> Volumes: 6
> Rendering finished.
>
> So the number of volumes reported by OpenSCAD is off by one. Aside from that minor issue, you can use an external program to count the volumes in a machine-readable way if OpenSCAD can not do it.
>
> Here is one way to do it:
>
> Assuming the OS is Linux (similar for Windows), prepare 2 files in the same folder, a bash script and a minimal .as file.
>
> Note that the term 'lump' below is equivalent to OpenSCAD 'volume'.
>
> count_lumps.sh
> ---
> #!/bin/bash
> openscad -o temp_file.off $1
> as_csg ./count_lumps.as > /dev/null
> xcsg --stl temp_file.xcsg | grep lump
> rm temp_file.*
> ---
>
> count_lumps.as
> ---
> void main() {
> polyhedron("temp_file.off").write_xcsg("temp_file");
> }
> ---
>
> Run count_lumps.sh with OpenSCAD input
>
> $ ./count_lumps.sh cubes.scad
> ECHO: 1
> ECHO: 2
> ECHO: 3
> ECHO: 4
> ECHO: 5
> ...result model contains 5 lumps.
> ...lump 1: 8 vertices, 12 polygon faces.
> ...lump 2: 8 vertices, 12 polygon faces.
> ...lump 3: 8 vertices, 12 polygon faces.
> ...lump 4: 8 vertices, 12 polygon faces.
> ...lump 5: 8 vertices, 12 polygon faces.
>
> What happens in the script is
> 1. openscad generates .off file from .scad
> 2. as_csg converts .off to .xcsg (silently)
> 3. xcsg reads .xcsg and prints (filtered with grep here)
> 4. Temporary files are removed (silently)
>
> If you skip piping to grep you get more detailed information. If you instead replace 'grep lump' with 'grep lumps' you get only the information you asked for:
>
> ...result model contains 5 lumps.
>
> as_csg and xcsg are installed with AngelCAD
> https://github.com/arnholm/angelcad/releases
>
> Kind Regards
> Carsten Arnholm
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
RD
Revar Desmera
Wed, May 8, 2019 11:09 PM
Have you tried adding --render
to the command-line?
On May 8, 2019, at 10:01 AM, AdrianSchlatter ad@tambora.ch wrote:
I‘m looking for a way to render a .scad file and get the number of rendered
volumes in a machine-readable way - i.e. on the cmdline. Purpose: unit
testing. I‘m creating a library of threads (hundreds) and want to verify
that nuts and bolts are created as exactly one part each, and that a bolt
does not collide with its mating nut. Idea: render nut + bolt. Check number
of volumes:
1: what the Heck?!
2: collision
3: ok
=4: Something is detached (e.g. thread not attached to bolt)
Have you tried adding `--render` to the command-line?
- Revar
> On May 8, 2019, at 10:01 AM, AdrianSchlatter <ad@tambora.ch> wrote:
>
> I‘m looking for a way to render a .scad file and get the number of rendered
> volumes in a machine-readable way - i.e. on the cmdline. Purpose: unit
> testing. I‘m creating a library of threads (hundreds) and want to verify
> that nuts and bolts are created as exactly one part each, and that a bolt
> does not collide with its mating nut. Idea: render nut + bolt. Check number
> of volumes:
>
> 1: what the Heck?!
> 2: collision
> 3: ok
>> =4: Something is detached (e.g. thread not attached to bolt)
>
> My problem: OpenSCAD prints the number of volumes when run in GUI. I have
> not found a way to make it print that info on cmd line. Any ideas?
>
> Best regards, Adrian
>
>
>
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
A
AdrianSchlatter
Thu, May 9, 2019 6:39 PM
Yep, tried that. OpenSCAD remains silent.
--
Sent from: http://forum.openscad.org/
Yep, tried that. OpenSCAD remains silent.
--
Sent from: http://forum.openscad.org/
A
AdrianSchlatter
Thu, May 9, 2019 6:53 PM
Carsten,
Sounds good to me, thanks for the help. Can I compile AngelCAD on MacOS?
Linux is ok for CI server, of course, but it would be nice to run the tests
locally as well.
Best regards,
Adrian
--
Sent from: http://forum.openscad.org/
Carsten,
Sounds good to me, thanks for the help. Can I compile AngelCAD on MacOS?
Linux is ok for CI server, of course, but it would be nice to run the tests
locally as well.
Best regards,
Adrian
--
Sent from: http://forum.openscad.org/
CA
Carsten Arnholm
Thu, May 9, 2019 7:22 PM
On 09.05.2019 20:53, AdrianSchlatter wrote:
Carsten,
Sounds good to me, thanks for the help. Can I compile AngelCAD on MacOS?
Linux is ok for CI server, of course, but it would be nice to run the tests
locally as well.
I don't see anything in principle for it not to work, but I have no
particular interest in or experience with MacOS, so I have done 'only'
Windows and Linux. It is possible on the Mac with some dedication, but
it would be a new os port. All the tools & components are available I think.
Alternatively install a virtual machine with Ubuntu on the Mac, or
simply get OpenSCAD to report to the console :-)
Regards
Carsten Arnholm
On 09.05.2019 20:53, AdrianSchlatter wrote:
> Carsten,
>
> Sounds good to me, thanks for the help. Can I compile AngelCAD on MacOS?
> Linux is ok for CI server, of course, but it would be nice to run the tests
> locally as well.
I don't see anything in principle for it not to work, but I have no
particular interest in or experience with MacOS, so I have done 'only'
Windows and Linux. It is possible on the Mac with some dedication, but
it would be a new os port. All the tools & components are available I think.
Alternatively install a virtual machine with Ubuntu on the Mac, or
simply get OpenSCAD to report to the console :-)
Regards
Carsten Arnholm
NH
nop head
Thu, May 9, 2019 7:26 PM
The code that prints the volumes is part of the GUI so it doesn't happen
when running without a GUI. It is here:
https://github.com/openscad/openscad/blob/master/src/mainwin.cc#L2276
I don't think it would be a big job to move it to openscad.cc and call it
from mainwin.cc. Perhaps a command line option to enable it as most people
probably don't want the extra noise.
On Thu, 9 May 2019 at 19:54, AdrianSchlatter ad@tambora.ch wrote:
The code that prints the volumes is part of the GUI so it doesn't happen
when running without a GUI. It is here:
https://github.com/openscad/openscad/blob/master/src/mainwin.cc#L2276
I don't think it would be a big job to move it to openscad.cc and call it
from mainwin.cc. Perhaps a command line option to enable it as most people
probably don't want the extra noise.
On Thu, 9 May 2019 at 19:54, AdrianSchlatter <ad@tambora.ch> wrote:
> Carsten,
>
> Sounds good to me, thanks for the help. Can I compile AngelCAD on MacOS?
> Linux is ok for CI server, of course, but it would be nice to run the tests
> locally as well.
>
> Best regards,
> Adrian
>
>
>
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
HL
Hans L
Thu, May 9, 2019 10:42 PM
Yep. The inside of your geometries define one volume each, and infinite
void outside the geometry is the other volume. That's just how CGAL
represents volumes. In other words, "It's not a bug, its a feature" ;)
Hans
On Wed, May 8, 2019 at 6:07 PM Revar Desmera revarbat@gmail.com wrote:
I believe the extra volume is that which is NOT bound by the part. The
perimeter of the part divides all space into 2 separate volumes.
On 08.05.2019 19:01, AdrianSchlatter wrote:
My problem: OpenSCAD prints the number of volumes when run in GUI. I
not found a way to make it print that info on cmd line. Any ideas?
The first problem seems to be that the number of volumes OpenSCAD prints
is incorrect. For example
cubes.scad
n=5;
for(i=[1:n]) {
echo(i);
translate([i*20,0,0])cube(10);
}
You get 5 echoes, but in the GUI console it says
Simple: yes
Vertices: 40
Halfedges: 120
Edges: 60
Halffacets: 60
Facets: 30
Volumes: 6
Rendering finished.
So the number of volumes reported by OpenSCAD is off by one. Aside from
that minor issue, you can use an external program to count the volumes in a
machine-readable way if OpenSCAD can not do it.
Here is one way to do it:
Assuming the OS is Linux (similar for Windows), prepare 2 files in the
same folder, a bash script and a minimal .as file.
Note that the term 'lump' below is equivalent to OpenSCAD 'volume'.
count_lumps.sh
#!/bin/bash
openscad -o temp_file.off $1
as_csg ./count_lumps.as > /dev/null
xcsg --stl temp_file.xcsg | grep lump
rm temp_file.*
count_lumps.as
void main() {
polyhedron("temp_file.off").write_xcsg("temp_file");
}
Run count_lumps.sh with OpenSCAD input
$ ./count_lumps.sh cubes.scad
ECHO: 1
ECHO: 2
ECHO: 3
ECHO: 4
ECHO: 5
...result model contains 5 lumps.
...lump 1: 8 vertices, 12 polygon faces.
...lump 2: 8 vertices, 12 polygon faces.
...lump 3: 8 vertices, 12 polygon faces.
...lump 4: 8 vertices, 12 polygon faces.
...lump 5: 8 vertices, 12 polygon faces.
What happens in the script is
- openscad generates .off file from .scad
- as_csg converts .off to .xcsg (silently)
- xcsg reads .xcsg and prints (filtered with grep here)
- Temporary files are removed (silently)
If you skip piping to grep you get more detailed information. If you
instead replace 'grep lump' with 'grep lumps' you get only the information
you asked for:
Yep. The inside of your geometries define one volume each, and infinite
void outside the geometry is the other volume. That's just how CGAL
represents volumes. In other words, "It's not a bug, its a feature" ;)
Hans
On Wed, May 8, 2019 at 6:07 PM Revar Desmera <revarbat@gmail.com> wrote:
> I believe the extra volume is that which is NOT bound by the part. The
> perimeter of the part divides all space into 2 separate volumes.
>
> - Revar
>
>
> > On May 8, 2019, at 12:51 PM, Carsten Arnholm <arnholm@arnholm.org>
> wrote:
> >
> > On 08.05.2019 19:01, AdrianSchlatter wrote:
> >> My problem: OpenSCAD prints the number of volumes when run in GUI. I
> have
> >> not found a way to make it print that info on cmd line. Any ideas?
> >
> > The first problem seems to be that the number of volumes OpenSCAD prints
> is incorrect. For example
> >
> > cubes.scad
> > ---
> > n=5;
> > for(i=[1:n]) {
> > echo(i);
> > translate([i*20,0,0])cube(10);
> > }
> > ---
> >
> > You get 5 echoes, but in the GUI console it says
> >
> > Simple: yes
> > Vertices: 40
> > Halfedges: 120
> > Edges: 60
> > Halffacets: 60
> > Facets: 30
> > Volumes: 6
> > Rendering finished.
> >
> > So the number of volumes reported by OpenSCAD is off by one. Aside from
> that minor issue, you can use an external program to count the volumes in a
> machine-readable way if OpenSCAD can not do it.
> >
> > Here is one way to do it:
> >
> > Assuming the OS is Linux (similar for Windows), prepare 2 files in the
> same folder, a bash script and a minimal .as file.
> >
> > Note that the term 'lump' below is equivalent to OpenSCAD 'volume'.
> >
> > count_lumps.sh
> > ---
> > #!/bin/bash
> > openscad -o temp_file.off $1
> > as_csg ./count_lumps.as > /dev/null
> > xcsg --stl temp_file.xcsg | grep lump
> > rm temp_file.*
> > ---
> >
> > count_lumps.as
> > ---
> > void main() {
> > polyhedron("temp_file.off").write_xcsg("temp_file");
> > }
> > ---
> >
> > Run count_lumps.sh with OpenSCAD input
> >
> > $ ./count_lumps.sh cubes.scad
> > ECHO: 1
> > ECHO: 2
> > ECHO: 3
> > ECHO: 4
> > ECHO: 5
> > ...result model contains 5 lumps.
> > ...lump 1: 8 vertices, 12 polygon faces.
> > ...lump 2: 8 vertices, 12 polygon faces.
> > ...lump 3: 8 vertices, 12 polygon faces.
> > ...lump 4: 8 vertices, 12 polygon faces.
> > ...lump 5: 8 vertices, 12 polygon faces.
> >
> > What happens in the script is
> > 1. openscad generates .off file from .scad
> > 2. as_csg converts .off to .xcsg (silently)
> > 3. xcsg reads .xcsg and prints (filtered with grep here)
> > 4. Temporary files are removed (silently)
> >
> > If you skip piping to grep you get more detailed information. If you
> instead replace 'grep lump' with 'grep lumps' you get only the information
> you asked for:
> >
> > ...result model contains 5 lumps.
> >
> > as_csg and xcsg are installed with AngelCAD
> > https://github.com/arnholm/angelcad/releases
> >
> > Kind Regards
> > Carsten Arnholm
> >
> > _______________________________________________
> > 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
>
A
AdrianSchlatter
Tue, May 14, 2019 7:45 PM
That clearly means it cannot be done with today’s openscad. It can be done by
changing openscad (as you outlined) or by using third party tools (as
outlined by Carsten). If this would be an urgent problem, I’d go for
Carsten’s AngelCAD. It’s not urgent, therefore I’ll avoid that extra
dependency for now.
Am I the only one interested in that feature? Or is this a use case others
have as well? Should the suggested command line option provide additional
information to be more useful for unit testing?
Regards, Adrian
nophead wrote
The code that prints the volumes is part of the GUI so it doesn't happen
when running without a GUI. It is here:
https://github.com/openscad/openscad/blob/master/src/mainwin.cc#L2276
I don't think it would be a big job to move it to openscad.cc and call it
from mainwin.cc. Perhaps a command line option to enable it as most
people
probably don't want the extra noise.
That clearly means it cannot be done with today’s openscad. It can be done by
changing openscad (as you outlined) or by using third party tools (as
outlined by Carsten). If this would be an urgent problem, I’d go for
Carsten’s AngelCAD. It’s not urgent, therefore I’ll avoid that extra
dependency for now.
Am I the only one interested in that feature? Or is this a use case others
have as well? Should the suggested command line option provide additional
information to be more useful for unit testing?
Regards, Adrian
nophead wrote
> The code that prints the volumes is part of the GUI so it doesn't happen
> when running without a GUI. It is here:
> https://github.com/openscad/openscad/blob/master/src/mainwin.cc#L2276
>
> I don't think it would be a big job to move it to openscad.cc and call it
> from mainwin.cc. Perhaps a command line option to enable it as most
> people
> probably don't want the extra noise.
--
Sent from: http://forum.openscad.org/