Skip to content
Laird Popkin edited this page May 6, 2014 · 5 revisions

Assembler standard wrapper

To integrate an OpenSCAD module 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.

Parameters

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.

Responsibilities of the wrapper module

Map the measurements to the configurable parameters of the design. 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.

Sample wrapper

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.

// map measurements and control points into parameters of the CyborgBeastParametric design. module CyborgBeastParametricPalm(assemble=false, standard parameters wrist=[0,0,0], knuckle=[0, 60/*51.85*/, 0], measurements, label, font="Letters.dxf") { palmLen = knuckle[1]-wrist[1]; // length of palm is computed from wrist to knuckles echo("<<Parametric Cyborg Beast Palm version 7.1>>"); // To construct a simple BOM if (assemble==false) // translate to move wrist to [0,0,0] translate([0,palmLen/2,-5]) CyborgBeastParametricPalmInner(palmLen); if (assemble==true) translate(wrist) // translate to move wrist hinge to to wrist control point translate([0,palmLen/2,-5]) CyborgBeastParametricPalmInner(palmLen); }

module CyborgBeastParametricPalmInner(palmLen=54, label=label, font=font) { ... render the palm ... }

Called module

The module that renders the part should:

  • Be a module, not global rendered objects. The name of the module should be 'unique'. That is, something like 'CyborgBeastParametricPalm', rather than 'palm'.
  • Take all inputs as named parameters, not global declarations. This prevents name collisions between parts used in the same assembly.
  • Render the part suitable for printing or display in assembly.
  • Incorporate the label somewhere suitable in the design, so that the part can be identified and reprinted easily.
  • For stand-alone use, it should add a call to the module with good default values. This should be commented out for use in the assembly.

// CyborgBeastParametricPalmInner(palmLen=54, label="TEST");

Clone this wiki locally