discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] Hulling a projection

R
Ronaldo
Mon, Jun 26, 2017 6:45 AM

raycewest wrote

But only in one direction (down).  I could do a hull of said object and a
linear extrusion of its projection onto the xy plane, but it would result
in unwanted space above the object (concave areas) being filled.
Thoughts?

There are possibly simpler and better way to do it but here you have a
starting point:

epsilon = 0.01;

// a test object
translate([30,0,0]) obj();
// its downward extension
extendown() translate([-10,0,0]) obj();

module extendown()
intersection() {
minkowski() {
children();
mirror([0,0,1])
pillar() children();
}
// cylindrical envelope of children
minkowski(){
linear_extrude(height=epsilon)
projection() children();
pillar() children();
}
}

module obj()
translate([0,0,5])
rotate([30,40,0])
{ cube(10);
translate([10,10,0]) cylinder(10,10);
translate([15,0,15]) cube(3);}

// a thin pillar on the origin with height equal to
// the highest point of children
module pillar()
translate([-epsilon/2,-epsilon/2,0])
rotate([-90,0,0])
linear_extrude(height=epsilon)
projection() rotate([0,90,0])
linear_extrude(height=epsilon)
intersection() {
hull()
projection() rotate([90,0,0])
children();
// discard portions of children with negative z
mirror([0,1,0]) translate([-1/epsilon/epsilon/2,0,0])
square(1/epsilon/epsilon);
}

http://forum.openscad.org/file/n21756/extendown.png

--
View this message in context: http://forum.openscad.org/Hulling-a-projection-tp21748p21756.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

raycewest wrote > But only in one direction (down). I could do a hull of said object and a > linear extrusion of its projection onto the xy plane, but it would result > in unwanted space above the object (concave areas) being filled. > Thoughts? There are possibly simpler and better way to do it but here you have a starting point: > epsilon = 0.01; > > // a test object > translate([30,0,0]) obj(); > // its downward extension > extendown() translate([-10,0,0]) obj(); > > module extendown() > intersection() { > minkowski() { > children(); > mirror([0,0,1]) > pillar() children(); > } > // cylindrical envelope of children > minkowski(){ > linear_extrude(height=epsilon) > projection() children(); > pillar() children(); > } > } > > module obj() > translate([0,0,5]) > rotate([30,40,0]) > { cube(10); > translate([10,10,0]) cylinder(10,10); > translate([15,0,15]) cube(3);} > > // a thin pillar on the origin with height equal to > // the highest point of children > module pillar() > translate([-epsilon/2,-epsilon/2,0]) > rotate([-90,0,0]) > linear_extrude(height=epsilon) > projection() rotate([0,90,0]) > linear_extrude(height=epsilon) > intersection() { > hull() > projection() rotate([90,0,0]) > children(); > // discard portions of children with negative z > mirror([0,1,0]) translate([-1/epsilon/epsilon/2,0,0]) > square(1/epsilon/epsilon); > } <http://forum.openscad.org/file/n21756/extendown.png> -- View this message in context: http://forum.openscad.org/Hulling-a-projection-tp21748p21756.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Mon, Jun 26, 2017 7:10 AM

The module pillar() as previously defined does not work as expected when
children is above the xy plane. The following code corrects that.

// a thin pillar on the origin with height equal to
// the highest point of children
module pillar()
translate([-epsilon/2,-epsilon/2,0])
rotate([-90,0,0])
linear_extrude(height=epsilon)
hull(){
square(epsilon,center=true);
projection() rotate([0,90,0])
linear_extrude(height=epsilon)
intersection() {
hull()
projection() rotate([90,0,0])
children();
// discard portions of children with negative z
mirror([0,1,0])
translate([-1/epsilon/epsilon/2,0,0])
square(1/epsilon/epsilon);
}
}

--
View this message in context: http://forum.openscad.org/Hulling-a-projection-tp21748p21757.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

The module pillar() as previously defined does not work as expected when children is above the xy plane. The following code corrects that. > // a thin pillar on the origin with height equal to > // the highest point of children > module pillar() > translate([-epsilon/2,-epsilon/2,0]) > rotate([-90,0,0]) > linear_extrude(height=epsilon) > hull(){ > square(epsilon,center=true); > projection() rotate([0,90,0]) > linear_extrude(height=epsilon) > intersection() { > hull() > projection() rotate([90,0,0]) > children(); > // discard portions of children with negative z > mirror([0,1,0]) > translate([-1/epsilon/epsilon/2,0,0]) > square(1/epsilon/epsilon); > } > } -- View this message in context: http://forum.openscad.org/Hulling-a-projection-tp21748p21757.html Sent from the OpenSCAD mailing list archive at Nabble.com.