J
jon
Mon, Dec 29, 2014 1:49 PM
Is there any easy way to compute the volume of an OpenSCAD object? I am
making molds, and wonder if OpenSCAD can tell me how much material to
prepare for a casting.
Jon
Is there any easy way to compute the volume of an OpenSCAD object? I am
making molds, and wonder if OpenSCAD can tell me how much material to
prepare for a casting.
Jon
EW
Ehlert, Wolfgang
Mon, Dec 29, 2014 2:10 PM
below you can find the formula to calculate the volume from the triangles (faces). I am not a programmer, but skilled enough to test it with Javascript. It works fine but I can't put it inside OpenScad. If somebody could implement it, it would be fine to see the result not only as part of the message window, but also offering the opportunity to export the result in any way, so I can make use of it in our software.
/xyz=[
0, 0, 3000,
5000, 0, 3000,
5000, 200, 3000,
0, 200, 3000,
0, 200, 0,
5000, 200, 0,
5000, 0, 0,
0, 0, 0,
1000, 200, 0,
2000, 200, 0,
1000, 0, 0,
2000, 0, 0,
1000, 0, 2000,
2000, 0, 2000,
1000, 200, 2000,
2000, 200, 2000];
p=[
7, 0, 4,
4, 0, 3,
0, 7, 10,
13, 0, 12,
12, 0, 10,
1, 0, 13,
6, 13, 11,
1, 13, 6,
7, 4, 10,
10, 4, 8,
4, 3, 8,
15, 3, 2,
9, 2, 5,
14, 3, 15,
8, 3, 14,
15, 2, 9,
3, 0, 1,
2, 3, 1,
1, 6, 5,
2, 1, 5,
11, 9, 6,
6, 9, 5,
15, 9, 13,
13, 9, 11,
15, 13, 14,
14, 13, 12,
8, 14, 12,
10, 8, 12];/
xyz=[
0, 0, 3000,
5000, 0, 3000,
5000, 200, 3000,
0, 200, 3000,
0, 200, 0,
5000, 200, 0,
5000, 0, 0,
0, 0, 0,
1000, 0,2000,
1000, 0, 1000,
3000, 0, 2000,
3000, 0, 1000,
1000, 200, 2000,
1000, 200, 1000,
3000, 200, 2000,
3000, 200, 1000];
p=[
7, 0, 4,
4, 0, 3,
9, 7, 6,
11, 9, 6,
0, 7, 9,
0, 9, 8,
1, 10, 6,
1, 0, 10,
10, 11, 6,
8, 10, 0,
7, 4, 6,
6, 4, 5,
14, 3, 2,
4, 3, 12,
13, 15, 5,
4, 12, 13,
4, 13, 5,
5, 14, 2,
12, 3,14,
14, 5, 15,
3, 0, 1,
2, 3, 1,
1, 6, 5,
2, 1, 5,
13, 12, 8,
9, 13, 8,
11, 15, 13,
9, 11, 13,
14, 15, 10,
10, 15, 11,
14, 10, 12,
12, 10, 8];
j=0;k=(p.length)/3;Vol=0.0;console.log(k);
for (var i=0;i<k;i++) {
console.log(j,'=j',p[j],p[j+1],p[j+2]);
p1x=xyz[p[j]3+0];p2x=xyz[p[j+1]3+0];p3x=xyz[p[j+2]3+0];
p1y=xyz[p[j]3+1];p2y=xyz[p[j+1]3+1];p3y=xyz[p[j+2]3+1];
p1z=xyz[p[j]3+2];p2z=xyz[p[j+1]3+2];p3z=xyz[p[j+2]3+2];
var v321 = p3xp2yp1z;
var v231 = p2xp3yp1z;
var v312 = p3xp1yp2z;
var v132 = p1xp3yp2z;
var v213 = p2xp1yp3z;
var v123 = p1xp2y*p3z;
v=(-v321 + v231 + v312 - v132 - v213 + v123)/6;
console.log('p1',p1x,p1y,p1z,'p2',p2x,p2y,p2z,'p3',p3x,p3y,p3z,'v',v);
j=j+3;Vol=Vol+v; }
console.log(Vol);
Kind regards
Wolfgang Ehlert
-----Ursprüngliche Nachricht-----
Von: Discuss [mailto:discuss-bounces@lists.openscad.org] Im Auftrag von jon
Gesendet: Montag, 29. Dezember 2014 14:49
An: discuss@lists.openscad.org
Betreff: [OpenSCAD] volume measurements
Is there any easy way to compute the volume of an OpenSCAD object? I am making molds, and wonder if OpenSCAD can tell me how much material to prepare for a casting.
Jon
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
below you can find the formula to calculate the volume from the triangles (faces). I am not a programmer, but skilled enough to test it with Javascript. It works fine but I can't put it inside OpenScad. If somebody could implement it, it would be fine to see the result not only as part of the message window, but also offering the opportunity to export the result in any way, so I can make use of it in our software.
/*xyz=[
0, 0, 3000,
5000, 0, 3000,
5000, 200, 3000,
0, 200, 3000,
0, 200, 0,
5000, 200, 0,
5000, 0, 0,
0, 0, 0,
1000, 200, 0,
2000, 200, 0,
1000, 0, 0,
2000, 0, 0,
1000, 0, 2000,
2000, 0, 2000,
1000, 200, 2000,
2000, 200, 2000];
p=[
7, 0, 4,
4, 0, 3,
0, 7, 10,
13, 0, 12,
12, 0, 10,
1, 0, 13,
6, 13, 11,
1, 13, 6,
7, 4, 10,
10, 4, 8,
4, 3, 8,
15, 3, 2,
9, 2, 5,
14, 3, 15,
8, 3, 14,
15, 2, 9,
3, 0, 1,
2, 3, 1,
1, 6, 5,
2, 1, 5,
11, 9, 6,
6, 9, 5,
15, 9, 13,
13, 9, 11,
15, 13, 14,
14, 13, 12,
8, 14, 12,
10, 8, 12];*/
xyz=[
0, 0, 3000,
5000, 0, 3000,
5000, 200, 3000,
0, 200, 3000,
0, 200, 0,
5000, 200, 0,
5000, 0, 0,
0, 0, 0,
1000, 0,2000,
1000, 0, 1000,
3000, 0, 2000,
3000, 0, 1000,
1000, 200, 2000,
1000, 200, 1000,
3000, 200, 2000,
3000, 200, 1000];
p=[
7, 0, 4,
4, 0, 3,
9, 7, 6,
11, 9, 6,
0, 7, 9,
0, 9, 8,
1, 10, 6,
1, 0, 10,
10, 11, 6,
8, 10, 0,
7, 4, 6,
6, 4, 5,
14, 3, 2,
4, 3, 12,
13, 15, 5,
4, 12, 13,
4, 13, 5,
5, 14, 2,
12, 3,14,
14, 5, 15,
3, 0, 1,
2, 3, 1,
1, 6, 5,
2, 1, 5,
13, 12, 8,
9, 13, 8,
11, 15, 13,
9, 11, 13,
14, 15, 10,
10, 15, 11,
14, 10, 12,
12, 10, 8];
j=0;k=(p.length)/3;Vol=0.0;console.log(k);
for (var i=0;i<k;i++) {
console.log(j,'=j',p[j],p[j+1],p[j+2]);
p1x=xyz[p[j]*3+0];p2x=xyz[p[j+1]*3+0];p3x=xyz[p[j+2]*3+0];
p1y=xyz[p[j]*3+1];p2y=xyz[p[j+1]*3+1];p3y=xyz[p[j+2]*3+1];
p1z=xyz[p[j]*3+2];p2z=xyz[p[j+1]*3+2];p3z=xyz[p[j+2]*3+2];
var v321 = p3x*p2y*p1z;
var v231 = p2x*p3y*p1z;
var v312 = p3x*p1y*p2z;
var v132 = p1x*p3y*p2z;
var v213 = p2x*p1y*p3z;
var v123 = p1x*p2y*p3z;
v=(-v321 + v231 + v312 - v132 - v213 + v123)/6;
console.log('p1',p1x,p1y,p1z,'p2',p2x,p2y,p2z,'p3',p3x,p3y,p3z,'v',v);
j=j+3;Vol=Vol+v; }
console.log(Vol);
Kind regards
Wolfgang Ehlert
-----Ursprüngliche Nachricht-----
Von: Discuss [mailto:discuss-bounces@lists.openscad.org] Im Auftrag von jon
Gesendet: Montag, 29. Dezember 2014 14:49
An: discuss@lists.openscad.org
Betreff: [OpenSCAD] volume measurements
Is there any easy way to compute the volume of an OpenSCAD object? I am making molds, and wonder if OpenSCAD can tell me how much material to prepare for a casting.
Jon
_______________________________________________
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
AG
Alex Gibson
Mon, Dec 29, 2014 6:31 PM
Cheat's way: Open it in a slicer for 3d printing, set to 100% infill, no
raft, brim or support, and from the estimate of quantity of filament used,
get the volume...
-----Original Message-----
From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of
Ehlert, Wolfgang
Sent: 29 December 2014 14:10
To: OpenSCAD general discussion
Subject: Re: [OpenSCAD] volume measurements
below you can find the formula to calculate the volume from the triangles
(faces). I am not a programmer, but skilled enough to test it with
Javascript. It works fine but I can't put it inside OpenScad. If somebody
could implement it, it would be fine to see the result not only as part of
the message window, but also offering the opportunity to export the result
in any way, so I can make use of it in our software.
/xyz=[
0, 0, 3000,
5000, 0, 3000,
5000, 200, 3000,
0, 200, 3000,
0, 200, 0,
5000, 200, 0,
5000, 0, 0,
0, 0, 0,
1000, 200, 0,
2000, 200, 0,
1000, 0, 0,
2000, 0, 0,
1000, 0, 2000,
2000, 0, 2000,
1000, 200, 2000,
2000, 200, 2000];
p=[
7, 0, 4,
4, 0, 3,
0, 7, 10,
13, 0, 12,
12, 0, 10,
1, 0, 13,
6, 13, 11,
1, 13, 6,
7, 4, 10,
10, 4, 8,
4, 3, 8,
15, 3, 2,
9, 2, 5,
14, 3, 15,
8, 3, 14,
15, 2, 9,
3, 0, 1,
2, 3, 1,
1, 6, 5,
2, 1, 5,
11, 9, 6,
6, 9, 5,
15, 9, 13,
13, 9, 11,
15, 13, 14,
14, 13, 12,
8, 14, 12,
10, 8, 12];/
xyz=[
0, 0, 3000,
5000, 0, 3000,
5000, 200, 3000,
0, 200, 3000,
0, 200, 0,
5000, 200, 0,
5000, 0, 0,
0, 0, 0,
1000, 0,2000,
1000, 0, 1000,
3000, 0, 2000,
3000, 0, 1000,
1000, 200, 2000,
1000, 200, 1000,
3000, 200, 2000,
3000, 200, 1000];
p=[
7, 0, 4,
4, 0, 3,
9, 7, 6,
11, 9, 6,
0, 7, 9,
0, 9, 8,
1, 10, 6,
1, 0, 10,
10, 11, 6,
8, 10, 0,
7, 4, 6,
6, 4, 5,
14, 3, 2,
4, 3, 12,
13, 15, 5,
4, 12, 13,
4, 13, 5,
5, 14, 2,
12, 3,14,
14, 5, 15,
3, 0, 1,
2, 3, 1,
1, 6, 5,
2, 1, 5,
13, 12, 8,
9, 13, 8,
11, 15, 13,
9, 11, 13,
14, 15, 10,
10, 15, 11,
14, 10, 12,
12, 10, 8];
j=0;k=(p.length)/3;Vol=0.0;console.log(k);
for (var i=0;i<k;i++) {
console.log(j,'=j',p[j],p[j+1],p[j+2]);
p1x=xyz[p[j]3+0];p2x=xyz[p[j+1]3+0];p3x=xyz[p[j+2]3+0];
p1y=xyz[p[j]3+1];p2y=xyz[p[j+1]3+1];p3y=xyz[p[j+2]3+1];
p1z=xyz[p[j]3+2];p2z=xyz[p[j+1]3+2];p3z=xyz[p[j+2]3+2];
var v321 = p3xp2yp1z;
var v231 = p2xp3yp1z;
var v312 = p3xp1yp2z;
var v132 = p1xp3yp2z;
var v213 = p2xp1yp3z;
var v123 = p1xp2y*p3z;
v=(-v321 + v231 + v312 - v132 - v213 + v123)/6;
console.log('p1',p1x,p1y,p1z,'p2',p2x,p2y,p2z,'p3',p3x,p3y,p3z,'v',v);
j=j+3;Vol=Vol+v; }
console.log(Vol);
Kind regards
Wolfgang Ehlert
-----Ursprüngliche Nachricht-----
Von: Discuss [mailto:discuss-bounces@lists.openscad.org] Im Auftrag von jon
Gesendet: Montag, 29. Dezember 2014 14:49
An: discuss@lists.openscad.org
Betreff: [OpenSCAD] volume measurements
Is there any easy way to compute the volume of an OpenSCAD object? I am
making molds, and wonder if OpenSCAD can tell me how much material to
prepare for a casting.
Jon
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
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5577 / Virus Database: 4257/8830 - Release Date: 12/29/14
Cheat's way: Open it in a slicer for 3d printing, set to 100% infill, no
raft, brim or support, and from the estimate of quantity of filament used,
get the volume...
-----Original Message-----
From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of
Ehlert, Wolfgang
Sent: 29 December 2014 14:10
To: OpenSCAD general discussion
Subject: Re: [OpenSCAD] volume measurements
below you can find the formula to calculate the volume from the triangles
(faces). I am not a programmer, but skilled enough to test it with
Javascript. It works fine but I can't put it inside OpenScad. If somebody
could implement it, it would be fine to see the result not only as part of
the message window, but also offering the opportunity to export the result
in any way, so I can make use of it in our software.
/*xyz=[
0, 0, 3000,
5000, 0, 3000,
5000, 200, 3000,
0, 200, 3000,
0, 200, 0,
5000, 200, 0,
5000, 0, 0,
0, 0, 0,
1000, 200, 0,
2000, 200, 0,
1000, 0, 0,
2000, 0, 0,
1000, 0, 2000,
2000, 0, 2000,
1000, 200, 2000,
2000, 200, 2000];
p=[
7, 0, 4,
4, 0, 3,
0, 7, 10,
13, 0, 12,
12, 0, 10,
1, 0, 13,
6, 13, 11,
1, 13, 6,
7, 4, 10,
10, 4, 8,
4, 3, 8,
15, 3, 2,
9, 2, 5,
14, 3, 15,
8, 3, 14,
15, 2, 9,
3, 0, 1,
2, 3, 1,
1, 6, 5,
2, 1, 5,
11, 9, 6,
6, 9, 5,
15, 9, 13,
13, 9, 11,
15, 13, 14,
14, 13, 12,
8, 14, 12,
10, 8, 12];*/
xyz=[
0, 0, 3000,
5000, 0, 3000,
5000, 200, 3000,
0, 200, 3000,
0, 200, 0,
5000, 200, 0,
5000, 0, 0,
0, 0, 0,
1000, 0,2000,
1000, 0, 1000,
3000, 0, 2000,
3000, 0, 1000,
1000, 200, 2000,
1000, 200, 1000,
3000, 200, 2000,
3000, 200, 1000];
p=[
7, 0, 4,
4, 0, 3,
9, 7, 6,
11, 9, 6,
0, 7, 9,
0, 9, 8,
1, 10, 6,
1, 0, 10,
10, 11, 6,
8, 10, 0,
7, 4, 6,
6, 4, 5,
14, 3, 2,
4, 3, 12,
13, 15, 5,
4, 12, 13,
4, 13, 5,
5, 14, 2,
12, 3,14,
14, 5, 15,
3, 0, 1,
2, 3, 1,
1, 6, 5,
2, 1, 5,
13, 12, 8,
9, 13, 8,
11, 15, 13,
9, 11, 13,
14, 15, 10,
10, 15, 11,
14, 10, 12,
12, 10, 8];
j=0;k=(p.length)/3;Vol=0.0;console.log(k);
for (var i=0;i<k;i++) {
console.log(j,'=j',p[j],p[j+1],p[j+2]);
p1x=xyz[p[j]*3+0];p2x=xyz[p[j+1]*3+0];p3x=xyz[p[j+2]*3+0];
p1y=xyz[p[j]*3+1];p2y=xyz[p[j+1]*3+1];p3y=xyz[p[j+2]*3+1];
p1z=xyz[p[j]*3+2];p2z=xyz[p[j+1]*3+2];p3z=xyz[p[j+2]*3+2];
var v321 = p3x*p2y*p1z;
var v231 = p2x*p3y*p1z;
var v312 = p3x*p1y*p2z;
var v132 = p1x*p3y*p2z;
var v213 = p2x*p1y*p3z;
var v123 = p1x*p2y*p3z;
v=(-v321 + v231 + v312 - v132 - v213 + v123)/6;
console.log('p1',p1x,p1y,p1z,'p2',p2x,p2y,p2z,'p3',p3x,p3y,p3z,'v',v);
j=j+3;Vol=Vol+v; }
console.log(Vol);
Kind regards
Wolfgang Ehlert
-----Ursprüngliche Nachricht-----
Von: Discuss [mailto:discuss-bounces@lists.openscad.org] Im Auftrag von jon
Gesendet: Montag, 29. Dezember 2014 14:49
An: discuss@lists.openscad.org
Betreff: [OpenSCAD] volume measurements
Is there any easy way to compute the volume of an OpenSCAD object? I am
making molds, and wonder if OpenSCAD can tell me how much material to
prepare for a casting.
Jon
_______________________________________________
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
-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5577 / Virus Database: 4257/8830 - Release Date: 12/29/14
J
jon
Mon, Dec 29, 2014 6:38 PM
Yes. I can do it easily outside of OpenSCAD. But that was not what I
asked.
On 12/29/2014 1:31 PM, Alex Gibson wrote:
Cheat's way: Open it in a slicer for 3d printing, set to 100% infill, no
raft, brim or support, and from the estimate of quantity of filament used,
get the volume...
-----Original Message-----
From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of
Ehlert, Wolfgang
Sent: 29 December 2014 14:10
To: OpenSCAD general discussion
Subject: Re: [OpenSCAD] volume measurements
below you can find the formula to calculate the volume from the triangles
(faces). I am not a programmer, but skilled enough to test it with
Javascript. It works fine but I can't put it inside OpenScad. If somebody
could implement it, it would be fine to see the result not only as part of
the message window, but also offering the opportunity to export the result
in any way, so I can make use of it in our software.
/xyz=[
0, 0, 3000,
5000, 0, 3000,
5000, 200, 3000,
0, 200, 3000,
0, 200, 0,
5000, 200, 0,
5000, 0, 0,
0, 0, 0,
1000, 200, 0,
2000, 200, 0,
1000, 0, 0,
2000, 0, 0,
1000, 0, 2000,
2000, 0, 2000,
1000, 200, 2000,
2000, 200, 2000];
p=[
7, 0, 4,
4, 0, 3,
0, 7, 10,
13, 0, 12,
12, 0, 10,
1, 0, 13,
6, 13, 11,
1, 13, 6,
7, 4, 10,
10, 4, 8,
4, 3, 8,
15, 3, 2,
9, 2, 5,
14, 3, 15,
8, 3, 14,
15, 2, 9,
3, 0, 1,
2, 3, 1,
1, 6, 5,
2, 1, 5,
11, 9, 6,
6, 9, 5,
15, 9, 13,
13, 9, 11,
15, 13, 14,
14, 13, 12,
8, 14, 12,
10, 8, 12];/
xyz=[
0, 0, 3000,
5000, 0, 3000,
5000, 200, 3000,
0, 200, 3000,
0, 200, 0,
5000, 200, 0,
5000, 0, 0,
0, 0, 0,
1000, 0,2000,
1000, 0, 1000,
3000, 0, 2000,
3000, 0, 1000,
1000, 200, 2000,
1000, 200, 1000,
3000, 200, 2000,
3000, 200, 1000];
p=[
7, 0, 4,
4, 0, 3,
9, 7, 6,
11, 9, 6,
0, 7, 9,
0, 9, 8,
1, 10, 6,
1, 0, 10,
10, 11, 6,
8, 10, 0,
7, 4, 6,
6, 4, 5,
14, 3, 2,
4, 3, 12,
13, 15, 5,
4, 12, 13,
4, 13, 5,
5, 14, 2,
12, 3,14,
14, 5, 15,
3, 0, 1,
2, 3, 1,
1, 6, 5,
2, 1, 5,
13, 12, 8,
9, 13, 8,
11, 15, 13,
9, 11, 13,
14, 15, 10,
10, 15, 11,
14, 10, 12,
12, 10, 8];
j=0;k=(p.length)/3;Vol=0.0;console.log(k);
for (var i=0;i<k;i++) {
console.log(j,'=j',p[j],p[j+1],p[j+2]);
p1x=xyz[p[j]3+0];p2x=xyz[p[j+1]3+0];p3x=xyz[p[j+2]3+0];
p1y=xyz[p[j]3+1];p2y=xyz[p[j+1]3+1];p3y=xyz[p[j+2]3+1];
p1z=xyz[p[j]3+2];p2z=xyz[p[j+1]3+2];p3z=xyz[p[j+2]3+2];
var v321 = p3xp2yp1z;
var v231 = p2xp3yp1z;
var v312 = p3xp1yp2z;
var v132 = p1xp3yp2z;
var v213 = p2xp1yp3z;
var v123 = p1xp2y*p3z;
v=(-v321 + v231 + v312 - v132 - v213 + v123)/6;
console.log('p1',p1x,p1y,p1z,'p2',p2x,p2y,p2z,'p3',p3x,p3y,p3z,'v',v);
j=j+3;Vol=Vol+v; }
console.log(Vol);
Kind regards
Wolfgang Ehlert
-----Ursprüngliche Nachricht-----
Von: Discuss [mailto:discuss-bounces@lists.openscad.org] Im Auftrag von jon
Gesendet: Montag, 29. Dezember 2014 14:49
An: discuss@lists.openscad.org
Betreff: [OpenSCAD] volume measurements
Is there any easy way to compute the volume of an OpenSCAD object? I am
making molds, and wonder if OpenSCAD can tell me how much material to
prepare for a casting.
Jon
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
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5577 / Virus Database: 4257/8830 - Release Date: 12/29/14
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5577 / Virus Database: 4257/8833 - Release Date: 12/29/14
Yes. I can do it easily outside of OpenSCAD. But that was not what I
asked.
On 12/29/2014 1:31 PM, Alex Gibson wrote:
> Cheat's way: Open it in a slicer for 3d printing, set to 100% infill, no
> raft, brim or support, and from the estimate of quantity of filament used,
>
> get the volume...
>
> -----Original Message-----
> From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of
>
> Ehlert, Wolfgang
> Sent: 29 December 2014 14:10
> To: OpenSCAD general discussion
> Subject: Re: [OpenSCAD] volume measurements
>
> below you can find the formula to calculate the volume from the triangles
> (faces). I am not a programmer, but skilled enough to test it with
> Javascript. It works fine but I can't put it inside OpenScad. If somebody
> could implement it, it would be fine to see the result not only as part of
>
> the message window, but also offering the opportunity to export the result
>
> in any way, so I can make use of it in our software.
>
>
> /*xyz=[
> 0, 0, 3000,
> 5000, 0, 3000,
> 5000, 200, 3000,
> 0, 200, 3000,
> 0, 200, 0,
> 5000, 200, 0,
> 5000, 0, 0,
> 0, 0, 0,
> 1000, 200, 0,
> 2000, 200, 0,
> 1000, 0, 0,
> 2000, 0, 0,
> 1000, 0, 2000,
> 2000, 0, 2000,
> 1000, 200, 2000,
> 2000, 200, 2000];
> p=[
> 7, 0, 4,
> 4, 0, 3,
> 0, 7, 10,
> 13, 0, 12,
> 12, 0, 10,
> 1, 0, 13,
> 6, 13, 11,
> 1, 13, 6,
> 7, 4, 10,
> 10, 4, 8,
> 4, 3, 8,
> 15, 3, 2,
> 9, 2, 5,
> 14, 3, 15,
> 8, 3, 14,
> 15, 2, 9,
> 3, 0, 1,
> 2, 3, 1,
> 1, 6, 5,
> 2, 1, 5,
> 11, 9, 6,
> 6, 9, 5,
> 15, 9, 13,
> 13, 9, 11,
> 15, 13, 14,
> 14, 13, 12,
> 8, 14, 12,
> 10, 8, 12];*/
> xyz=[
> 0, 0, 3000,
> 5000, 0, 3000,
> 5000, 200, 3000,
> 0, 200, 3000,
> 0, 200, 0,
> 5000, 200, 0,
> 5000, 0, 0,
> 0, 0, 0,
> 1000, 0,2000,
> 1000, 0, 1000,
> 3000, 0, 2000,
> 3000, 0, 1000,
> 1000, 200, 2000,
> 1000, 200, 1000,
> 3000, 200, 2000,
> 3000, 200, 1000];
> p=[
> 7, 0, 4,
> 4, 0, 3,
> 9, 7, 6,
> 11, 9, 6,
> 0, 7, 9,
> 0, 9, 8,
> 1, 10, 6,
> 1, 0, 10,
> 10, 11, 6,
> 8, 10, 0,
> 7, 4, 6,
> 6, 4, 5,
> 14, 3, 2,
> 4, 3, 12,
> 13, 15, 5,
> 4, 12, 13,
> 4, 13, 5,
> 5, 14, 2,
> 12, 3,14,
> 14, 5, 15,
> 3, 0, 1,
> 2, 3, 1,
> 1, 6, 5,
> 2, 1, 5,
> 13, 12, 8,
> 9, 13, 8,
> 11, 15, 13,
> 9, 11, 13,
> 14, 15, 10,
> 10, 15, 11,
> 14, 10, 12,
> 12, 10, 8];
> j=0;k=(p.length)/3;Vol=0.0;console.log(k);
> for (var i=0;i<k;i++) {
> console.log(j,'=j',p[j],p[j+1],p[j+2]);
> p1x=xyz[p[j]*3+0];p2x=xyz[p[j+1]*3+0];p3x=xyz[p[j+2]*3+0];
> p1y=xyz[p[j]*3+1];p2y=xyz[p[j+1]*3+1];p3y=xyz[p[j+2]*3+1];
> p1z=xyz[p[j]*3+2];p2z=xyz[p[j+1]*3+2];p3z=xyz[p[j+2]*3+2];
> var v321 = p3x*p2y*p1z;
> var v231 = p2x*p3y*p1z;
> var v312 = p3x*p1y*p2z;
> var v132 = p1x*p3y*p2z;
> var v213 = p2x*p1y*p3z;
> var v123 = p1x*p2y*p3z;
> v=(-v321 + v231 + v312 - v132 - v213 + v123)/6;
>
> console.log('p1',p1x,p1y,p1z,'p2',p2x,p2y,p2z,'p3',p3x,p3y,p3z,'v',v);
> j=j+3;Vol=Vol+v; }
> console.log(Vol);
>
> Kind regards
> Wolfgang Ehlert
>
>
> -----Ursprüngliche Nachricht-----
> Von: Discuss [mailto:discuss-bounces@lists.openscad.org] Im Auftrag von jon
> Gesendet: Montag, 29. Dezember 2014 14:49
> An: discuss@lists.openscad.org
> Betreff: [OpenSCAD] volume measurements
>
> Is there any easy way to compute the volume of an OpenSCAD object? I am
> making molds, and wonder if OpenSCAD can tell me how much material to
> prepare for a casting.
>
> Jon
>
> _______________________________________________
> 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
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2015.0.5577 / Virus Database: 4257/8830 - Release Date: 12/29/14
>
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2015.0.5577 / Virus Database: 4257/8833 - Release Date: 12/29/14
>
>
>
MH
Miro Hrončok
Mon, Dec 29, 2014 7:16 PM
Cheat's way: Open it in a slicer for 3d printing, set to 100% infill, no
raft, brim or support, and from the estimate of quantity of filament used,
get the volume...
WOW, that's an overkill. ADMesh gives you the volume (precise, not this magic).
2014-12-29 19:31 GMT+01:00 Alex Gibson <alex@alexgibson.net>:
> Cheat's way: Open it in a slicer for 3d printing, set to 100% infill, no
> raft, brim or support, and from the estimate of quantity of filament used,
> get the volume...
WOW, that's an overkill. ADMesh gives you the volume (precise, not this magic).
JL
Joseph Lenox
Mon, Dec 29, 2014 9:52 PM
Even slic3r tells you the volume without any tomfoolery.
On Dec 29, 2014 1:16 PM, "Miro Hrončok" miro@hroncok.cz wrote:
Cheat's way: Open it in a slicer for 3d printing, set to 100% infill, no
raft, brim or support, and from the estimate of quantity of filament
Even slic3r tells you the volume without any tomfoolery.
On Dec 29, 2014 1:16 PM, "Miro Hrončok" <miro@hroncok.cz> wrote:
> 2014-12-29 19:31 GMT+01:00 Alex Gibson <alex@alexgibson.net>:
> > Cheat's way: Open it in a slicer for 3d printing, set to 100% infill, no
> > raft, brim or support, and from the estimate of quantity of filament
> used,
> > get the volume...
>
> WOW, that's an overkill. ADMesh gives you the volume (precise, not this
> magic).
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
AG
Alex Gibson
Mon, Dec 29, 2014 10:49 PM
Thanks both, I learned something useful to me from that... I use slic3r all the time but have been using MakerBot more recently
Cheers
Alex
Sent from my iPhone
On 29 Dec 2014, at 21:52, Joseph Lenox lenox.joseph@gmail.com wrote:
Even slic3r tells you the volume without any tomfoolery.
Cheat's way: Open it in a slicer for 3d printing, set to 100% infill, no
raft, brim or support, and from the estimate of quantity of filament used,
get the volume...
Thanks both, I learned something useful to me from that... I use slic3r all the time but have been using MakerBot more recently
Cheers
Alex
Sent from my iPhone
> On 29 Dec 2014, at 21:52, Joseph Lenox <lenox.joseph@gmail.com> wrote:
>
> Even slic3r tells you the volume without any tomfoolery.
>
>> On Dec 29, 2014 1:16 PM, "Miro Hrončok" <miro@hroncok.cz> wrote:
>> 2014-12-29 19:31 GMT+01:00 Alex Gibson <alex@alexgibson.net>:
>> > Cheat's way: Open it in a slicer for 3d printing, set to 100% infill, no
>> > raft, brim or support, and from the estimate of quantity of filament used,
>> > get the volume...
>>
>> WOW, that's an overkill. ADMesh gives you the volume (precise, not this magic).
>>
>> _______________________________________________
>> 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
JL
Joseph Lenox
Mon, Dec 29, 2014 11:48 PM
Slic3r 1.2.3 is pretty good now.
On Dec 29, 2014 4:49 PM, "Alex Gibson" alex@alexgibson.net wrote:
Thanks both, I learned something useful to me from that... I use slic3r
all the time but have been using MakerBot more recently
Cheers
Alex
Sent from my iPhone
On 29 Dec 2014, at 21:52, Joseph Lenox lenox.joseph@gmail.com wrote:
Even slic3r tells you the volume without any tomfoolery.
On Dec 29, 2014 1:16 PM, "Miro Hrončok" miro@hroncok.cz wrote:
Cheat's way: Open it in a slicer for 3d printing, set to 100% infill,
raft, brim or support, and from the estimate of quantity of filament
Slic3r 1.2.3 is pretty good now.
On Dec 29, 2014 4:49 PM, "Alex Gibson" <alex@alexgibson.net> wrote:
> Thanks both, I learned something useful to me from that... I use slic3r
> all the time but have been using MakerBot more recently
>
> Cheers
> Alex
>
> Sent from my iPhone
>
> On 29 Dec 2014, at 21:52, Joseph Lenox <lenox.joseph@gmail.com> wrote:
>
> Even slic3r tells you the volume without any tomfoolery.
> On Dec 29, 2014 1:16 PM, "Miro Hrončok" <miro@hroncok.cz> wrote:
>
>> 2014-12-29 19:31 GMT+01:00 Alex Gibson <alex@alexgibson.net>:
>> > Cheat's way: Open it in a slicer for 3d printing, set to 100% infill,
>> no
>> > raft, brim or support, and from the estimate of quantity of filament
>> used,
>> > get the volume...
>>
>> WOW, that's an overkill. ADMesh gives you the volume (precise, not this
>> magic).
>>
>> _______________________________________________
>> 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
>
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>