Thought Process Question

classic Classic list List threaded Threaded
13 messages Options
M W
Reply | Threaded
Open this post in threaded view
|

Thought Process Question

M W
Hi all; I thought I'd ask a question on the topic of "How do I think of creating a part with OpenSCAD?"

I've been programming since the 70's, in many languages, and I've used lathes, milling machines, CNC driven sometimes, so I know how to think as if I'm milling something.

Let's say I am making a container that holds 50 of something, in 5 rows of 10; what is "the best" way to look at building this sort of thing?

Is it best to build a procedure that builds the overall container, then another that drills the hole out for the object it's storing, and repeat that somehow to drill the 50 holes out, or ??

I figure here's the place to ask, on how best to wrap my brain around this category of problem :)

Thanks,

  Mark


Reply | Threaded
Open this post in threaded view
|

Re: Thought Process Question

M.Rule
"Is it best to build a procedure that builds the overall container, then another that drills the hole out for the object it's storing, and repeat that somehow to drill the 50 holes out, or ??"

this is exactly right. this kind of thinking looks vaguely like

difference() {
union() {
define overall container here
}
for (row = [0:5]) for (col = [0:10]) translate([n*row,n*col,0) {
define cutaway here
}
}



On Mon, Apr 30, 2012 at 3:13 PM, M W <[hidden email]> wrote:
> Hi all; I thought I'd ask a question on the topic of "How do I think of creating a part with OpenSCAD?"
>
> I've been programming since the 70's, in many languages, and I've used lathes, milling machines, CNC driven sometimes, so I know how to think as if I'm milling something.
>
> Let's say I am making a container that holds 50 of something, in 5 rows of 10; what is "the best" way to look at building this sort of thing?
>
> Is it best to build a procedure that builds the overall container, then another that drills the hole out for the object it's storing, and repeat that somehow to drill the 50 holes out, or ??
>
> I figure here's the place to ask, on how best to wrap my brain around this category of problem :)
>
> Thanks,
>
>   Mark
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
Reply | Threaded
Open this post in threaded view
|

Re: Thought Process Question

Ed Nisley
In reply to this post by M W
On Mon, 2012-04-30 at 12:13 -0700, M W wrote:
> repeat that somehow to drill the 50 holes

That's probably the best way to go about it, because joining many
separate parts together into a single solid model tends to produce weird
errors... at least for me, anyway.

Here's a writeup about a simple stepper motor mount that went badly
wrong:

http://softsolder.com/2011/08/23/nema-17-stepper-motor-mount/

I recently put together a case for some PCBs that started with a solid
block and subtracted modules that bounded the PCB volumes; that's the
central part of this assortment:

http://softsolder.com/2012/04/13/wouxun-kg-uv3d-gps-interface-functional-case/

For the container you're describing, I'd make a solid block of the right
outside dimensions, build a model of the "somethings" that fit inside,
then iterate & subtract the somethings from the block. Add some
finishing touches like punching out holes for hinges & clasp and you're
done.

That produces a solid block with voids inside: slice off the top and
print the base, then slice off the bottom and print the lid.

Might not work, but that's how I'd start... [grin]


--
Ed
http://softsolder.com



M W
Reply | Threaded
Open this post in threaded view
|

Re: Thought Process Question

M W
TY M. Rule & Ed. I figured asking was a good idea :) Interesting case, Ed!

A case for my inbound Raspberry Pi, then a new widget I'll build are about the NEXT thing I'll be doing with OpenSCAD, soon as I finish designing the widget (client on that one, is driving me NUTS; sorta par for the course, this. And then he has more projects after that ACK! LOL)

What are units.scad and useful sizes.scad used for? First time I've seen those, I don't have scad up ATM (this laptop is old and only 1GB RAM), maybe those will help set things up more sanely with the guy whose printer I'm borrowing LOL


Speaking of objects that aren't done right - I saw a "Rotor Clock" (where you use LEDs spun on a rotor to show time or a message) where the motor was glued onto a painted wooden stand. Shudder. Semester project for them, and *fortunately* the glue waited to split off from the paint, until AFTER they'd been evaluated by the instructor; Not the ideal way to mount something to wood! (Screwed or bolted, and glued, would be my first choices - with washers under the nuts if you went with bolts; Dry wall screws give decent holding power, alternately, if the wood's thick enough.)


The whole 3D printer world seems to still be evolving from what I see, I know I sure have much to learn about it! There are things (like having to manually lower your design to touch the bed the printer prints on) that would make more sense if they were auto-magic, but I'm sure there're reasons :)


  Mark


> http://softsolder.com/2011/08/23/nema-17-stepper-motor-mount/
>
> I recently put together a case for some PCBs that started with a solid
> block and subtracted modules that bounded the PCB volumes; that's the
> central part of this assortment:
>
> http://softsolder.com/2012/04/13/wouxun-kg-uv3d-gps-interface-functional-case/
>
> For the container you're describing, I'd make a solid block of the right
> outside dimensions, build a model of the "somethings" that fit inside,
> then iterate & subtract the somethings from the block. Add some
> finishing touches like punching out holes for hinges & clasp and you're
> done.
>
> That produces a solid block with voids inside: slice off the top and
> print the base, then slice off the bottom and print the lid.
>
> Might not work, but that's how I'd start... [grin]
>
>
> --
> Ed
> http://softsolder.com
>
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
>

Reply | Threaded
Open this post in threaded view
|

Re: Thought Process Question

Triffid Hunter
In reply to this post by M W
On Tue, May 1, 2012 at 05:13, M W <[hidden email]> wrote:
Hi all; I thought I'd ask a question on the topic of "How do I think of creating a part with OpenSCAD?"

I've been programming since the 70's, in many languages, and I've used lathes, milling machines, CNC driven sometimes, so I know how to think as if I'm milling something.

Let's say I am making a container that holds 50 of something, in 5 rows of 10; what is "the best" way to look at building this sort of thing?

I'd start with the overall shape, just a big cube() or if I want rounded edges I'll play with cylinder(), sphere() and hull().

then cut out the drawers using for() and maybe cylinder($fn=4) or hull() again if you don't want the sides perfectly vertical or might want fillets in the bottom.

I'd suggest constructing a single negative, then wrapping a render() around it for speed, then run your for loop with the result


If ever you want to join two pieces together, you cannot have any coplanar faces anywhere or you'll end up with a non-manifold mesh. This isn't openscad's fault, this is actually part of the math, like the CSG version of heisenberg uncertainty. The same thing happens with autodesk, blender, etc when doing boolean operations.

SO if you want a single face somewhere, it has to start as a single object that you cut down. If you want tangential attachments, you'd best be using hull() or similar rather than hacking at it yourself.

http://cloud.netfabb.com is pretty good at fixing mildly imperfect STLs, but best be checking the result- if it has to repair large areas they're not going to look how you want them to!
M W
Reply | Threaded
Open this post in threaded view
|

Re: Thought Process Question

M W
TY Triffid, hmmm, I don't recall hull() or render() - more to look up :) I usually build a "cheat sheet" for languages I'm learning, it helps me finish learning it all, I'll be doing that more (already started a month ago or so) on SCAD.

My first 3D print objects should be printed (I hope), I'll have to see how they came out :)

  Mark
Reply | Threaded
Open this post in threaded view
|

Re: Thought Process Question

Triffid Hunter
On Tue, May 1, 2012 at 11:55, M W <[hidden email]> wrote:
TY Triffid, hmmm, I don't recall hull() or render() - more to look up :)

hull() gives a 3D convex hull of all child objects, think wrapping a sheet around things, so you can position some cylinders and spheres where you want corners, then hull() and you get a rounded cube.

http://www.thingiverse.com/thing:21340 is an excellent demonstration of what you can do with hull()

render() passes its sub-tree to CGAL to get a proper mesh instead of a CSG tree, then caches the result. this makes it take (lots) longer the first time, but then is hugely faster every subsequent time unless you change something in the subtree and make it re-render.

This is useful for when you create a sub-assembly that isn't going to change but may be used a lot elsewhere, such as the cut-out for your drawers.

It's also handy for if you need to move parts around a lot while still seeing any commented or highlighted sections (ie things that fit together), or doing animations, since it gives you the speed of the fully rendered (f6) view while retaining the advantages of the CSG (f5) view
M W
Reply | Threaded
Open this post in threaded view
|

Re: Thought Process Question

M W
Aah, great, I can see what hull() does then, handy! Sorta like an old school RC model with heat shrink over the top then :)

render() sounds good too. Always more to learn :) Thanks!

  Mark
Reply | Threaded
Open this post in threaded view
|

Re: Thought Process Question

Ed Nisley
In reply to this post by M W
On Mon, 2012-04-30 at 15:53 -0700, M W wrote:
> What are units.scad and useful sizes.scad used for?

The units.scad file comes from (IIRC) the MCAD library and has some
conversions between inches & mm and suchlike. The "useful sizes.scad"
file has similar dimensional odds & ends I've collected along the way.

Mercifully, 1 OpenSCAD unit = 1 mm of plastic.

> having to manually lower your design
> to touch the bed the printer prints on

I find it's easier to design models that are symmetric around the origin
(or at least oriented for easiest tweaking), then orient & position them
as needed for printing. Most things have several parts, anyway, so the
complete model never gets printed.

> The whole 3D printer world seems to still be evolving

You are obviously the Perfect Master of Understatement... [grin]

--
Ed
http://softsolder.com



M W
Reply | Threaded
Open this post in threaded view
|

Re: Thought Process Question

M W
> Mercifully, 1 OpenSCAD unit = 1 mm of plastic.

TY Ed, I'd just "assumed" that 1 OpenSCAD unit = 1 mm of plastic, but then when I passed the file to the guy whose printer I'm borrowing, I'd TOLD him so, you know what they say about assuming LOL - I do embedded programming normally, so I am decent at conversions, I'll take a look when I reboot (due to low RAM, I need to get the other 2 sick laptops back going!)

> I find it's easier to design models that are symmetric around the origin
> ...

Hmm, I tend to put everything to rest on the X-Y plane, even with that my model "had to be" lowered (oddly), but whatever works LOL

> You are obviously the Perfect Master of Understatement... [grin]

You're starting to know me, uh oh LOL! I've been accused of being understated, I grew up with "Drama Queen" family members, I have an over-developed Humor Bump and I guess I tend to understate things a LOT, it's my way of coping LOL

TY, lets see what mistakes I make with my next design! LOL

  Mark
Reply | Threaded
Open this post in threaded view
|

Re: Thought Process Question

Alan Cox
On Tue, 1 May 2012 18:06:47 -0700 (PDT)
M W <[hidden email]> wrote:

> > Mercifully, 1 OpenSCAD unit = 1 mm of plastic.
>
> TY Ed, I'd just "assumed" that 1 OpenSCAD unit = 1 mm of plastic,

Pedantically speaking STL files are unscaled, and you need to give the
units to whoever prints them. Shapewayd for example will let you specify
1 unit = 1mm/1cm/1inch if I remember the choices.


Reply | Threaded
Open this post in threaded view
|

Re: Thought Process Question

Triffid Hunter
On Wed, May 2, 2012 at 8:36 PM, Alan Cox <[hidden email]> wrote:
Pedantically speaking STL files are unscaled, and you need to give the
units to whoever prints them. Shapewayd for example will let you specify
1 unit = 1mm/1cm/1inch if I remember the choices.

Actually it's unitless all the way through, it's the user that decides what the units are!

The STL has unitless numbers, slic3r combines them with other numbers and sends the results to the firmware in gcode format (which is inherently unitless apart from G20/G21) then the firmware converts the unitless gcode into some number of steps...

I think the closest we get to proper units is that the dialogs and help text in slic3r and firmware configuration specify millimeters, and G20/G21 select a unit for following gcode.

I'm pretty sure if you went through the entire chain and replaced all the relevant numbers with some other unit (eg inches), things would still print properly and at the right size!


M W
Reply | Threaded
Open this post in threaded view
|

Re: Thought Process Question

M W
TY Alan & Triffid; I'll stick with mm, as I can deal with them :) I'll try to avoid using milliCubits, microFurlongs, etc. as I want the guy whose printer I'm borrowing, to stay in contact with me! LOL

  Mark