@rulecad/cad 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,113 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://jonibach.github.io/rulecad/schemas/assembly.schema.json",
4
+ "title": "rulecad assembly",
5
+ "description": "Objects placed together: a fit check (fits between them, joints and poses) or a plate (everything printed at once).",
6
+ "type": "object",
7
+ "required": ["items"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "$schema": { "type": "string" },
11
+ "title": { "type": "string" },
12
+ "description": { "type": "string" },
13
+ "note": { "type": "string" },
14
+ "kind": { "enum": ["fit", "plate"] },
15
+ "uses": { "type": "array", "items": { "type": "string" } },
16
+ "requires": { "type": "object", "additionalProperties": { "type": "string" }, "description": "object → semver range" },
17
+ "items": { "type": "array", "items": { "$ref": "#/$defs/item" } },
18
+ "fits": { "type": "array", "items": { "$ref": "#/$defs/fit" } },
19
+ "joints": { "type": "array", "items": { "$ref": "#/$defs/joint" } },
20
+ "loops": { "type": "array", "items": { "$ref": "#/$defs/loop" } },
21
+ "poses": { "type": "object", "additionalProperties": { "type": "object", "additionalProperties": { "$ref": "#/$defs/values" } } },
22
+ "pose": { "type": "string" }
23
+ },
24
+ "$defs": {
25
+ "expr": { "type": ["number", "string"] },
26
+ "vec3": { "type": "array", "minItems": 3, "maxItems": 3, "items": { "$ref": "#/$defs/expr" } },
27
+ "values": { "anyOf": [{ "$ref": "#/$defs/expr" }, { "type": "array", "items": { "$ref": "#/$defs/expr" } }] },
28
+ "names": { "anyOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }] },
29
+ "item": {
30
+ "type": "object",
31
+ "required": ["id"],
32
+ "additionalProperties": false,
33
+ "properties": {
34
+ "id": { "type": "string" },
35
+ "object": { "type": "string" },
36
+ "assembly": { "type": "string" },
37
+ "variant": { "type": "string" },
38
+ "set": { "type": "object" },
39
+ "at": { "$ref": "#/$defs/vec3" },
40
+ "rotate": { "$ref": "#/$defs/vec3" },
41
+ "place": {},
42
+ "from": {},
43
+ "repeat": {
44
+ "type": "object",
45
+ "additionalProperties": false,
46
+ "properties": {
47
+ "x": { "type": "object", "properties": { "count": { "$ref": "#/$defs/expr" }, "step": { "$ref": "#/$defs/expr" } } },
48
+ "y": { "type": "object", "properties": { "count": { "$ref": "#/$defs/expr" }, "step": { "$ref": "#/$defs/expr" } } },
49
+ "layout": { "type": "string" },
50
+ "step": { "$ref": "#/$defs/expr" },
51
+ "per": { "type": "object", "additionalProperties": { "type": "string" } },
52
+ "each": { "type": "object" },
53
+ "rows": {},
54
+ "width": { "type": "string" }
55
+ }
56
+ }
57
+ }
58
+ },
59
+ "fit": {
60
+ "type": "object",
61
+ "required": ["a", "b"],
62
+ "additionalProperties": false,
63
+ "properties": {
64
+ "a": { "$ref": "#/$defs/names" },
65
+ "b": { "$ref": "#/$defs/names" },
66
+ "min": { "$ref": "#/$defs/expr" },
67
+ "max": { "$ref": "#/$defs/expr" },
68
+ "note": { "type": "string" },
69
+ "label": { "type": "string" },
70
+ "poses": { "type": "array", "items": { "type": "string" } },
71
+ "holes": { "type": "boolean" },
72
+ "depth": { "$ref": "#/$defs/expr" },
73
+ "direction": { "enum": ["up", "down"] },
74
+ "ring": { "$ref": "#/$defs/expr" },
75
+ "into": { "type": "string" },
76
+ "within": { "$ref": "#/$defs/expr", "description": "With an anchor name (item@anchor): only faces this close to it (mm, default 10)" }
77
+ }
78
+ },
79
+ "anchorRef": {
80
+ "anyOf": [
81
+ { "type": "string", "description": "item.anchor" },
82
+ { "type": "object", "required": ["item"], "additionalProperties": false, "properties": { "item": { "type": "string" }, "at": { "$ref": "#/$defs/vec3" }, "axis": { "$ref": "#/$defs/vec3" }, "ref": { "$ref": "#/$defs/vec3" }, "rotate": { "$ref": "#/$defs/vec3" } } },
83
+ { "type": "object", "required": ["at"], "additionalProperties": false, "properties": { "at": { "$ref": "#/$defs/vec3" }, "axis": { "$ref": "#/$defs/vec3" }, "ref": { "$ref": "#/$defs/vec3" }, "rotate": { "$ref": "#/$defs/vec3" } } }
84
+ ]
85
+ },
86
+ "joint": {
87
+ "type": "object",
88
+ "required": ["id", "type", "parent", "child"],
89
+ "additionalProperties": false,
90
+ "properties": {
91
+ "id": { "type": "string" },
92
+ "label": { "type": "string" },
93
+ "type": { "enum": ["fixed", "revolute", "prismatic", "cylindrical", "ball", "path"] },
94
+ "parent": { "$ref": "#/$defs/anchorRef" },
95
+ "child": { "$ref": "#/$defs/anchorRef" },
96
+ "min": { "$ref": "#/$defs/values" },
97
+ "max": { "$ref": "#/$defs/values" },
98
+ "value": { "$ref": "#/$defs/values" },
99
+ "follow": { "type": "string" },
100
+ "ratio": { "$ref": "#/$defs/expr" },
101
+ "offset": { "$ref": "#/$defs/values" },
102
+ "path": { "type": "array", "items": { "$ref": "#/$defs/vec3" } },
103
+ "cone": { "$ref": "#/$defs/expr" }
104
+ }
105
+ },
106
+ "loop": {
107
+ "type": "object",
108
+ "required": ["a", "b"],
109
+ "additionalProperties": false,
110
+ "properties": { "a": { "$ref": "#/$defs/anchorRef" }, "b": { "$ref": "#/$defs/anchorRef" }, "label": { "type": "string" }, "note": { "type": "string" } }
111
+ }
112
+ }
113
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://jonibach.github.io/rulecad/schemas/layout.schema.json",
4
+ "title": "rulecad keyboard layout",
5
+ "description": "Where the keys go, and each key's own properties (width u, row, legend, …).",
6
+ "type": "object",
7
+ "required": ["rows"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "$schema": { "type": "string" },
11
+ "title": { "type": "string" },
12
+ "note": { "type": "string" },
13
+ "defaults": { "type": "object" },
14
+ "rows": {
15
+ "type": "array",
16
+ "items": {
17
+ "anyOf": [
18
+ { "type": "array", "items": { "$ref": "#/$defs/key" } },
19
+ { "type": "object", "required": ["keys"], "properties": { "keys": { "type": "array", "items": { "$ref": "#/$defs/key" } } } }
20
+ ]
21
+ }
22
+ }
23
+ },
24
+ "$defs": {
25
+ "key": {
26
+ "anyOf": [
27
+ { "type": "string" },
28
+ { "type": "array", "prefixItems": [{ "type": "string" }, { "type": "number" }], "minItems": 1, "maxItems": 2 },
29
+ { "type": "object", "properties": { "label": { "type": "string" }, "u": { "type": "number" }, "gap": { "type": "number" } } }
30
+ ]
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,76 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
4
+ "title": "rulecad object",
5
+ "description": "A design's description: its variables (each a value with the rule behind it), the rule sets it uses, its parts and how it prints. The shape is in the .js beside it.",
6
+ "type": "object",
7
+ "required": ["variables"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "$schema": { "type": "string" },
11
+ "name": { "type": "string", "description": "The object's name, as its file name" },
12
+ "title": { "type": "string" },
13
+ "version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+" },
14
+ "description": { "type": "string" },
15
+ "note": { "type": "string" },
16
+ "uses": { "type": "array", "items": { "type": "string" }, "description": "Rule sets (x1c, m3) and other objects (project/object, optionally @version)" },
17
+ "material": { "type": "string" },
18
+ "orientation": { "type": "string", "description": "How it sits on the bed, and anything the printer or the person assembling it should know" },
19
+ "role": { "enum": ["part", "reference", "board"], "description": "reference: drawn faint and never printed (a switch, a tablet); board: a circuit board" },
20
+ "engine": { "enum": ["jscad", "manifold", "pcb"], "description": "manifold: v.ops booleans by Manifold (npm install manifold-3d); pcb: a circuit board" },
21
+ "variables": { "type": "object", "additionalProperties": { "$ref": "#/$defs/variable" } },
22
+ "display": { "type": "object", "description": "Settings the mirror and model page use instead (lighter meshes, no legends)" },
23
+ "mirror": { "type": "object", "description": "The older name for display" },
24
+ "parts": { "type": "object", "additionalProperties": { "$ref": "#/$defs/part" } },
25
+ "variants": { "type": "object", "additionalProperties": { "type": "object" } },
26
+ "anchors": { "type": "object", "additionalProperties": { "$ref": "#/$defs/anchor" } },
27
+ "layouts": { "type": "object", "description": "Older designs kept layouts here; now in the project's layouts/" }
28
+ },
29
+ "$defs": {
30
+ "expr": { "type": ["number", "string"] },
31
+ "variable": {
32
+ "type": "object",
33
+ "required": ["value"],
34
+ "additionalProperties": false,
35
+ "properties": {
36
+ "value": { "description": "A number, an expression (x1c.line * 3), or for typed variables a name or text" },
37
+ "unit": { "type": "string" },
38
+ "rule": { "type": "string", "description": "Why the value is what it is" },
39
+ "label": { "type": "string" },
40
+ "show": { "type": "boolean" },
41
+ "interface": { "type": "boolean", "description": "Other objects depend on it: a change bumps the version accordingly" },
42
+ "tweak": { "type": "object", "required": ["min", "max"], "additionalProperties": false, "properties": { "min": { "$ref": "#/$defs/expr" }, "max": { "$ref": "#/$defs/expr" }, "step": { "type": "number" } } },
43
+ "type": { "enum": ["text", "anchor", "choice", "layout"] },
44
+ "choice": { "type": "array" },
45
+ "max": { "type": "number" },
46
+ "fields": { "type": "array", "items": { "type": "string" } },
47
+ "source": { "type": "string" },
48
+ "kind": { "type": "string" },
49
+ "checked": { "type": "string" }
50
+ }
51
+ },
52
+ "part": {
53
+ "type": "object",
54
+ "additionalProperties": false,
55
+ "properties": {
56
+ "label": { "type": "string" },
57
+ "role": { "enum": ["part", "support", "reference"] },
58
+ "filament": { "type": "string" },
59
+ "display": { "type": "boolean" },
60
+ "mirror": { "type": "boolean" },
61
+ "optional": { "type": "boolean" }
62
+ }
63
+ },
64
+ "anchor": {
65
+ "type": "object",
66
+ "required": ["at"],
67
+ "additionalProperties": false,
68
+ "properties": {
69
+ "at": { "type": "array", "minItems": 3, "maxItems": 3, "items": { "$ref": "#/$defs/expr" } },
70
+ "axis": { "type": "array", "minItems": 3, "maxItems": 3, "items": { "$ref": "#/$defs/expr" } },
71
+ "ref": { "type": "array", "minItems": 3, "maxItems": 3, "items": { "$ref": "#/$defs/expr" } },
72
+ "rotate": { "type": "array", "minItems": 3, "maxItems": 3, "items": { "$ref": "#/$defs/expr" } }
73
+ }
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://jonibach.github.io/rulecad/schemas/rules.schema.json",
4
+ "title": "rulecad rule set",
5
+ "description": "Shared facts (a printer, a screw size, a part's datasheet), each with where it comes from.",
6
+ "type": "object",
7
+ "required": ["rules"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "$schema": { "type": "string" },
11
+ "_doc": { "type": "string" },
12
+ "name": { "type": "string" },
13
+ "description": { "type": "string" },
14
+ "licence": { "type": "string" },
15
+ "private": { "type": "boolean" },
16
+ "footprints": { "type": "object" },
17
+ "rules": {
18
+ "type": "object",
19
+ "additionalProperties": {
20
+ "type": "object",
21
+ "required": ["value"],
22
+ "additionalProperties": false,
23
+ "properties": {
24
+ "value": { "type": ["number", "string"] },
25
+ "unit": { "type": "string" },
26
+ "rule": { "type": "string" },
27
+ "kind": { "type": "string", "description": "spec, standard, measured, community, estimate, …" },
28
+ "source": { "type": "string" },
29
+ "checked": { "type": "string" },
30
+ "pins": {}
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
2
3
  "name": "NAME",
3
4
  "title": "NAME",
4
5
  "version": "0.1.0",