Merging sub-assemblies?

classic Classic list List threaded Threaded
36 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Merging sub-assemblies?

OpenSCAD mailing list-2
I’m starting my first proper design. At this early stage on the learning curve I’ve edited several models from thingiverse but now want to try my own simple rectangular box.

It’s purpose will be a mains electrical ‘dry box’. (I could buy one for about 90p!) I already have a two-way socket which will become its ‘lid’, so my box will need mounting holes for self tapping screws (or threaded bolts) and a larger hole for cable entry. I will be able to specify exact dimensions of length, width, depth, hole positions, and wall thickness.

But before I start coding I’d appreciate advice on a basic design question please. I understand that the ‘obvious’ approach to a hollow box would be subtracting one cube from another. And then essentially a series of similar unions and differences to create the supports and holes. But I’m wondering if an alternative is possible (either in OpenSCAD or Cura, or both), that I might find more intuitive. Specifically, could I make several sections and ‘merge’ them together? Make the base, a solid rectangle. Then an ‘empty’ rectangle, with its edges say 3mm wide. Extrude that to the required box depth. Then merge/weld those two components together?

Terry

Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

mondo
I think I would probably draw the profile it in 2d, and linear extrude
to the depth of the box, then add the base as a 'flat' cube. In 2d, you
can get nice rounded edges with 'offset', and that will quickly give you
decent shaped supports for the screw pillars/whatever. I would decide
what was important, the inside dimensions, or outside ones, and add or
subtract a wall thickness to get the other. I too came into openscad via
a box in thingiverse.

On 08/05/2021 14:21, Terrypin via Discuss wrote:
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to [hidden email]
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

LenStruttmann
Either approach is valid. It just depends on what you are most comfortable with.  Since you are at the beginning of your OpenSCAD experience, build your design both ways and see which way feels best to you and your personal way of thinking.

Personally, I use a little of both ways.  This morning I designed a stake to use to hold signs in our garden.  I started with half tubes created by subtracting stuff from a cylinder(). But then "welded" flat cubes for the shaft.  Then added a wedge at the bottom to give the shaft a sharp point.  

Go with what best suits your thought processes.


On Sat, May 8, 2021 at 9:41 AM Ray West <[hidden email]> wrote:
I think I would probably draw the profile it in 2d, and linear extrude
to the depth of the box, then add the base as a 'flat' cube. In 2d, you
can get nice rounded edges with 'offset', and that will quickly give you
decent shaped supports for the screw pillars/whatever. I would decide
what was important, the inside dimensions, or outside ones, and add or
subtract a wall thickness to get the other. I too came into openscad via
a box in thingiverse.

On 08/05/2021 14:21, Terrypin via Discuss wrote:
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to [hidden email]
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

Kenneth Sloan
When learning a new approach/language/style, it is often best to START by being a "purist".

OpenSCAD was built on a foundtion of Constructive Solid Geometry.  The language itself is very  different than "traditional" procedural programming languages.  

My recommendation is to embrace the style of the language and the style of constructing objects before exploring the ways in which you can make OpenSCAD look and feel "intuitive" to you.

I am reminded of watching FORTRAN programmers trying  to learn LISP.  The successful ones forgot everything they knew about "programming" and dove head first into LISP.  The unsuccessful ones spent a year writing FORTRAN programs in LISP syntax - and eventually gave up because they could see no advantage/difference between FORTRAN and LISP (other than that the LISP syntax looked very strange and unnatural to them).

In the case of a moderately simple "box with holes plus screw locations", I recommend that you do it in the "purest" OpenSCAD style.   Don't worry about fine points (which may require "impure" operations) until you have that working.  Start with a brick and subtract out the parts you don't need (and perhaps  then add back in pieces you do need).  Worry about rounded corners, etc. later...much later.

In particular - DO NOT do "what you are most comfortable with".  Being a little bit uncomfortable is the way to make progress!

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.
 
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

OpenSCAD mailing list-2
Thanks all, much appreciate those helpful suggestions. Right, now to get started. I'll begin with pure intentions - but as patience isn't a strong point I suspect I may lapse!

Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

adrianv
In reply to this post by Kenneth Sloan
This advice isn't very useful unless you identify what you mean by being an OpenSCAD "purist".  

I think that making a box as a difference of cubes, or making a box by extruding a difference of squares and then unioning with a base are both "purist" OpenSCAD approaches, and equally valid.  Nopscad has argued for doing everything in 2d as much as possible for efficiency.  

What is "impure" OpenSCAD?  Using list comprehensions or (gasp!) C-style for?  

Kenneth Sloan wrote
When learning a new approach/language/style, it is often best to START by being a "purist".

OpenSCAD was built on a foundtion of Constructive Solid Geometry.  The language itself is very  different than "traditional" procedural programming languages.  

My recommendation is to embrace the style of the language and the style of constructing objects before exploring the ways in which you can make OpenSCAD look and feel "intuitive" to you.

I am reminded of watching FORTRAN programmers trying  to learn LISP.  The successful ones forgot everything they knew about "programming" and dove head first into LISP.  The unsuccessful ones spent a year writing FORTRAN programs in LISP syntax - and eventually gave up because they could see no advantage/difference between FORTRAN and LISP (other than that the LISP syntax looked very strange and unnatural to them).

In the case of a moderately simple "box with holes plus screw locations", I recommend that you do it in the "purest" OpenSCAD style.   Don't worry about fine points (which may require "impure" operations) until you have that working.  Start with a brick and subtract out the parts you don't need (and perhaps  then add back in pieces you do need).  Worry about rounded corners, etc. later...much later.

In particular - DO NOT do "what you are most comfortable with".  Being a little bit uncomfortable is the way to make progress!

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.
 
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]


Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

Troberg
In reply to this post by OpenSCAD mailing list-2
I usually try to stay as true as possible to the construction method. Each part I make will be one part in the model.

So, if I do something for laser cutting, I make each laser cut part each own part. If I make a plan for woodworking, Every single bit will be it's own module, which is then put together in one or more assemblies.

Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

JordanBrown
In reply to this post by OpenSCAD mailing list-2
Without any claim that it's best approach, my first thought on building a box is to have each of the sides be a cube, pretty much like it would be if I was building it out of wood.

(The "extrude from 2D" approach seems like a winner because of the ease of producing rounded corners, though it doesn't explain how to round the corners at the bottom.)


_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

LenStruttmann
To get a rounded cube, I put spheres in each of the 8 corners, then use hull() to form the box.  It's NOT fast, but it's easy.  I use this all the time.

$fn = 24;

cube_soft( 20, 30, 10, 5 );


//****************************************************************
module cube_soft( x, y, z, r, center=false )
{
  if (center==true)
  {
    whole( x, y, z, r );
  }
  else
  {
    translate( [ 0.5*x, 0.5*y, 0.5*z ] ) whole( x, y, z, r );
  }

  module whole( x, y, z, r )
  {
    hull()
    for ( i=[-1:2:1],j=[-1:2:1],k=[-1:2:1] )
    {
      translate( [ i*(0.5*x-r),j*(0.5*y-r),k*(0.5*z-r) ] )
      sphere( r );
    }
  }
}
//****************************************************************



Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

mondo
In reply to this post by JordanBrown
I found some code on thingiverse that does fillets and chamfers on the
top and/or bottom. Simple in concept, slow to render -
https://www.thingiverse.com/thing:2461392   (I found a slight error in
code, not sure if it has been corrected). But, often don't need the base
rounded, if being screwed to  a wall.

On 11/05/2021 15:22, Jordan Brown wrote:
> though it doesn't explain how to round the corners at the bottom.)
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
rew
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

rew
In reply to this post by JordanBrown
On Tue, May 11, 2021 at 02:22:40PM +0000, Jordan Brown wrote:
> Without any claim that it's best approach, my first thought on building
> a box is to have each of the sides be a cube, pretty much like it would
> be if I was building it out of wood.

> ... extrude ..

I would then first make a module that produces a side with a
specific size and rounding radius:


module qsphere (r)
{
  intersection () {
    sphere (r);
    cube (r+1);
  }
}


module side (x, y, r)
{
  hull () {
    translate ([x-r, y-r,0]) rotate (  0) qsphere (r);
    translate ([  r, y-r,0]) rotate ( 90) qsphere (r);
    translate ([  r,   r,0]) rotate (180) qsphere (r);
    translate ([x-r,   r,0]) rotate (270) qsphere (r);
  }
}

side (50,70,10);

then building up a box would be joining 5 of these....

        Roger.

(I named the Eigth-of-a-sphere qsphere for quartersphere. Sue me).


--
** [hidden email] ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

adrianv
In reply to this post by mondo
It's pretty darn slow, and the output is ugly (stair steps instead of actual roundovers).  Have you time tested it against minkowski?  

BOSL2 has a support for a variety of rounding, either direct rounded cubes with options to the cuboid() module, or more sophisticated rounding in rounding.scad.

I usually make boxes with teardrop rounding on the outside bottom (to assure printability without supports), a big roundover on the vertical edges, a small roundover on the top, and a small to medium roundover on the bottom inside by using a combination of offset_sweep and round_corners in BOSL2.  But I wouldn't call this a basic approach.  

https://github.com/revarbat/BOSL2/wiki/rounding.scad

mondo wrote
I found some code on thingiverse that does fillets and chamfers on the
top and/or bottom. Simple in concept, slow to render -
https://www.thingiverse.com/thing:2461392   (I found a slight error in
code, not sure if it has been corrected). But, often don't need the base
rounded, if being screwed to  a wall.

On 11/05/2021 15:22, Jordan Brown wrote:
> though it doesn't explain how to round the corners at the bottom.)
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]


Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

OpenSCAD mailing list-2
Impressive set of responses, thanks all! These will keep me busy for quite some time and will be a great learning exercise.

I’ve made the box by several of the suggested methods so far, including minkowski().  I’m finding hull() rather attractive. With a cylinder instead of a sphere at each of the cube’s four vertical edges it’s also one of the more intuitive. But I’ve yet to try extruding 2D, which I’m looking forward to.

And I’ve so far not worked with a library hso I need to study that thingiverse code. Do I have to just place the downloaded scads in the same folder as my code to get it working?

BTW, I want this box to have a flat top rim, not rounded, so that the existing top socket assembly rests on it squarely.

Spent an hour or two working on ways to manipulate the displayed results so that I could measure the dimensions of my various attempts precisely. Any consensus on best method please? I zoomed in greatly and rotated so that axis markings visible (with transparency if necessary).  One odd thing: the numbering seems to stop at some point around 90 when zoomed near max. So, for example, I could accurately determine the wall thickness near (0,0,0), but ensuring the box was 143 long was trickier.

Much appreciate all the generous help, thank you.

Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

JordanBrown
On 5/11/2021 2:54 PM, Terrypin via Discuss wrote:
Spent an hour or two working on ways to manipulate the displayed results so that I could measure the dimensions of my various attempts precisely. Any consensus on best method please? I zoomed in greatly and rotated so that axis markings visible (with transparency if necessary).  One odd thing: the numbering seems to stop at some point around 90 when zoomed near max. So, for example, I could accurately determine the wall thickness near (0,0,0), but ensuring the box was 143 long was trickier.


Mostly you don't want to be measuring - you want to be *specifying*.  If you want a box to be 143 units long then that's how big you construct it.  With cylinder-plus-hull construction, your overall dimensions are the distances between the centerpoints of the cylinders, plus twice the radius of the cylinders.

Hint, BTW:  if you want different radii on two sides of a box, you need a torus at the corner.

For those rare times when I want to measure, here's the measuring stick that I use.  It's used like a real-life measuring stick, positioned in the model against the points to be measured.

module measuringstick(len, interval=pow(10,floor(log($vpd)-1)), center=false) {
    if (!is_undef($measure) && $measure) {
        r = 0.5;
        mark = interval * 0.01;
        %translate([0, 0, center ? -len/2 : 0]) {
            for (z=[0:interval:len]) {
                mark1 = min(len-z, mark/2);
                if (mark1 > 0) {
                    translate([0,0,z]) color("black") cylinder(r=r, h=mark/2);
                }
                z2 = z + mark1;
                block = min(len-z2, interval-mark);
                if (block > 0) {
                    translate([0,0,z2]) cylinder(r=r, h=block);
                }
                z3 = z2 + block;
                mark2 = min(len-z3, mark/2);
                if (mark2 > 0) {
                    translate([0,0,z3]) color("black") cylinder(r=r, h=mark/2);
                }
            }
        }
    }
}


_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

mondo
In reply to this post by adrianv

I said it was slow. For simple shapes, cubes/whatever, then there are quicker ways, but it is faster if you run the scad script in AngelCAD, pretty darn fast, in fact. You can control the stair stepping - it makes no difference in 3d printing, use finer steps. Minkowski does not do fillets - it adds, not subtracts the rounding, as does offset in 2d. Hull just wraps the shape, it does not follow indents. In the past, I've used freecad, which has useful filleting, and for stuff like boxes I've generated shaped extrusions to round of the corners by differencing, and you do not need to go back and alter dimensions as you would need to do for simpler shapes, using hull or minkowski. But using the code I mentioned, you can  easily round of the bottom or top edge of shapes, such as below, and afaik, there is no inbuilt method for filleting in openscad.


On 11/05/2021 21:20, adrianv wrote:
It's pretty darn slow, and the output is ugly (stair steps instead of actual roundovers).  Have you time tested it against minkowski?  

BOSL2 has a support for a variety of rounding, either direct rounded cubes with options to the cuboid() module, or more sophisticated rounding in rounding.scad.

I usually make boxes with teardrop rounding on the outside bottom (to assure printability without supports), a big roundover on the vertical edges, a small roundover on the top, and a small to medium roundover on the bottom inside by using a combination of offset_sweep and round_corners in BOSL2.  But I wouldn't call this a basic approach.  

https://github.com/revarbat/BOSL2/wiki/rounding.scad

mondo wrote
I found some code on thingiverse that does fillets and chamfers on the
top and/or bottom. Simple in concept, slow to render -
https://www.thingiverse.com/thing:2461392   (I found a slight error in
code, not sure if it has been corrected). But, often don't need the base
rounded, if being screwed to  a wall.

On 11/05/2021 15:22, Jordan Brown wrote:
> though it doesn't explain how to round the corners at the bottom.)
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]


Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

adrianv
If you're going to use AngelCAD then....why not just use AngelCAD?  

In principle modeling stair-step style should be OK, but it's hard to view the models, at least in OpenSCAD, due to the moire patterns---it's hard to tell what the model actually looks like---and it's just an inelegant technique.  And you don't even get repaid with decent speed for suffering the inelegance, so I really don't find it compelling.  

You can use multiple applications of minkowski to get inside and outside rounding if you're willing to wait for it.   In 2d this technique is practical.  As long as your shape's thinnest part is larger than the inside rounding radius.  

module round2d(r, or, ir)
{
    offset(or) offset(-ir-or) offset(delta=ir,chamfer=true) children();
}

A similar scheme with minkowski and differences from a cube larger than your model can round an arbitrary 3d object.  But it may take hours.  

My first model relied on minkowski and takes 20 minutes to preview.  Since then I've spent a lot of time writing code to round things that actually runs fast, but doing this in a fully general way isn't feasible.   And you're right: there's no "fillet" command in OpenSCAD.

mondo wrote
I said it was slow. For simple shapes, cubes/whatever, then there are
quicker ways, but it is faster if you run the scad script in AngelCAD,
pretty darn fast, in fact. You can control the stair stepping - it makes
no difference in 3d printing, use finer steps. Minkowski does not do
fillets - it adds, not subtracts the rounding, as does offset in 2d.
Hull just wraps the shape, it does not follow indents. In the past, I've
used freecad, which has useful filleting, and for stuff like boxes I've
generated shaped extrusions to round of the corners by differencing, and
you do not need to go back and alter dimensions as you would need to do
for simpler shapes, using hull or minkowski. But using the code I
mentioned, you can  easily round of the bottom or top edge of shapes,
such as below, and afaik, there is no inbuilt method for filleting in
openscad.


On 11/05/2021 21:20, adrianv wrote:

> It's pretty darn slow, and the output is ugly (stair steps instead of
> actual roundovers).  Have you time tested it against minkowski?
>
> BOSL2 has a support for a variety of rounding, either direct rounded
> cubes with options to the cuboid() module, or more sophisticated
> rounding in rounding.scad.
>
> I usually make boxes with teardrop rounding on the outside bottom (to
> assure printability without supports), a big roundover on the vertical
> edges, a small roundover on the top, and a small to medium roundover
> on the bottom inside by using a combination of offset_sweep and
> round_corners in BOSL2.  But I wouldn't call this a basic approach.
>
> https://github.com/revarbat/BOSL2/wiki/rounding.scad 
> <https://github.com/revarbat/BOSL2/wiki/rounding.scad>
>
>     mondo wrote
>     I found some code on thingiverse that does fillets and chamfers on
>     the
>     top and/or bottom. Simple in concept, slow to render -
>     https://www.thingiverse.com/thing:2461392
>     <https://www.thingiverse.com/thing:2461392> (I found a slight
>     error in
>     code, not sure if it has been corrected). But, often don't need
>     the base
>     rounded, if being screwed to  a wall.
>
>     On 11/05/2021 15:22, Jordan Brown wrote:
>     > though it doesn't explain how to round the corners at the bottom.)
>     _______________________________________________
>     OpenSCAD mailing list
>     To unsubscribe send an email to [hidden email]
>     </user/SendEmail.jtp?type=email&email=discuss-leave%40.openscad>
>
>
> ------------------------------------------------------------------------
> Sent from the OpenSCAD mailing list archive
> <http://forum.openscad.org/> at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to [hidden email]

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]


leoojcjflhpnamdp.jfif (73K) <http://forum.openscad.org/attachment/33076/0/leoojcjflhpnamdp.jfif>


Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

OpenSCAD mailing list-2
In reply to this post by JordanBrown
Thanks, that tool looks fascinating. I’ll try it next time I need to reassure myself about dimension accuracy.

The situation in the case I described was because in exasperation I was resorting to trial and error after losing control of my intended geometry! I made a better job of it on my subsequent more methodical attempt.

Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

nophead
Not sure why you have problems with dimensional accuracy because objects designed in OpenSCAD are the size I specify in the code, so I don't need to measure them.

One thing to be aware of when making rounded objects by hulling circles, cylinders and spheres is they should always have a multiple of 4 vertices, so you get a vertex exactly on each axis to align with the sides of your box. Otherwise it will be slightly too small. See https://github.com/nophead/NopSCADlib/blob/52e9c1d7fd97555a03ea9c029887902d28aefae5/utils/core/global.scad#L69

Also I replace the OpenSCAD sphere with my own that has vertices at the poles. See https://github.com/nophead/NopSCADlib/blob/52e9c1d7fd97555a03ea9c029887902d28aefae5/utils/core/sphere.scad#L23


On Wed, 12 May 2021 at 11:00, Terrypin via Discuss <[hidden email]> wrote:



---------- Forwarded message ----------
From: Terrypin <[hidden email]>
To: [hidden email]
Cc: 
Bcc: 
Date: Wed, 12 May 2021 00:32:51 -0700 (MST)
Subject: [OpenSCAD] Re: Merging sub-assemblies?
Thanks, that tool looks fascinating. I’ll try it next time I need to reassure myself about dimension accuracy.

The situation in the case I described was because in exasperation I was resorting to trial and error after losing control of my intended geometry! I made a better job of it on my subsequent more methodical attempt.

Sent from the OpenSCAD mailing list archive at Nabble.com.



---------- Forwarded message ----------
From: Terrypin via Discuss <[hidden email]>
To: [hidden email]
Cc: Terrypin <[hidden email]>
Bcc: 
Date: Wed, 12 May 2021 00:32:51 -0700 (MST)
Subject: [OpenSCAD] Re: Merging sub-assemblies?
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

OpenSCAD mailing list-2
"Not sure why you have problems with dimensional accuracy because objects designed in OpenSCAD are the size I specify in the code, so I don't need to measure them."

That's my aim too, but I did explain in my reply a few hours ago.

Thanks for the suggestions about hulling which I'll study. Meanwhile just about to post my own 'hull' result.

Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Merging sub-assemblies?

OpenSCAD mailing list-2
In reply to this post by JordanBrown
Here's my version based on hull with cylinders. I also used the exercise to learn how to work with modules, so that I can make more of these in future.



// 'Dry box' for dual mains sockets
// Used 'hull with cylinders' method
// Dimensions: length = x = 143, width = y = 83, height = z = 25, roundness = r = 6, thickness = t = 3 to match existin top

$fn = 48; // Have been using 50 but recently read somewhere that multiples of 4 are recommended?

module round_edges_box(x,y,z,r) {
hull() {
translate([r,r,0])
cylinder(h=z,r=r);
translate([x-r,r,0])
cylinder(h=z,r=r);
translate([x-r,y-r,0])
cylinder(h=z,r=r);
translate([r,y-r,0])
cylinder(h=z,r=r);
} // End of hull
} // End of module round_edges_box

// Different name for 'fully parametrised' version

module rounded_edges_box(x,y,z,r,t) {
  // Hollow the solid by subtracting the smaller (and translated) version below  
 difference(){   
round_edges_box(x,y,z,r);
translate([t,t,t]) // Moves smaller box out from origin
round_edges_box(x-(2*t),y-(2*t),(z+10),r);   
}
}
rounded_edges_box(143,83,25,6,3);

The top for the box is shown here:
https://www.dropbox.com/s/m90ckyv7u5phnwa/DualMainsSockets-1.jpg?raw=1

I estimated the roundness, r, by finding an object that fitted a corner neatly; this pad had a radius of about 3mm:

https://www.dropbox.com/s/n6zjhnv8d8r0019/RoundnessEstimate.jpg?dl=0httraw=1

P.S. I originally used 'Insert Image' for the two photos but preview showed them at full size. Hence my reverting to links. How should images be displayed in familiar thumbnail form, or limited to screen size for reasonable viewing please?


Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
12