-
Notifications
You must be signed in to change notification settings - Fork 9
WrapSTL
To integrate STL component into the Assembler, it must provide a "wrapper" module that takes the standard measurements and coordinates and uses them to scale and position the part. Then it's a simple extension to the Assembler to add calls to the wrapper.
Note that the parameters of the "wrapper" module are identical between the parametric and static components. The difference is in how the wrapper invokes the component.
OpenSCAD supports STL and OBJ files.
See Guide for making STLs that are easy to integrate
The assembler will call the module and pass in the standard parameters:
-
assemble:
False
means that the part should be rendered for printing,True
means that the part should be positioned in space between the control points (e.g. wrist and knuckles) so that the user can see the part previewed in place as a part of a complete assembly. -
wrist:
[x, y, z]
coordinates of wrist, to make translation to that point easy. -
knuckle:
[x, y, z]
coordinates of knuckles, to make translation to that point easy. -
measurements: array of all measurements, as defined by
Assembler.scad
. That is:[[prostheticHand, Left1, Left2, Left3, Left4, Left5,Left6, Left7, Left8, Left9, Left10, LeftFlexion, LeftExtension],
`[1-prostheticHand, Right1, Right2, Right3, Right4, Right5,Right6, Right7, Right8, Right9, Right10, RightFlexion, RightExtension]];`
measurements[0][0]
is 0
if the prosthetic is for the left hand, and 1
if the prosthetic is for the right hand. measurements[1][0]
is the other hand. This allows for constructing expressions such as measurements[measurements[1][0]][5]
to refer to measurement 5 from the non-prosthetic hand.
The arm is in a line, with elbow, wrist, knuckle and fingertips in a straight line on the positive Y axis. Z is up.
- label is a text label to superimpose on the part for identifying the part for later tracking and reprinting.
- font uses Write.scad font names to personalize the parts. The default is letters.dxf.
Scale the STL file to suit the measurements. For example, take the wrist to knuckle measurement of the non-prosthetic hand and make the palm for the prosthetic hand that long.
Translate the part so that the rear control point (e.g. wrist for palm, knuckle for finger) is at [0,0,0] for printing, or at the wrist control point for displaying the assembled parts.
Superimpose the label onto the STL, to 'serialize' each print.
Sample wrapper module that takes standard parameters, includes the parametric design, and calls the parametric design. Note that this can be a module defined in the part's file.
use <write/Write.scad>
// Comment this out to use in assembly
//CyborgLeftPalm(assemble=true);
This is the module invoked by Assembly.scad.
module CyborgLeftPalm('
assemble=false, wrist=[0,0,0], knuckle=[0, 51.85, 0], measurements, '
label="http://eNABLE.us/NCC1701/1", font="Letters.dxf") {
if (assemble==false)
// render for printing
CyborgLeftPalmInner(assemble=false, wrist=wrist, knuckle=knuckle,
measurements=measurements, label=label, font=font);
if (assemble==true)
// render for preview within complete assembly
translate(wrist)
// palm [0,0,0] is wrist hinge
CyborgLeftPalmInner(assemble=false, wrist=wrist, knuckle=knuckle,
measurements=measurements, label=label, font=font);
}
The inner module scales and imports the STL.
module CyborgLeftPalmInner(wrist, knuckle, measurements, label, font) {
CBLPwristOffset = [40,-25,1.5]; // translate by this to move wrist to [0,0,0]
targetLen = knuckle[1]-wrist[1];
stlLen = 54; // length measured in STL (i.e. to scale from)
scale = targetLen/stlLen;
echo("<<cyborg beast palm, version 1.15, scale: ", scale, ">>");
%translate([0,0,50]) rotate([90,0,-90])
write(str(floor(scale*100+.5),"%"), center=true, h=30, font=font);
`echo("Cyborg Beast Palm, scale ",scale*100,"% translate ",CBLPwristOffset);`
`scale([1,scale,scale])` // Note: scale X (width) independently from Y/Z so gauntlet and fingers fit.
`translate(CBLPwristOffset) union() {`
`import("../Cyborg_Beast/STL Files/STL Files_ Marc Petrykowski_4-16-2014/Cyborg Left Palm 1.15.stl");`
`import("Cyborg Left Palm 1.15.stl");`
`echo("Label ", label);`
`color("blue") translate([0,stlLen-10.5,0]) translate(-1*CBLPwristOffset) resize([42,1,8])`
`rotate([90,0,0]) write(label, center=true, h=8, font=font);`
`}`
`}`