OpenSCAD Parametric Packaging Script v2 by M_G 3d model
3dmdb logo
Thingiverse
OpenSCAD Parametric Packaging Script v2 by M_G

OpenSCAD Parametric Packaging Script v2 by M_G

by Thingiverse
Last crawled date: 3 years ago
This OpenSCAD script will generate a 2 part fit together packaging for a device of user selectable size. Any amount of various shaped cutouts, support posts, engraved text and logos can be easily placed on any face using special array variables. Check out the instructions below as well as the examples and comments in the code for more information on how to use them.
Author: Mark Gaffney
Version: 2.6c (versions d e & f are slight modifications for a specific item without proper controls but these will be included in v2.7)
Date: 2013-04-04
ToDo:
add user controllable flanges and interlocking lip features
Warning:
Some combinations of values, shapes and locations etc. may lead to an invalid or non-manifold shape beign created, preventing you from exporting a .stl
If this happens try to remove or change some of the features or values until you get a valid shape and then add them back gradually until you find the offending item, then change it so it doesn't cause a problem
Note: This thing uses HarlanDMii's"write.scad" module http://www.thingiverse.com/thing:16193
which you will need to have downloaded and located in the directory if you want to run this on your PC
The version I had did not properly implement spacing on 'writecube', a modified version that implements this is included here...

Generating text can be very slow!

When generating a stacked layout it may look like the top is taller than it should be, this seems to be a visualisation bug in OpenSCAD, if you create a .STL it will be perfect
Changes from previous versions:
v2.6c
Implemented ability to choose box shape i.e. "cuboid","rounded4sides", "rounded6sides", "chamfered6sides"
Ensured "box_type" module is used in generation of each box_half
v2.6b
investigated and fixed some top lip mis alignment
v2.6
implements loading external objects (such as .stl files) to place on faces
implemented overlooked translation of text on faces from previous version
fixed box_t in make_cutouts
v2.5 (AKA cutouts_on_faces_for_loop-v0_2.scad)
Implement tolerancing of connection between 2 halves using lip_fit
implement text on faces
Complete documentation
v2.4 (AKA cutouts_on_faces_for_loop-v0_4.scad)
user provides device dimensions and internal clearance(s), packaging dimensions are calculated based on this
preparations to allow for different wall_t in x,y,z
implement posts
mouse ears work properly
2 halves in "beside" layout joined by union
v2.3 2013-03-23 (AKA cutouts_on_faces_for_loop-v0_3.scad)
fixed calls to make_box and half_box modules
added ability to handle "holes" array for making cutouts to make_box and half_box modules
added module for rounded cuboid
fixed errors on rounded cuboid cutouts's use of a_bit
fixed translate errors for making lips on box
ensured all parts generate on z=0
gave top (greenish) and bottom (reddish) different colours for ease of identification
rotated top in "beside" layout to more intuitive orientation
added box cross module and included in hull calculations to ensure box sizes are exact even with low side count
added box_type module to allow choice of different shaped boxes or automatically swap them based on the current variables
added mouse_ears module
Note: In stacked mode you may notice the red half looks like it is the full length, this appears to be a visualisation bug in openscad, the part is generated correctly
v2.2 2013-03-22 (AKA cutouts_on_faces_for_loop-v0_2.scad)
based on My own structure
New format [face_name, shape_name, shape_position[x_pos,y_pos,x_offs,y_offs,rotate,align], shape_size[depth,,,]]

face_name ("N", "S", "E", "W", "T", "B")


shape_name ("Square", "Rectangle" , "Round_Rect", "Cylinder", "Ellipse" , "Cone")


shape_position[x_pos,y_pos,x_offs,y_offs,rotate,align=("inside" or "outside")]



"Square" shape_size[depth, length_breadth]




"Rectangle" shape_size[depth, length, breadth]




"Round_Rect" shape_size[depth, length, breadth, corner_radius, corner_sides]




"Cylinder" shape_size[depth, radius ,sides]




"Ellipse" shape_size[depth, radius_length, radius_breadth, sides]




"Cone" shape_size[[depth, radius_bottom, radius_top ,sides]


pos_x and pos_y are chosen to align with views taken from the North, Top or East faces towards the origin so that they are aligned with [-x,+z], [+x,+y] & [+y,+z] respectively
rotation is clockwise about the plane of the North, Top or East faces as lookign towards the origin this means they are anticlockwise for the opposite faces(i.e. same convention as above)
these 2 conventiosn are chosen to make it easier to position cutouts that align with oppsite sides. e.g. a box that fits around a rotated ellipse pipe
v2.1 2013-03-22 (AKA cutouts_on_faces_for_loop-v0_1.scad)
based on kitlaan's array structure, supporting cones and rectangles
from kitlaan's Customisable Electronic Device Packaging http://www.thingiverse.com/thing:8607

rect [ x-offset, y-offset, x-width, y-width, corner-radius, corner-sides, depth, rotate ]


cylinder [ x-offset, y-offset, inner-radius, outer-radius, sides, depth, rotate ]

Tags