I've been working on a custom polyhedron, and want to make some circular
holes through it for motor spindles.
I've been using difference and cylinders, but on export it complains "Object
may not be a valid 2-manifold and may need repair!".
I have checked it in thrown together view, but all seems fine and correctly
orientated. I have also tried removing the cylinders and it then doesn't
report any warnings on export.
I've also tested with a simple polyhedron cube and a cube differenced
against that which works fine, which means I can do it in principle, but I
just can't figure out why it's misbehaving for me.
My research across the internet has yielded things to check but doesn't help
at all pinpointing my issue, but I could be missing something obvious.
Any help would be greatly appreciated. My code is below.
Many thanks
Chris
width=80;
length=90;
height=60;
wall_thickness=2;
motor_hole_radius=5;
motor_offset_from_rear=30;
wedge_length=6;
wedge_rise=2;
left_right_top_width=10;
rear_top_length=12;
rear_top_inner_rise=4.7;
module mainBody()
{
polyhedron(
points =
[
//outer bottom
[0,0,(height/2)],//FL (0)
[width,0,(height/2)],//FR (1)
[width, length, 0],//BR (2)
[0, length, 0],//BL (3)
//outer top points
[width, length, height],//BR (4)
[0, length, height],//BL (5)
//inner left
[wall_thickness, (length-wall_thickness), wall_thickness],//BL
(Bottom) (6)
[wall_thickness, (length-wall_thickness),
(height-wall_thickness)],//BL (Top) (7)
//inner right
[(width-wall_thickness),(length-wall_thickness),wall_thickness],//BR
(Bottom) (8)
[(width-wall_thickness),(length-wall_thickness),(height-wall_thickness)],//BL
(Top) (9)
//front wedge (back) (as looking from front)
[wall_thickness,wedge_length,(height/2)],//L (Bottom) (10)
[(width-wall_thickness),wedge_length,(height/2)],//R (Bottom) (11)
//inner left top
[(wall_thickness+left_right_top_width), wedge_length, (height/2)],
//front (12)
//outer left top
[(wall_thickness+left_right_top_width), wedge_length,
((height/2)+wedge_rise)], //front (13)
//inner right top
[(width-(wall_thickness+left_right_top_width)), wedge_length,
(height/2)], //front (14)
//outer right top
[(width-(wall_thickness+left_right_top_width)), wedge_length,
((height/2)+wedge_rise)], //front (15)
//inner rear top
[(left_right_top_width+wall_thickness),(length-(wall_thickness+rear_top_length)),
(height-(rear_top_inner_rise+wall_thickness))],//L (16)
[(width-(left_right_top_width+wall_thickness)),(length-(wall_thickness+rear_top_length)),
(height-(rear_top_inner_rise+wall_thickness))],//R (17)
//outer rear top
[(left_right_top_width+wall_thickness),(length-(wall_thickness+rear_top_length)),
(height-rear_top_inner_rise)],//L (18)
[(width-(left_right_top_width+wall_thickness)),(length-(wall_thickness+rear_top_length)),
(height-rear_top_inner_rise)],//R (19)
],
faces =
[
[0,1,2,3],//outer bottom
[3,5,0],//outer left
[1,4,2],// outer right
[2,4,5,3],//outer back
[10,6,8,11],//inner bottom
[10,7,6], //inner left
[8,9,11], //inner right
[6,7,9,8], //inner back
[0,13,15,1],//Front wedge (top)
[14,15,13,12],//Front wedge (back)
[12,16,7,10],//inner left top
[0,5,18,13],//outer left top
[11,9,17,14],//inner right top
[15, 19, 4, 1],//outer right top
[17,9,7,16],//inner rear top
[18,5,4,19],//outer rear top
[12,13,18,16],//close left top
[17,19,15,14],//close right top
[16,18,19,17],//close back top
]
);
}
difference()
{
mainBody();
//left motor hole
translate([-1,(length-motor_offset_from_rear),(height/2)]) rotate([0,90,0])
cylinder(h = wall_thickness+2, r1 = motor_hole_radius, r2 =
motor_hole_radius);
//right motor hole
translate([(width-(wall_thickness+1)),(length-motor_offset_from_rear),(height/2)])
rotate([0,90,0]) cylinder(h = wall_thickness+2, r1 = motor_hole_radius, r2 =
motor_hole_radius);
}
--
View this message in context: http://forum.openscad.org/Unable-to-difference-a-polyhedron-with-a-cylinder-tp15850.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Just by visual inspection (after cutting the top off with a cube) the
walls you are drilling the holes through appear to be made of two thin
sheets, rather than being thick and solid...
Jon
On 1/23/2016 3:47 PM, chrisjfarrell wrote:
I've been working on a custom polyhedron, and want to make some circular
holes through it for motor spindles.
I've been using difference and cylinders, but on export it complains "Object
may not be a valid 2-manifold and may need repair!".
I have checked it in thrown together view, but all seems fine and correctly
orientated. I have also tried removing the cylinders and it then doesn't
report any warnings on export.
I've also tested with a simple polyhedron cube and a cube differenced
against that which works fine, which means I can do it in principle, but I
just can't figure out why it's misbehaving for me.
My research across the internet has yielded things to check but doesn't help
at all pinpointing my issue, but I could be missing something obvious.
Any help would be greatly appreciated. My code is below.
Many thanks
Chris
width=80;
length=90;
height=60;
wall_thickness=2;
motor_hole_radius=5;
motor_offset_from_rear=30;
wedge_length=6;
wedge_rise=2;
left_right_top_width=10;
rear_top_length=12;
rear_top_inner_rise=4.7;
module mainBody()
{
polyhedron(
points =
[
//outer bottom
[0,0,(height/2)],//FL (0)
[width,0,(height/2)],//FR (1)
[width, length, 0],//BR (2)
[0, length, 0],//BL (3)
//outer top points
[width, length, height],//BR (4)
[0, length, height],//BL (5)
//inner left
[wall_thickness, (length-wall_thickness), wall_thickness],//BL
(Bottom) (6)
[wall_thickness, (length-wall_thickness),
(height-wall_thickness)],//BL (Top) (7)
//inner right
[(width-wall_thickness),(length-wall_thickness),wall_thickness],//BR
(Bottom) (8)
[(width-wall_thickness),(length-wall_thickness),(height-wall_thickness)],//BL
(Top) (9)
//front wedge (back) (as looking from front)
[wall_thickness,wedge_length,(height/2)],//L (Bottom) (10)
[(width-wall_thickness),wedge_length,(height/2)],//R (Bottom) (11)
//inner left top
[(wall_thickness+left_right_top_width), wedge_length, (height/2)],
//front (12)
//outer left top
[(wall_thickness+left_right_top_width), wedge_length,
((height/2)+wedge_rise)], //front (13)
//inner right top
[(width-(wall_thickness+left_right_top_width)), wedge_length,
(height/2)], //front (14)
//outer right top
[(width-(wall_thickness+left_right_top_width)), wedge_length,
((height/2)+wedge_rise)], //front (15)
//inner rear top
[(left_right_top_width+wall_thickness),(length-(wall_thickness+rear_top_length)),
(height-(rear_top_inner_rise+wall_thickness))],//L (16)
[(width-(left_right_top_width+wall_thickness)),(length-(wall_thickness+rear_top_length)),
(height-(rear_top_inner_rise+wall_thickness))],//R (17)
//outer rear top
[(left_right_top_width+wall_thickness),(length-(wall_thickness+rear_top_length)),
(height-rear_top_inner_rise)],//L (18)
[(width-(left_right_top_width+wall_thickness)),(length-(wall_thickness+rear_top_length)),
(height-rear_top_inner_rise)],//R (19)
],
faces =
[
[0,1,2,3],//outer bottom
[3,5,0],//outer left
[1,4,2],// outer right
[2,4,5,3],//outer back
[10,6,8,11],//inner bottom
[10,7,6], //inner left
[8,9,11], //inner right
[6,7,9,8], //inner back
[0,13,15,1],//Front wedge (top)
[14,15,13,12],//Front wedge (back)
[12,16,7,10],//inner left top
[0,5,18,13],//outer left top
[11,9,17,14],//inner right top
[15, 19, 4, 1],//outer right top
[17,9,7,16],//inner rear top
[18,5,4,19],//outer rear top
[12,13,18,16],//close left top
[17,19,15,14],//close right top
[16,18,19,17],//close back top
]
);
}
difference()
{
mainBody();
//left motor hole
translate([-1,(length-motor_offset_from_rear),(height/2)]) rotate([0,90,0])
cylinder(h = wall_thickness+2, r1 = motor_hole_radius, r2 =
motor_hole_radius);
//right motor hole
translate([(width-(wall_thickness+1)),(length-motor_offset_from_rear),(height/2)])
rotate([0,90,0]) cylinder(h = wall_thickness+2, r1 = motor_hole_radius, r2 =
motor_hole_radius);
}
--
View this message in context: http://forum.openscad.org/Unable-to-difference-a-polyhedron-with-a-cylinder-tp15850.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
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: 2016.0.7357 / Virus Database: 4522/11466 - Release Date: 01/23/16
Based on your suggestion, and knowing too little of OpenSCAD, would the solution be to use linear_extrude on the faces that are "sheets" to make them solid?
fred
On Saturday, January 23, 2016 3:58 PM, jon <jon@jonbondy.com> wrote:
Just by visual inspection (after cutting the top off with a cube) the
walls you are drilling the holes through appear to be made of two thin
sheets, rather than being thick and solid...
Jon
Create your main shape using solid primitives, like cube() and modify
them using difference() or intersection(); then cut the holes using
difference() and cylinder()
Jon
On 1/23/2016 6:14 PM, fred wrote:
Based on your suggestion, and knowing too little of OpenSCAD, would
the solution be to use linear_extrude on the faces that are "sheets"
to make them solid?
fred
On Saturday, January 23, 2016 3:58 PM, jon jon@jonbondy.com wrote:
Just by visual inspection (after cutting the top off with a cube) the
walls you are drilling the holes through appear to be made of two thin
sheets, rather than being thick and solid...
Jon
Its apparent you have used the method of trying to construct a complex
polygon. This is fairly unusual approach in OpenSCAD, which is designed to
construct objects by boolean ops on simple primitives. It is a common
approach in polygonal modellers.
I'd suggest a different approach where you considered how the object could
be made if you had a pile of blocks, cylinders and spheres and could union
them together or intersect, subtract(difference) them from each other to
make your desired shape.
E.g.
module _wedge_cut(X,Y,Z) {
angle = atan(Z/Y0.5);
translate([-Delta/2,0,Z/2])
rotate([angle,0,0])
cube(size=[X+Delta, Y1.4, Z]);
}
Delta = 0.1;
module wedge(X,Y,Z) {
difference() {
// cube
cube(size = [X, Y, Z]);
// remove top
_wedge_cut(X,Y,Z);
// remove bottom
translate([0,0,Z])
mirror([0,0,1])
_wedge_cut(X,Y,Z);
}
}
difference() {
// primary wedge
wedge(width, length, height);
// subtract interior
translate([wall_thickness,0,wall_thickness2+Delta])
wedge(width-wall_thickness2, length-wall_thickness2,
height-wall_thickness2);
// subtract tube
#translate([-Delta/2,(length-motor_offset_from_rear),(height/2)])
rotate([0,90,0])
cylinder(h = width+Delta, r = motor_hole_radius);
}
--
View this message in context: http://forum.openscad.org/Unable-to-difference-a-polyhedron-with-a-cylinder-tp15850p15854.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
It is perfectly valid to make objects with polyhedron if you happen to know
all the vertices. It is faster to render than CSG but harder to program.
The reason it doesn't work in this case is because the polyhedron is non
manifold. It has T junctions at the inside front of the wedge. I.e. a
vertex that meets an edge instead of other vertices. That creates a hole in
the mesh topologically, although you can't see it because it has zero area.
The solution is simply to add two extra vertices to the inner bottom.
[12,10,6,8,11,14],//inner bottom
On 24 January 2016 at 00:45, Neon22 mschafer@wireframe.biz wrote:
Its apparent you have used the method of trying to construct a complex
polygon. This is fairly unusual approach in OpenSCAD, which is designed to
construct objects by boolean ops on simple primitives. It is a common
approach in polygonal modellers.
I'd suggest a different approach where you considered how the object could
be made if you had a pile of blocks, cylinders and spheres and could union
them together or intersect, subtract(difference) them from each other to
make your desired shape.
E.g.
module _wedge_cut(X,Y,Z) {
angle = atan(Z/Y0.5);
translate([-Delta/2,0,Z/2])
rotate([angle,0,0])
cube(size=[X+Delta, Y1.4, Z]);
}
Delta = 0.1;
module wedge(X,Y,Z) {
difference() {
// cube
cube(size = [X, Y, Z]);
// remove top
_wedge_cut(X,Y,Z);
// remove bottom
translate([0,0,Z])
mirror([0,0,1])
_wedge_cut(X,Y,Z);
}
}
difference() {
// primary wedge
wedge(width, length, height);
// subtract interior
translate([wall_thickness,0,wall_thickness2+Delta])
wedge(width-wall_thickness2, length-wall_thickness2,
height-wall_thickness2);
// subtract tube
#translate([-Delta/2,(length-motor_offset_from_rear),(height/2)])
rotate([0,90,0])
cylinder(h = width+Delta, r = motor_hole_radius);
}
--
View this message in context:
http://forum.openscad.org/Unable-to-difference-a-polyhedron-with-a-cylinder-tp15850p15854.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Thanks guys. I did consider using cubes etc to build it up, but thought it
would be easier with a polyhedron - that may have been a mistake.
I thought there was something wrong at the front wedge, but for the life of
me couldn't see it. I'm currently reinstalling my computer OS, so will give
your suggestion a go once it's back.
Cheers
Chris
--
View this message in context: http://forum.openscad.org/Unable-to-difference-a-polyhedron-with-a-cylinder-tp15850p15865.html
Sent from the OpenSCAD mailing list archive at Nabble.com.