Lots of docs tweaks for openscad-docsgen v2

This commit is contained in:
Revar Desmera 2021-12-13 15:48:30 -08:00
parent 4cb59d988e
commit 59bf523908
51 changed files with 150 additions and 197 deletions

View file

@ -1,4 +1,7 @@
DocsDirectory: BOSL2.wiki/
TargetProfile: githubwiki
ProjectName: The Belfry OpenScad Library, v2. (BOSL2)
GenerateDocs: Files, TOC, Index, Topics, CheatSheet
IgnoreFiles:
affine.scad
foo.scad
@ -8,43 +11,44 @@ IgnoreFiles:
tmp_*.scad
PrioritizeFiles:
transforms.scad
distributors.scad
mutators.scad
attachments.scad
drawing.scad
shapes2d.scad
shapes3d.scad
drawing.scad
masks2d.scad
masks3d.scad
math.scad
comparisons.scad
coords.scad
linalg.scad
lists.scad
vectors.scad
quaternions.scad
edges.scad
geometry.scad
trigonometry.scad
hull.scad
distributors.scad
partitions.scad
mutators.scad
paths.scad
regions.scad
vnf.scad
skin.scad
utility.scad
constants.scad
strings.scad
version.scad
beziers.scad
knurling.scad
partitions.scad
rounding.scad
threading.scad
skin.scad
turtle3d.scad
math.scad
linalg.scad
vectors.scad
quaternions.scad
coords.scad
geometry.scad
trigonometry.scad
constants.scad
version.scad
comparisons.scad
lists.scad
utility.scad
strings.scad
structs.scad
fnliterals.scad
threading.scad
screws.scad
metric_screws.scad
bottlecaps.scad
screw_drive.scad
DefineHeader(BulletList): Side Effects
DefineHeader(Table:Anchor Name|Position): Extra Anchors
DefineHeader(Table:Name|Definition): Terminology
DefineHeader(Table;Headers=Anchor Name|Position): Extra Anchors
DefineHeader(Table;Headers=Name|Definition): Terminology
DefineHeader(BulletList): Requirements

View file

@ -7,6 +7,9 @@
// are both written to support attachment. Also included in this file are the tools to make your own "attachable" objects.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Basic Modeling
// FileSummary: Positioning objects on or relative to other objects. Making your own objects support attachment.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/beziers.scad>
// FileGroup: Advanced Modeling
// FileSummary: Support for bezier curves and surfaces.
//////////////////////////////////////////////////////////////////////
// Terminology:

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/bottlecaps.scad>
// FileGroup: Threaded Parts
// FileSummary: Standard bottle caps and necks.
//////////////////////////////////////////////////////////////////////

View file

@ -3,6 +3,9 @@
// Functions for comparisons with lists, ordering and sorting
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Data Management
// FileSummary: Comparisons and sorting.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -3,6 +3,9 @@
// Coordinate transformations and coordinate system conversions.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Math
// FileSummary: Conversions between coordinate systems.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/cubetruss.scad>
// FileGroup: Parts
// FileSummary: Modular open-framed trusses and joiners.
//////////////////////////////////////////////////////////////////////////
$cubetruss_size = 30;

View file

@ -3,6 +3,9 @@
// Functions and modules to distribute children or copies of children.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Basic Modeling
// FileSummary: Shortcuts for translation, rotation, etc. Can act on geometry, paths, or can return a matrix.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -8,6 +8,9 @@
// and helix() produces helix paths.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Basic Modeling
// FileSummary: Attachable cubes, cylinders, spheres, ruler, and text. Many can produce a VNF.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -4,7 +4,9 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/fnliterals.scad>
// DefineHeader(Table:Positional|Definition||Named|Definition): FunctionLiteral Args
// FileGroup: Data Management
// FileSummary: Function Literal Algorithms, and factories for generating function literals for builtin functions.
// DefineHeader(Table;Headers=Positional|Definition||Named|Definition): FunctionLiteral Args
//////////////////////////////////////////////////////////////////////

View file

@ -6,6 +6,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/gears.scad>
// FileGroup: Parts
// FileSummary: Gears, racks, worms, and worm gears.
//////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -6,6 +6,9 @@
// a single endpoint or as segments, bounded by endpoints at both ends.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Math
// FileSummary: Line and plane intersections, circles from 3 points, etc.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/hingesnaps.scad>
// FileGroup: Parts
// FileSummary: Foldable, snap-locking parts.
//////////////////////////////////////////////////////////////////////
// Section: Hinges and Snaps

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/joiners.scad>
// FileGroup: Parts
// FileSummary: Joiner shapes for connecting separately printed objects.
//////////////////////////////////////////////////////////////////////

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/knurling.scad>
// FileGroup: Parts
// FileSummary: Masks and shapes to create knurling.
//////////////////////////////////////////////////////////////////////

View file

@ -5,6 +5,9 @@
// matrix inverse.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Math
// FileSummary: Linear Algebra: solve linear systems, construct and modify matrices.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////
// Section: Matrices

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/linear_bearings.scad>
// FileGroup: Parts
// FileSummary: Mounts for LMxUU style linear bearings.
//////////////////////////////////////////////////////////////////////

View file

@ -3,6 +3,9 @@
// Functions for constructing and manipulating generic lists.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Data Management
// FileSummary: Various list manipulation functions
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////
// Terminology:

View file

@ -6,6 +6,9 @@
// as geometry or as 2D paths.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Basic Modeling
// FileSummary: 2D masking shapes for edge profiling: including roundover, cove, teardrop, ogee.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -4,6 +4,9 @@
// edges in three dimensions.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Basic Modeling
// FileSummary: 3D masks for rounding edges and corners.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -3,6 +3,9 @@
// Math helper functions.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Math
// FileSummary: General miscellaneous math function.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////
// Section: Math Constants

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/metric_screws.scad>
// FileGroup: Threaded Parts
// FileSummary: Metric screws, nuts, and screwholes.
//////////////////////////////////////////////////////////////////////

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/modular_hose.scad>
// FileGroup: Parts
// FileSummary: Modular flexible hose parts.
//////////////////////////////////////////////////////////////////////////
// Section: Modular Hose Parts

View file

@ -3,6 +3,9 @@
// Functions and modules to mutate children in various ways.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Basic Modeling
// FileSummary: Modules and Functions to mutate items.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/nema_steppers.scad>
// FileGroup: Parts
// FileSummary: Mounting holes for NEMA motors, and simple motor models.
//////////////////////////////////////////////////////////////////////

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/partitions.scad>
// FileGroup: Advanced Modeling
// FileSummary: Modules to help partition large objects into smaller assembled parts.
//////////////////////////////////////////////////////////////////////

View file

@ -9,6 +9,9 @@
// path tangents and normals, resampling of paths, and cutting paths up into smaller paths.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Advanced Modeling
// FileSummary: Work with arbitrary 2D or 3D paths.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////
// Section: Utility Functions

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/polyhedra.scad>
// FileGroup: Parts
// FileSummary: Platonic, Archimidean, Catalan, and stellated polyhedra.
//////////////////////////////////////////////////////////////////////

View file

@ -3,6 +3,9 @@
// Support for Quaternions.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Math
// FileSummary: Quaternion based rotations that avoid gimbal lock issues.
// FileFootnotes: STD=Included in std.scad
///////////////////////////////////////////

View file

@ -8,6 +8,9 @@
// region and you can decompose a region into parts.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Advanced Modeling
// FileSummary: Offsets and boolean geometry of 2D paths and regions.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -5,6 +5,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/rounding.scad>
// FileGroup: Advanced Modeling
// FileSummary: Round path corners, rounded prisms, rounded cutouts in tubes.
//////////////////////////////////////////////////////////////////////
include <beziers.scad>
include <structs.scad>

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/screw_drive.scad>
// FileGroup: Threaded Parts
// FileSummary: Masks for Phillips/Torx/etc driver holes.
//////////////////////////////////////////////////////////////////////

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/screws.scad>
// FileGroup: Threaded Parts
// FileSummary: ISO (metric) and UTS screws and nuts.
//////////////////////////////////////////////////////////////////////
include <structs.scad>

View file

@ -1,39 +0,0 @@
#!/bin/bash
DISPMD=0
GEN_ARGS=()
FILES=()
for opt in "$@" ; do
case "$opt" in
-f ) GEN_ARGS+=(-f) ;;
-d ) DISPMD=1 ;;
-* ) echo "Unknown option $opt" >&2; exit 1 ;;
* ) FILES+=("$opt") ;;
esac
done
if (( ${#FILES[@]} == 0 )); then
FILES=(Shapes2d Shapes3d Transforms Distributors Mutators Attachments Paths FractalTree)
fi
# Try to cd to the BOSL2.wiki directory if run from the BOSL2 root
if [[ "$(basename "$PWD")" != "BOSL2.wiki" ]]; then
if ! cd BOSL2.wiki; then
echo "BOSL2.wiki directory not found, try running from the BOSL2 or BOSL2/BOSL2.wiki directory" >&2
exit 1
fi
fi
rm -f tmp_*.scad
for base in "${FILES[@]}"; do
base="$(basename "$base" .md)"
mkdir -p images/tutorials
rm -f "images/tutorials/${base}"_*.png "images/tutorials/${base}"_*.gif
echo "${base}.md"
../scripts/tutorial_gen.py "../tutorials/${base}.md" -o "Tutorial-${base}.md" "${GEN_ARGS[@]}" -I images/tutorials/ || exit 1
if (( DISPMD )); then
open -a Typora "Tutorial-${base}.md"
fi
done

View file

@ -1,133 +0,0 @@
#!/usr/bin/env python3
from __future__ import print_function
import os
import sys
import os.path
import argparse
from openscad_docsgen.imagemanager import ImageManager
imgmgr = ImageManager()
def img_started(req):
print(" {}... ".format(os.path.basename(req.image_file)), end='')
sys.stdout.flush()
def img_completed(req):
if req.success:
if req.status == "SKIP":
print()
else:
print(req.status)
sys.stdout.flush()
return
out = "\n\n"
for line in req.echos:
out += line + "\n"
for line in req.warnings:
out += line + "\n"
for line in req.errors:
out += line + "\n"
out += "//////////////////////////////////////////////////////////////////////\n"
out += "// LibFile: {} Line: {} Image: {}\n".format(
req.src_file, req.src_line, os.path.basename(req.image_file)
)
out += "//////////////////////////////////////////////////////////////////////\n"
for line in req.script_lines:
out += line + "\n"
out += "//////////////////////////////////////////////////////////////////////\n"
print(out, file=sys.stderr)
sys.exit(-1)
def processFile(infile, outfile=None, imgroot=""):
if imgroot and not imgroot.endswith('/'):
imgroot += "/"
fileroot = os.path.splitext(os.path.basename(infile))[0]
outdata = []
with open(infile, "r") as f:
script = ["include <BOSL2/std.scad>"]
extyp = ""
in_script = False
imgnum = 0
show_script = True
linenum = -1
for line in f.readlines():
linenum += 1
line = line.rstrip("\n")
if line.startswith("```openscad"):
in_script = True;
if "-" in line:
extyp = line.split("-")[1]
else:
extyp = ""
show_script = "ImgOnly" not in extyp
script = ["include <BOSL2/std.scad>"]
imgnum = imgnum + 1
elif in_script:
if line == "```":
in_script = False
fext = "png"
if any(x in extyp for x in ("Anim", "Spin")):
fext = "gif"
imgfile = os.path.join(imgroot, "{}_{}.{}".format(fileroot, imgnum, fext))
imgmgr.new_request(
fileroot+".md", linenum,
imgfile, script, extyp,
starting_cb=img_started,
completion_cb=img_completed
)
if show_script:
outdata.append("```openscad")
outdata.extend(script)
outdata.append("```")
outdata.append("![Figure {}]({})".format(imgnum, imgfile))
show_script = True
extyp = ""
else:
script.append(line)
else:
outdata.append(line)
if outfile == None:
f = sys.stdout
else:
f = open(outfile, "w")
for line in outdata:
print(line, file=f)
if outfile:
f.close()
def main():
parser = argparse.ArgumentParser(prog='docs_gen')
parser.add_argument('-I', '--imgroot', default="",
help='The directory to put generated images in.')
parser.add_argument('-o', '--outfile',
help='Output file, if different from infile.')
parser.add_argument('infile', help='Input filename.')
args = parser.parse_args()
processFile(
args.infile,
outfile=args.outfile,
imgroot=args.imgroot
)
imgmgr.process_requests()
sys.exit(0)
if __name__ == "__main__":
main()
# vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap

View file

@ -10,6 +10,9 @@
// function forms that produce a path.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Basic Modeling
// FileSummary: Attachable circles, squares, polygons, teardrop. Can make geometry or paths.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////
use <builtins.scad>

View file

@ -7,6 +7,9 @@
// so you can place it on a curved object.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Basic Modeling
// FileSummary: Attachable cubes, cylinders, spheres, ruler, and text. Many can produce a VNF.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////
use <builtins.scad>

View file

@ -9,6 +9,9 @@
// - https://github.com/openscad/list-comprehension-demos/blob/master/skin.scad
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Advanced Modeling
// FileSummary: Construct 3D shapes from a 2D cross sections of the desired shape.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/sliders.scad>
// FileGroup: Parts
// FileSummary: Simple sliders and rails.
//////////////////////////////////////////////////////////////////////

View file

@ -3,6 +3,9 @@
// String manipulation and formatting functions.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Data Management
// FileSummary: String manipulation functions.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/structs.scad>
// FileGroup: Data Management
// FileSummary: Structure/Dictionary Manipulation
//////////////////////////////////////////////////////////////////////

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/threading.scad>
// FileGroup: Threaded Parts
// FileSummary: Various types of threaded rods and nuts.
//////////////////////////////////////////////////////////////////////

View file

@ -15,6 +15,9 @@
// operate on. The exceptions are rot(), frame_map() and skew().
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Basic Modeling
// FileSummary: Shortcuts for translation, rotation, etc. Can act on geometry, paths, or can return a matrix.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -4,6 +4,9 @@
// all the function relations, or silly acronyms like SOHCAHTOA.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Math
// FileSummary: Trigonometry shortcuts for when you can't recall the mnemonic SOHCAHTOA.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -5,6 +5,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/turtle3d.scad>
// FileGroup: Advanced Modeling
// FileSummary: 3D turtle graphics for making paths or lists of transformations.
//////////////////////////////////////////////////////////////////////
include<structs.scad>

View file

@ -3,6 +3,9 @@
// Utility functions used in argument processing.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Data Management
// FileSummary: Helpers for argument processing.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -3,6 +3,9 @@
// Vector math functions.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Math
// FileSummary: Vector math functions.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -3,6 +3,9 @@
// File that provides functions to manage versioning.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Data Management
// FileSummary: Parse and compare semantic versions.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -6,6 +6,9 @@
// reversed faces.
// Includes:
// include <BOSL2/std.scad>
// FileGroup: Advanced Modeling
// FileSummary: Vertices 'n' Faces structure. Makes polyhedron() easier to use.
// FileFootnotes: STD=Included in std.scad
//////////////////////////////////////////////////////////////////////

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/walls.scad>
// FileGroup: Parts
// FileSummary: Walls and structural elements that 3D print without support.
//////////////////////////////////////////////////////////////////////

View file

@ -4,6 +4,8 @@
// Includes:
// include <BOSL2/std.scad>
// include <BOSL2/wiring.scad>
// FileGroup: Parts
// FileSummary: Routed bundles of wires.
//////////////////////////////////////////////////////////////////////