mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 16:29:40 +00:00
Tweaked doce generation.
This commit is contained in:
parent
e946031d99
commit
4efb109863
3 changed files with 27 additions and 20 deletions
|
@ -56,19 +56,19 @@ TOP = [ 0, 0, 1];
|
|||
// Constant: ALLPOS
|
||||
// Description: Vector pointing right, back, and up. [1,1,1]
|
||||
// Example(3D): Usage with `anchor`
|
||||
// cuboid(20, anchor=ALLPOS);
|
||||
// cuboid(20, anchor=ALLPOS);
|
||||
ALLPOS = [ 1, 1, 1]; // Vector pointing X+,Y+,Z+.
|
||||
|
||||
// Constant: ALLNEG
|
||||
// Description: Vector pointing left, forwards, and down. [-1,-1,-1]
|
||||
// Example(3D): Usage with `anchor`
|
||||
// cuboid(20, anchor=ALLNEG);
|
||||
// cuboid(20, anchor=ALLNEG);
|
||||
ALLNEG = [-1, -1, -1]; // Vector pointing X-,Y-,Z-.
|
||||
|
||||
// Constant: CENTER
|
||||
// Description: Zero vector. Centered. [0,0,0]
|
||||
// Example(3D): Usage with `anchor`
|
||||
// cuboid(20, anchor=CENTER);
|
||||
// cuboid(20, anchor=CENTER);
|
||||
CENTER = [ 0, 0, 0]; // Centered zero vector.
|
||||
|
||||
|
||||
|
|
30
edges.scad
30
edges.scad
|
@ -29,18 +29,18 @@ function is_edge_array(v) = is_list(v) && is_vector(v[0]) && len(v)==3 && len(v[
|
|||
// Usage:
|
||||
// edge(v);
|
||||
// Description:
|
||||
// Takes an edge set descriptor and returns the EDGE array representing those edges.
|
||||
// Takes an edge set descriptor and returns the edges array representing those edges.
|
||||
// This function is useful for modules that take `edges` arguments, like `cuboid()`.
|
||||
// An edge set descriptor can be any of:
|
||||
// - A raw EDGE array.
|
||||
// - A raw edges array.
|
||||
// - A vector pointing towards an edge, indicating just that edge.
|
||||
// - A vector pointing towards a face, indicating all edges surrounding that face.
|
||||
// - A vector pointing towards a corner, indicating all edges that meet at that corner.
|
||||
// - The string "X", indicating all X axis aligned edges.
|
||||
// - The string "Y", indicating all Y axis aligned edges.
|
||||
// - The string "Z", indicating all Y axis aligned edges.
|
||||
// - The string "ALL", indicating all edges.
|
||||
// - The string "NONE", indicating no edges at all.
|
||||
// - The string `"X"`, indicating all X axis aligned edges.
|
||||
// - The string `"Y"`, indicating all Y axis aligned edges.
|
||||
// - The string `"Z"`, indicating all Y axis aligned edges.
|
||||
// - The string `"ALL"`, indicating all edges.
|
||||
// - The string `"NONE"`, indicating no edges at all.
|
||||
function edge_set(v) =
|
||||
is_edge_array(v)? v : [
|
||||
for (ax=[0:2]) [
|
||||
|
@ -87,21 +87,21 @@ function normalize_edges(v) = [for (ax=v) [for (edge=ax) edge>0? 1 : 0]];
|
|||
// edges(v)
|
||||
// edges(v, except)
|
||||
// Description:
|
||||
// Takes a list of edge set descriptors, and returns a normalized EDGE array
|
||||
// Takes a list of edge set descriptors, and returns a normalized edges array
|
||||
// that represents all those given edges. If the `except` argument is given
|
||||
// a list of edge set descriptors, then all those edges will be removed
|
||||
// from the returned EDGE array. If either argument only has a single edge
|
||||
// from the returned edges array. If either argument only has a single edge
|
||||
// set descriptor, you do not have to pass it in a list.
|
||||
// Each edge set descriptor can be any of:
|
||||
// - A raw EDGE array.
|
||||
// - A raw edges array.
|
||||
// - A vector pointing towards an edge.
|
||||
// - A vector pointing towards a face, indicating all edges surrounding that face.
|
||||
// - A vector pointing towards a corner, indicating all edges touching that corner.
|
||||
// - The string "X", indicating all X axis aligned edges.
|
||||
// - The string "Y", indicating all Y axis aligned edges.
|
||||
// - The string "Z", indicating all Y axis aligned edges.
|
||||
// - The string "ALL", indicating all edges.
|
||||
// - The string "NONE", indicating no edges at all.
|
||||
// - The string `"X"`, indicating all X axis aligned edges.
|
||||
// - The string `"Y"`, indicating all Y axis aligned edges.
|
||||
// - The string `"Z"`, indicating all Y axis aligned edges.
|
||||
// - The string `"ALL"`, indicating all edges.
|
||||
// - The string `"NONE"`, indicating no edges at all.
|
||||
// Example: Just the front-top edge
|
||||
// edges(FRONT+TOP)
|
||||
// Example: All edges surrounding either the front or top faces
|
||||
|
|
|
@ -52,10 +52,17 @@ def mkdn_esc(txt):
|
|||
def get_comment_block(lines, prefix, blanks=1):
|
||||
out = []
|
||||
blankcnt = 0
|
||||
indent = 0
|
||||
while lines:
|
||||
if not lines[0].startswith(prefix + " "):
|
||||
if not lines[0].startswith(prefix+" "):
|
||||
break
|
||||
line = lines.pop(0)[len(prefix)+1:]
|
||||
line = lines.pop(0)[len(prefix):]
|
||||
if not indent:
|
||||
while line.startswith(" "):
|
||||
line = line[1:]
|
||||
indent += 1
|
||||
else:
|
||||
line = line[indent:]
|
||||
if line == "":
|
||||
blankcnt += 1
|
||||
if blankcnt >= blanks:
|
||||
|
|
Loading…
Reference in a new issue