# distribute holes on double curved surface

8 messages
Open this post in threaded view
|

## distribute holes on double curved surface

 Hello, I have a very specific task I want to solve - importing an stl file, and distribute holes (somewhat) evenly (based on parameters) just imagine importing half a sphere, and turning it into a meshscreen any ideas? Henrik
Open this post in threaded view
|

## Re: distribute holes on double curved surface

 Thus 3hl3rt hast written on Tue, Aug 15, 2017 at 03:57:24AM -0700, and, according to prophecy, it shall come to pass that: > I have a very specific task I want to solve - importing an stl file, and > distribute holes (somewhat) evenly (based on parameters) > > just imagine importing half a sphere, and turning it into a meshscreen Probably something along the lines of: difference(){         import("blahblah.stl");         for ( l = [ 0 : length-1])                 for ( w = [0 : width-1])                         translate( [l * offset, w * offset, 0])                                 cylinder (r=2, h=50); } _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: distribute holes on double curved surface

 But would this make the holes perpendicular to the surface?
Open this post in threaded view
|

## Re: distribute holes on double curved surface

 The previous code would certainly provide for perpendicular holes. If you desire radially oriented holes, here's a throw-up code I managed to create in a few moments. The assignments are not necessarily representative of reality, just useful words in the right place to make a sea urchin, so to speak. ```\$fn = 90; rod_length = 250; rod_diameter = 4; tilt_angle = 30; s_diameter = 100; difference(){ sphere(s_diameter); // insert STL here as desired for (heading = [ 0 : tilt_angle : 180 ]) for (azimuth = [ 0 : tilt_angle : 180 ]) for (elevation = [ 0 : tilt_angle : 180 ]) rotate([heading, elevation, azimuth]) cylinder(h = rod_length, d = rod_diameter); }```You can get some interesting results by changing the tilt angle. You could also change the loop assignments to other increments for equally interesting results. This was fun.
Open this post in threaded view
|

## Re: distribute holes on double curved surface

 In reply to this post by 3hl3rt Depending how important the normality is (you didn't even mention that in your first post), cylinders will give faces that are approximately normal. Making conical (apex at the centre of the sphere) holes rather cylindrical would make normal holes for spherical surfaces.But if the surface is non-spherical, this approach won't work. Have you looked into Voronoi patterns (e.g. https://www.instructables.com/id/Make-Voronoi-Pattern-with-Autodesk-Meshmixer/)? _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: distribute holes on double curved surface

 I have a feeling that this is a "not in OpenSCAD" type problem but it would be useful if:given an arbitrary surface, you could distribute other objects on it (for additive or subtractive purposes), without having to calculate the coordinates at the surface.On Tue, Aug 15, 2017 at 3:07 PM, Frank van der Hulst wrote:Depending how important the normality is (you didn't even mention that in your first post), cylinders will give faces that are approximately normal. Making conical (apex at the centre of the sphere) holes rather cylindrical would make normal holes for spherical surfaces.But if the surface is non-spherical, this approach won't work. Have you looked into Voronoi patterns (e.g. https://www.instructables.com/id/Make-Voronoi-Pattern-with-Autodesk-Meshmixer/)? _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
 This post was updated on . In reply to this post by 3hl3rt use STL files to open SCAD over at http://jsfiddle.net/Riham/yzvGD/ you get some thing like this ``` module object1(scale) {polyhedron( points=[[-5.616000175476074,24.75400161743164,43.1140022277832] .../ /... [1.4420000314712524,-41.124000549316406,54.70000076293945] ], faces=[[0,1,2], .../ /... ,[2535,2536,2537]]);} object1(1); ``` edit the module to two expression , defining points and faces ``` points=[[-5.616000175476074,24.75400161743164,43.1140022277832] .../ /... [1.4420000314712524,-41.124000549316406,54.70000076293945] ]; faces=[[0,1,2], .../ /... ,[2535,2536,2537]]; ``` From there on you can calculate center and face normal for each face in the mesh. From normals you find rotations for your hole cutters You can find all necessary functions for normal and rotations on my blog: https://openscadsnippetpad.blogspot.se/search?q=normal https://openscadsnippetpad.blogspot.se/2017/05/lookat-function-and-module.html https://openscadsnippetpad.blogspot.se/2017/05/angle-between-two-vectors-in-3d.html https://openscadsnippetpad.blogspot.se/search/label/vsum . Credits to a bunch of people in math history