discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Smoother side on box

MA
Mike Aubury
Mon, Nov 12, 2018 12:32 PM

Hi,
this is probably some newbie thing, but I'm trying to design an insert for
a cars console.
Its got a slightly weird shape - but the outsides top/bottom etc are
roughly described by :

height=52.48;

boxPoints=[
[-135/2,0,0], // rear bottom left    // 0
[135/2,0,0],  // rear bottom right    // 1
[145/2,202,0],  // front bottom right  // 2
[-145/2,202,0], // front bottom left  // 3
[-137/2,-32.5,height], // rear top left    // 4
[137/2,-32.5,height], // rear top right    // 5
[171/2,202,height], // front top right  //6
[-171/2,202,height], // front top left  //7

];

boxFaces=[
[0,1,2,3],  // bottom
[4,5,1,0],  // front
[7,6,5,4],  // top
[5,6,2,1],  // right
[6,7,3,2],  // back
[7,4,0,3] // left
];

polyhedron(boxPoints,boxFaces );

When I try to render this - on the two sides I get 2 triangle, which means
when I 3d printed it, I ended up with a bulge.
I'm assuming this needs to be some sort of curve rather than a single face,
but I've no idea how I'd go about coding for that..

Any ideas ?

Thanks in advance.

Hi, this is probably some newbie thing, but I'm trying to design an insert for a cars console. Its got a slightly weird shape - but the outsides top/bottom etc are roughly described by : height=52.48; boxPoints=[ [-135/2,0,0], // rear bottom left // 0 [135/2,0,0], // rear bottom right // 1 [145/2,202,0], // front bottom right // 2 [-145/2,202,0], // front bottom left // 3 [-137/2,-32.5,height], // rear top left // 4 [137/2,-32.5,height], // rear top right // 5 [171/2,202,height], // front top right //6 [-171/2,202,height], // front top left //7 ]; boxFaces=[ [0,1,2,3], // bottom [4,5,1,0], // front [7,6,5,4], // top [5,6,2,1], // right [6,7,3,2], // back [7,4,0,3] // left ]; polyhedron(boxPoints,boxFaces ); When I try to render this - on the two sides I get 2 triangle, which means when I 3d printed it, I ended up with a bulge. I'm assuming this needs to be some sort of curve rather than a single face, but I've no idea how I'd go about coding for that.. Any ideas ? Thanks in advance.
KT
Kevin Toppenberg
Mon, Nov 12, 2018 1:04 PM

On the end where y = ~0 ("bottom"), the sides are vertical.  But on the end
where y = ~200 ("top"), the sides are beveled outward.  I am assuming that
this is what you want.  The 2 triangles are the simplest way for the engine
to achieve this description.  I think one way to change this would to take
that side and divide it into 10 sub-parts.  If that is the way you want to
go, I think I could help you calculate the sup-points making up the
sub-faces.  But I have actually never worked with making polyhedrons, and
I'm not exactly sure how to layout the parts into the hole.

Kevin

On Mon, Nov 12, 2018 at 7:33 AM Mike Aubury mike@aubit.com wrote:

Hi,
this is probably some newbie thing, but I'm trying to design an insert
for a cars console.
Its got a slightly weird shape - but the outsides top/bottom etc are
roughly described by :

height=52.48;

boxPoints=[
[-135/2,0,0], // rear bottom left    // 0
[135/2,0,0],  // rear bottom right    // 1
[145/2,202,0],  // front bottom right  // 2
[-145/2,202,0], // front bottom left  // 3
[-137/2,-32.5,height], // rear top left    // 4
[137/2,-32.5,height], // rear top right    // 5
[171/2,202,height], // front top right  //6
[-171/2,202,height], // front top left  //7

];

boxFaces=[
[0,1,2,3],  // bottom
[4,5,1,0],  // front
[7,6,5,4],  // top
[5,6,2,1],  // right
[6,7,3,2],  // back
[7,4,0,3] // left
];

polyhedron(boxPoints,boxFaces );

When I try to render this - on the two sides I get 2 triangle, which means
when I 3d printed it, I ended up with a bulge.
I'm assuming this needs to be some sort of curve rather than a single
face, but I've no idea how I'd go about coding for that..

Any ideas ?

Thanks in advance.


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

On the end where y = ~0 ("bottom"), the sides are vertical. But on the end where y = ~200 ("top"), the sides are beveled outward. I am assuming that this is what you want. The 2 triangles are the simplest way for the engine to achieve this description. I think one way to change this would to take that side and divide it into 10 sub-parts. If that is the way you want to go, I think I could help you calculate the sup-points making up the sub-faces. But I have actually never worked with making polyhedrons, and I'm not exactly sure how to layout the parts into the hole. Kevin On Mon, Nov 12, 2018 at 7:33 AM Mike Aubury <mike@aubit.com> wrote: > Hi, > this is probably some newbie thing, but I'm trying to design an insert > for a cars console. > Its got a slightly weird shape - but the outsides top/bottom etc are > roughly described by : > > height=52.48; > > boxPoints=[ > [-135/2,0,0], // rear bottom left // 0 > [135/2,0,0], // rear bottom right // 1 > [145/2,202,0], // front bottom right // 2 > [-145/2,202,0], // front bottom left // 3 > [-137/2,-32.5,height], // rear top left // 4 > [137/2,-32.5,height], // rear top right // 5 > [171/2,202,height], // front top right //6 > [-171/2,202,height], // front top left //7 > > ]; > > boxFaces=[ > [0,1,2,3], // bottom > [4,5,1,0], // front > [7,6,5,4], // top > [5,6,2,1], // right > [6,7,3,2], // back > [7,4,0,3] // left > ]; > > polyhedron(boxPoints,boxFaces ); > > > > When I try to render this - on the two sides I get 2 triangle, which means > when I 3d printed it, I ended up with a bulge. > I'm assuming this needs to be some sort of curve rather than a single > face, but I've no idea how I'd go about coding for that.. > > Any ideas ? > > Thanks in advance. > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
KT
Kevin Toppenberg
Mon, Nov 12, 2018 1:46 PM

Here is code that places points along the specified sides.  It is an
intermediary step to a solution

height=52.48;

boxPoints=[
[-135/2,0,0], // rear bottom left    // 0
[135/2,0,0],  // rear bottom right    // 1
[145/2,202,0],  // front bottom right  // 2
[-145/2,202,0], // front bottom left  // 3
[-137/2,-32.5,height], // rear top left    // 4
[137/2,-32.5,height], // rear top right    // 5
[171/2,202,height], // front top right  //6
[-171/2,202,height], // front top left  //7

];

boxFaces=[
[0,1,2,3],  // bottom
[4,5,1,0],  // front
[7,6,5,4],  // top
[5,6,2,1],  // right
[6,7,3,2],  // back
[7,4,0,3] // left
];

polyhedron(boxPoints,boxFaces );

//-------- added code ----------------

v1 = divided_line(boxPoints[0], boxPoints[3], 0.10);
for (i=[0:1:len(v1)-1]) translate(v1[i]) sphere(r=2);

v2 = divided_line(boxPoints[4], boxPoints[7], 0.10);
for (i=[0:1:len(v2)-1]) translate(v2[i]) sphere(r=2);

//return a array of points along line from p1 to p2
//step_pct should be value from 0 - 1 (e.g. 0.10) for points
//  every 10% away along line
function divided_line(p1, p2, step_pct) = [for(pct =[0 : step_pct : 1]) p1

  • (p2-p1)*pct];

Kevin

On Mon, Nov 12, 2018 at 8:04 AM Kevin Toppenberg kdtop3@gmail.com wrote:

On the end where y = ~0 ("bottom"), the sides are vertical.  But on the
end where y = ~200 ("top"), the sides are beveled outward.  I am assuming
that this is what you want.  The 2 triangles are the simplest way for the
engine to achieve this description.  I think one way to change this would
to take that side and divide it into 10 sub-parts.  If that is the way you
want to go, I think I could help you calculate the sup-points making up the
sub-faces.  But I have actually never worked with making polyhedrons, and
I'm not exactly sure how to layout the parts into the hole.

Kevin

On Mon, Nov 12, 2018 at 7:33 AM Mike Aubury mike@aubit.com wrote:

Hi,
this is probably some newbie thing, but I'm trying to design an insert
for a cars console.
Its got a slightly weird shape - but the outsides top/bottom etc are
roughly described by :

height=52.48;

boxPoints=[
[-135/2,0,0], // rear bottom left    // 0
[135/2,0,0],  // rear bottom right    // 1
[145/2,202,0],  // front bottom right  // 2
[-145/2,202,0], // front bottom left  // 3
[-137/2,-32.5,height], // rear top left    // 4
[137/2,-32.5,height], // rear top right    // 5
[171/2,202,height], // front top right  //6
[-171/2,202,height], // front top left  //7

];

boxFaces=[
[0,1,2,3],  // bottom
[4,5,1,0],  // front
[7,6,5,4],  // top
[5,6,2,1],  // right
[6,7,3,2],  // back
[7,4,0,3] // left
];

polyhedron(boxPoints,boxFaces );

When I try to render this - on the two sides I get 2 triangle, which
means when I 3d printed it, I ended up with a bulge.
I'm assuming this needs to be some sort of curve rather than a single
face, but I've no idea how I'd go about coding for that..

Any ideas ?

Thanks in advance.


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

Here is code that places points along the specified sides. It is an intermediary step to a solution height=52.48; boxPoints=[ [-135/2,0,0], // rear bottom left // 0 [135/2,0,0], // rear bottom right // 1 [145/2,202,0], // front bottom right // 2 [-145/2,202,0], // front bottom left // 3 [-137/2,-32.5,height], // rear top left // 4 [137/2,-32.5,height], // rear top right // 5 [171/2,202,height], // front top right //6 [-171/2,202,height], // front top left //7 ]; boxFaces=[ [0,1,2,3], // bottom [4,5,1,0], // front [7,6,5,4], // top [5,6,2,1], // right [6,7,3,2], // back [7,4,0,3] // left ]; polyhedron(boxPoints,boxFaces ); //-------- added code ---------------- v1 = divided_line(boxPoints[0], boxPoints[3], 0.10); for (i=[0:1:len(v1)-1]) translate(v1[i]) sphere(r=2); v2 = divided_line(boxPoints[4], boxPoints[7], 0.10); for (i=[0:1:len(v2)-1]) translate(v2[i]) sphere(r=2); //return a array of points along line from p1 to p2 //step_pct should be value from 0 - 1 (e.g. 0.10) for points // every 10% away along line function divided_line(p1, p2, step_pct) = [for(pct =[0 : step_pct : 1]) p1 + (p2-p1)*pct]; Kevin On Mon, Nov 12, 2018 at 8:04 AM Kevin Toppenberg <kdtop3@gmail.com> wrote: > On the end where y = ~0 ("bottom"), the sides are vertical. But on the > end where y = ~200 ("top"), the sides are beveled outward. I am assuming > that this is what you want. The 2 triangles are the simplest way for the > engine to achieve this description. I think one way to change this would > to take that side and divide it into 10 sub-parts. If that is the way you > want to go, I think I could help you calculate the sup-points making up the > sub-faces. But I have actually never worked with making polyhedrons, and > I'm not exactly sure how to layout the parts into the hole. > > Kevin > > On Mon, Nov 12, 2018 at 7:33 AM Mike Aubury <mike@aubit.com> wrote: > >> Hi, >> this is probably some newbie thing, but I'm trying to design an insert >> for a cars console. >> Its got a slightly weird shape - but the outsides top/bottom etc are >> roughly described by : >> >> height=52.48; >> >> boxPoints=[ >> [-135/2,0,0], // rear bottom left // 0 >> [135/2,0,0], // rear bottom right // 1 >> [145/2,202,0], // front bottom right // 2 >> [-145/2,202,0], // front bottom left // 3 >> [-137/2,-32.5,height], // rear top left // 4 >> [137/2,-32.5,height], // rear top right // 5 >> [171/2,202,height], // front top right //6 >> [-171/2,202,height], // front top left //7 >> >> ]; >> >> boxFaces=[ >> [0,1,2,3], // bottom >> [4,5,1,0], // front >> [7,6,5,4], // top >> [5,6,2,1], // right >> [6,7,3,2], // back >> [7,4,0,3] // left >> ]; >> >> polyhedron(boxPoints,boxFaces ); >> >> >> >> When I try to render this - on the two sides I get 2 triangle, which >> means when I 3d printed it, I ended up with a bulge. >> I'm assuming this needs to be some sort of curve rather than a single >> face, but I've no idea how I'd go about coding for that.. >> >> Any ideas ? >> >> Thanks in advance. >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >
MA
Mike Aubury
Mon, Nov 12, 2018 2:37 PM

You're a genius :)
If I take your points and "hull" around them from one segment to the next..

segments=30;
v1 = divided_line(boxPoints[0], boxPoints[3], 1/segments);
v2 = divided_line(boxPoints[4], boxPoints[7], 1/segments);
v3 = divided_line(boxPoints[1], boxPoints[2], 1/segments);
v4 = divided_line(boxPoints[5], boxPoints[6], 1/segments);

for (i=[0:1:segments-1]) {
hull() {
translate(v1[i]) sphere(r=0.1);
translate(v2[i]) sphere(r=0.1);
translate(v3[i]) sphere(r=0.1);
translate(v4[i]) sphere(r=0.1);
translate(v1[i+1]) sphere(r=0.1);
translate(v2[i+1]) sphere(r=0.1);
translate(v3[i+1]) sphere(r=0.1);
translate(v4[i+1]) sphere(r=0.1);
}
}

seems to make it much neater :)

On Mon, 12 Nov 2018 at 13:46, Kevin Toppenberg kdtop3@gmail.com wrote:

Here is code that places points along the specified sides.  It is an
intermediary step to a solution

height=52.48;

boxPoints=[
[-135/2,0,0], // rear bottom left    // 0
[135/2,0,0],  // rear bottom right    // 1
[145/2,202,0],  // front bottom right  // 2
[-145/2,202,0], // front bottom left  // 3
[-137/2,-32.5,height], // rear top left    // 4
[137/2,-32.5,height], // rear top right    // 5
[171/2,202,height], // front top right  //6
[-171/2,202,height], // front top left  //7

];

boxFaces=[
[0,1,2,3],  // bottom
[4,5,1,0],  // front
[7,6,5,4],  // top
[5,6,2,1],  // right
[6,7,3,2],  // back
[7,4,0,3] // left
];

polyhedron(boxPoints,boxFaces );

//-------- added code ----------------

v1 = divided_line(boxPoints[0], boxPoints[3], 0.10);
for (i=[0:1:len(v1)-1]) translate(v1[i]) sphere(r=2);

v2 = divided_line(boxPoints[4], boxPoints[7], 0.10);
for (i=[0:1:len(v2)-1]) translate(v2[i]) sphere(r=2);

//return a array of points along line from p1 to p2
//step_pct should be value from 0 - 1 (e.g. 0.10) for points
//  every 10% away along line
function divided_line(p1, p2, step_pct) = [for(pct =[0 : step_pct : 1]) p1

  • (p2-p1)*pct];

Kevin

On Mon, Nov 12, 2018 at 8:04 AM Kevin Toppenberg kdtop3@gmail.com wrote:

On the end where y = ~0 ("bottom"), the sides are vertical.  But on the
end where y = ~200 ("top"), the sides are beveled outward.  I am assuming
that this is what you want.  The 2 triangles are the simplest way for the
engine to achieve this description.  I think one way to change this would
to take that side and divide it into 10 sub-parts.  If that is the way you
want to go, I think I could help you calculate the sup-points making up the
sub-faces.  But I have actually never worked with making polyhedrons, and
I'm not exactly sure how to layout the parts into the hole.

Kevin

On Mon, Nov 12, 2018 at 7:33 AM Mike Aubury mike@aubit.com wrote:

Hi,
this is probably some newbie thing, but I'm trying to design an insert
for a cars console.
Its got a slightly weird shape - but the outsides top/bottom etc are
roughly described by :

height=52.48;

boxPoints=[
[-135/2,0,0], // rear bottom left    // 0
[135/2,0,0],  // rear bottom right    // 1
[145/2,202,0],  // front bottom right  // 2
[-145/2,202,0], // front bottom left  // 3
[-137/2,-32.5,height], // rear top left    // 4
[137/2,-32.5,height], // rear top right    // 5
[171/2,202,height], // front top right  //6
[-171/2,202,height], // front top left  //7

];

boxFaces=[
[0,1,2,3],  // bottom
[4,5,1,0],  // front
[7,6,5,4],  // top
[5,6,2,1],  // right
[6,7,3,2],  // back
[7,4,0,3] // left
];

polyhedron(boxPoints,boxFaces );

When I try to render this - on the two sides I get 2 triangle, which
means when I 3d printed it, I ended up with a bulge.
I'm assuming this needs to be some sort of curve rather than a single
face, but I've no idea how I'd go about coding for that..

Any ideas ?

Thanks in advance.


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


You're a genius :) If I take your points and "hull" around them from one segment to the next.. segments=30; v1 = divided_line(boxPoints[0], boxPoints[3], 1/segments); v2 = divided_line(boxPoints[4], boxPoints[7], 1/segments); v3 = divided_line(boxPoints[1], boxPoints[2], 1/segments); v4 = divided_line(boxPoints[5], boxPoints[6], 1/segments); for (i=[0:1:segments-1]) { hull() { translate(v1[i]) sphere(r=0.1); translate(v2[i]) sphere(r=0.1); translate(v3[i]) sphere(r=0.1); translate(v4[i]) sphere(r=0.1); translate(v1[i+1]) sphere(r=0.1); translate(v2[i+1]) sphere(r=0.1); translate(v3[i+1]) sphere(r=0.1); translate(v4[i+1]) sphere(r=0.1); } } seems to make it much neater :) On Mon, 12 Nov 2018 at 13:46, Kevin Toppenberg <kdtop3@gmail.com> wrote: > Here is code that places points along the specified sides. It is an > intermediary step to a solution > > > height=52.48; > > boxPoints=[ > [-135/2,0,0], // rear bottom left // 0 > [135/2,0,0], // rear bottom right // 1 > [145/2,202,0], // front bottom right // 2 > [-145/2,202,0], // front bottom left // 3 > [-137/2,-32.5,height], // rear top left // 4 > [137/2,-32.5,height], // rear top right // 5 > [171/2,202,height], // front top right //6 > [-171/2,202,height], // front top left //7 > > ]; > > boxFaces=[ > [0,1,2,3], // bottom > [4,5,1,0], // front > [7,6,5,4], // top > [5,6,2,1], // right > [6,7,3,2], // back > [7,4,0,3] // left > ]; > > polyhedron(boxPoints,boxFaces ); > > //-------- added code ---------------- > > v1 = divided_line(boxPoints[0], boxPoints[3], 0.10); > for (i=[0:1:len(v1)-1]) translate(v1[i]) sphere(r=2); > > v2 = divided_line(boxPoints[4], boxPoints[7], 0.10); > for (i=[0:1:len(v2)-1]) translate(v2[i]) sphere(r=2); > > //return a array of points along line from p1 to p2 > //step_pct should be value from 0 - 1 (e.g. 0.10) for points > // every 10% away along line > function divided_line(p1, p2, step_pct) = [for(pct =[0 : step_pct : 1]) p1 > + (p2-p1)*pct]; > > Kevin > > On Mon, Nov 12, 2018 at 8:04 AM Kevin Toppenberg <kdtop3@gmail.com> wrote: > >> On the end where y = ~0 ("bottom"), the sides are vertical. But on the >> end where y = ~200 ("top"), the sides are beveled outward. I am assuming >> that this is what you want. The 2 triangles are the simplest way for the >> engine to achieve this description. I think one way to change this would >> to take that side and divide it into 10 sub-parts. If that is the way you >> want to go, I think I could help you calculate the sup-points making up the >> sub-faces. But I have actually never worked with making polyhedrons, and >> I'm not exactly sure how to layout the parts into the hole. >> >> Kevin >> >> On Mon, Nov 12, 2018 at 7:33 AM Mike Aubury <mike@aubit.com> wrote: >> >>> Hi, >>> this is probably some newbie thing, but I'm trying to design an insert >>> for a cars console. >>> Its got a slightly weird shape - but the outsides top/bottom etc are >>> roughly described by : >>> >>> height=52.48; >>> >>> boxPoints=[ >>> [-135/2,0,0], // rear bottom left // 0 >>> [135/2,0,0], // rear bottom right // 1 >>> [145/2,202,0], // front bottom right // 2 >>> [-145/2,202,0], // front bottom left // 3 >>> [-137/2,-32.5,height], // rear top left // 4 >>> [137/2,-32.5,height], // rear top right // 5 >>> [171/2,202,height], // front top right //6 >>> [-171/2,202,height], // front top left //7 >>> >>> ]; >>> >>> boxFaces=[ >>> [0,1,2,3], // bottom >>> [4,5,1,0], // front >>> [7,6,5,4], // top >>> [5,6,2,1], // right >>> [6,7,3,2], // back >>> [7,4,0,3] // left >>> ]; >>> >>> polyhedron(boxPoints,boxFaces ); >>> >>> >>> >>> When I try to render this - on the two sides I get 2 triangle, which >>> means when I 3d printed it, I ended up with a bulge. >>> I'm assuming this needs to be some sort of curve rather than a single >>> face, but I've no idea how I'd go about coding for that.. >>> >>> Any ideas ? >>> >>> Thanks in advance. >>> _______________________________________________ >>> 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 >