Skip to content

OpenSCAD asset template

Example servo OpenSCAD asset.

Idea

  • Three compile phases
  • detection phase: find all geometry modules and especially their tags
  • full geometry module export: render only the currently exported plate (by tag) in the XY plane @ z=0
  • joint possibility export: render only the joint possibilities for the currently exported plate

Format Specification

  • first (!) line of the main file identifies it as the main file with /* KYUB_MAIN_FILE */
  • the .scad files should be in the root folder because the maker-format-import-code expects it
  • variable to distinguish compilation phases: KYUB_PHASE with the following possible values
  • KYUB_PHASE_VISUALIZATION = 0;
  • KYUB_PHASE_DETECTION = 1;
  • KYUB_PHASE_EXTRACTION = 2;
  • KYUB_PHASE_COPLANAR_JOINT_EXTRACTION = 3;
  • material values
  • MATERIAL_THICKNESS: float
  • KERF: float
  • FIT: float
  • MATERIAL_TYPE: string: "wood"
  • anything prefixed with KYUB_ will be given as a parameter from the cli, e.g.
  • KYUB_TEST_VALUE="test"
  • openscad 1 = 1mm
  • the following functions can be used to rotate/translate/mark extensible areas or tag a module as engraving:
  • kyub_rotate
  • kyub_translate
  • kyub_extendable
  • kyub_engraving
  • use kyub_extendable to define borders as extendable`

The transformation functions output their operations in the order of application, that is the innermost transformation is echo'ed first.

Taken from wiki - please sort

Format (abstract)

  • have the variables at the top for the customizer
  • each plate must be
    • separately drawable
    • scalable
    • on the XY plane so it can be projected
    • vertically centered in the XY plane (Mittelmaß)
    • --> the transformations (rotation and translation) of each plane relative to the asset origin must be exposed to Kyub
      • Proposal: When the maker uses a module, he has to define the kyub_tag and can rotate the module with kyub_rotate and translate it with kyub_translate as often as he wants, and in any order. For example like this:
kyub_tag("ServoKneeOuterPlate")
    kyub_rotate([0, 0, rotation_angle])
        kyub_translate([0, 0, material_thickness_inner])
            ServoKneeOuterPlate(
                material_thickness = material_thickness_outer, 
                kerf = kerf, 
                fit = fit
            );

In the file kyub_transform3.scad we are able to chose one of the following phases:

  1. Visualize: KYUB_PHASE_VISUALIZATION
  2. Log all the tags of the modules: KYUB_PHASE_DETECTION
  3. Log each translation and rotation and render each part into a separate SVG file: KYUB_PHASE_EXTRACTION
KYUB_PHASE_VISUALIZATION = 0;
KYUB_PHASE_DETECTION = 1;
KYUB_PHASE_EXTRACTION = 2;

KYUB_PHASE = KYUB_PHASE_VISUALIZATION;
KYUB_CURRENT_TAG = "ServoKneeOuterPlate2";
  • we probably have to define variable names for kerf, material thickness, fit?, material type?
    • suggestion: use "SCREAMING_SNAKE_CASE"
  • library
    • finger joints?
  • coplanar joint possibilities (define library wrapper call?)
  • NEW define additional plates that should be cut, e.g. gears

Deferred into next OpenSCAD format versions

  • splitting of multi-assembly assets into multiple assemblies inside Kyub (requires already existing CrossAssemblyJoints; see general-issues#818)
  • finger joint possibilities (see existing EmbedJoint possibilities from in-plate SVG assets)
  • Engravings: could work by placing a special plane/cube into the OpenSCAD scene that is defined by (a) its size, (b) its position and rotation and (c) an explicit id/name that references an engraving image (JPG/PNG) stored in the same folder

Modules/Tasks

  • (OpenSCAD format)
  • Define one OpenSCAD file of the Servo Knee which we can work on
  • Q: Are curved joint possibilities required? (If not, we could start with the simple “echo” based approach of annotating joint possibilities)
  • maker-format-import extended to parse OpenSCAD files
  • Q: Which metadata/property fields do we need?
  • Q: Which metadata/property fields do not change when parameters such as material thickness change?
  • Has to produce one or multiple SVG cutting plans (and associate information about joints?)
  • Q: where will we produce the relative plate positioning
  • Has to produce one .obj or .stl 3D model
  • asset-db extended to provide OpenSCAD-based assets and to answer more complex API queries regarding parametrization of assets
  • Q: Should Kyub pass the surrounding plates to the asset-db or should the asset tell Kyub where plates should be placed/extended?