@machineblocks/render-target 0.0.0-stage → 0.1.1

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.
Files changed (89) hide show
  1. package/blocks/com/machineblocks/bml/target/render/Library.bml +55 -0
  2. package/blocks/com/machineblocks/bml/target/render/README.bml +37 -0
  3. package/blocks/com/machineblocks/bml/target/render/documentation/AssemblyPatterns.bml +47 -0
  4. package/blocks/com/machineblocks/bml/target/render/documentation/CompositeRendering.bml +60 -0
  5. package/blocks/com/machineblocks/bml/target/render/documentation/Customizer.bml +62 -0
  6. package/blocks/com/machineblocks/bml/target/render/documentation/DomainBoundary.bml +43 -0
  7. package/blocks/com/machineblocks/bml/target/render/documentation/ExpressionRenderer.bml +58 -0
  8. package/blocks/com/machineblocks/bml/target/render/documentation/FileStructure.bml +42 -0
  9. package/blocks/com/machineblocks/bml/target/render/documentation/FqnNaming.bml +85 -0
  10. package/blocks/com/machineblocks/bml/target/render/documentation/HelperFunctions.bml +57 -0
  11. package/blocks/com/machineblocks/bml/target/render/documentation/Imports.bml +49 -0
  12. package/blocks/com/machineblocks/bml/target/render/documentation/Introduction.bml +43 -0
  13. package/blocks/com/machineblocks/bml/target/render/documentation/LeafOptimization.bml +44 -0
  14. package/blocks/com/machineblocks/bml/target/render/documentation/NativeMappings.bml +58 -0
  15. package/blocks/com/machineblocks/bml/target/render/documentation/Presets.bml +50 -0
  16. package/blocks/com/machineblocks/bml/target/render/documentation/PropertyRenderer.bml +50 -0
  17. package/blocks/com/machineblocks/bml/target/render/documentation/RendererPipeline.bml +51 -0
  18. package/blocks/com/machineblocks/bml/target/render/documentation/SerializationRules.bml +84 -0
  19. package/blocks/com/machineblocks/bml/target/render/documentation/SetRendering.bml +77 -0
  20. package/blocks/com/machineblocks/bml/target/render/documentation/SettingsFormat.bml +80 -0
  21. package/blocks/com/machineblocks/bml/target/render/documentation/SourceMaps.bml +33 -0
  22. package/blocks/com/machineblocks/bml/target/render/documentation/TargetRegistration.bml +61 -0
  23. package/blocks/com/machineblocks/bml/target/render/documentation/V1Scope.bml +44 -0
  24. package/dist/composite.d.ts +8 -0
  25. package/dist/composite.d.ts.map +1 -0
  26. package/dist/composite.js +232 -0
  27. package/dist/composite.js.map +1 -0
  28. package/dist/composition.d.ts +6 -0
  29. package/dist/composition.d.ts.map +1 -0
  30. package/dist/composition.js +40 -0
  31. package/dist/composition.js.map +1 -0
  32. package/dist/diagnostics.d.ts +22 -0
  33. package/dist/diagnostics.d.ts.map +1 -0
  34. package/dist/diagnostics.js +29 -0
  35. package/dist/diagnostics.js.map +1 -0
  36. package/dist/dispatch.d.ts +13 -0
  37. package/dist/dispatch.d.ts.map +1 -0
  38. package/dist/dispatch.js +46 -0
  39. package/dist/dispatch.js.map +1 -0
  40. package/dist/index.d.ts +10 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +8 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/leaf.d.ts +4 -0
  45. package/dist/leaf.d.ts.map +1 -0
  46. package/dist/leaf.js +92 -0
  47. package/dist/leaf.js.map +1 -0
  48. package/dist/machineblocks-render-target.d.ts +14 -0
  49. package/dist/machineblocks-render-target.d.ts.map +1 -0
  50. package/dist/machineblocks-render-target.js +63 -0
  51. package/dist/machineblocks-render-target.js.map +1 -0
  52. package/dist/naming.d.ts +29 -0
  53. package/dist/naming.d.ts.map +1 -0
  54. package/dist/naming.js +120 -0
  55. package/dist/naming.js.map +1 -0
  56. package/dist/options.d.ts +8 -0
  57. package/dist/options.d.ts.map +1 -0
  58. package/dist/options.js +26 -0
  59. package/dist/options.js.map +1 -0
  60. package/dist/paths.d.ts +6 -0
  61. package/dist/paths.d.ts.map +1 -0
  62. package/dist/paths.js +55 -0
  63. package/dist/paths.js.map +1 -0
  64. package/dist/presets.d.ts +6 -0
  65. package/dist/presets.d.ts.map +1 -0
  66. package/dist/presets.js +105 -0
  67. package/dist/presets.js.map +1 -0
  68. package/dist/processors.d.ts +24 -0
  69. package/dist/processors.d.ts.map +1 -0
  70. package/dist/processors.js +72 -0
  71. package/dist/processors.js.map +1 -0
  72. package/dist/serialize.d.ts +7 -0
  73. package/dist/serialize.d.ts.map +1 -0
  74. package/dist/serialize.js +42 -0
  75. package/dist/serialize.js.map +1 -0
  76. package/dist/set-file.d.ts +5 -0
  77. package/dist/set-file.d.ts.map +1 -0
  78. package/dist/set-file.js +199 -0
  79. package/dist/set-file.js.map +1 -0
  80. package/dist/source-map.d.ts +13 -0
  81. package/dist/source-map.d.ts.map +1 -0
  82. package/dist/source-map.js +41 -0
  83. package/dist/source-map.js.map +1 -0
  84. package/dist/version.d.ts +8 -0
  85. package/dist/version.d.ts.map +1 -0
  86. package/dist/version.js +8 -0
  87. package/dist/version.js.map +1 -0
  88. package/package.json +41 -4
  89. package/README.md +0 -3
@@ -0,0 +1,55 @@
1
+ <!--MachineBlocks Render Target Library
2
+ FQN: com.machineblocks.bml.target.render.Library-->
3
+ <render:Library xmlns="http://blockml.org/bml"
4
+ xmlns:blockml="org.blockml.bml"
5
+ xmlns:core="org.blockml.bml.core"
6
+ xmlns:mb="com.machineblocks.bml"
7
+ xmlns:engine="org.blockml.bml.engine.blockrender"
8
+ xmlns:render="com.machineblocks.bml.target.render">
9
+
10
+ <baseType>
11
+ core:BlockLibrary
12
+ </baseType>
13
+ <is>
14
+ The MachineBlocks SCAD render target library catalog
15
+ </is>
16
+ <version>
17
+ 0.1.1
18
+ </version>
19
+ <documentation>
20
+ Publishable compiler-target library (com.machineblocks.bml.target.render.Library).
21
+ Registry name machineblocks-v3-scad. npm package @machineblocks/render-target.
22
+ Serializes MBOM blocks into MachineBlocks V3 OpenSCAD compatible with
23
+ @machineblocks/core.
24
+
25
+ Formerly @machineblocks/machineblocks-v3-scad-target. Registry name unchanged.
26
+ Engine dependency is @blockml/block-render-engine (formerly MakerEngine).
27
+
28
+ Membership is the file tree under this Library.bml.
29
+ </documentation>
30
+ <references>
31
+ <see type="render:README" relation="ReadFirst" />
32
+ </references>
33
+ <language>
34
+ <blockml:language.English />
35
+ </language>
36
+ <properties>
37
+ <description override="true">
38
+ <value>MachineBlocks BML to SCAD render target</value>
39
+ </description>
40
+ </properties>
41
+ <aggregations>
42
+ <readMe override="true">
43
+ <composition>
44
+ <render:README />
45
+ </composition>
46
+ </readMe>
47
+ <dependencies override="true">
48
+ <composition>
49
+ <blockml:Library />
50
+ <mb:Library />
51
+ <engine:Library />
52
+ </composition>
53
+ </dependencies>
54
+ </aggregations>
55
+ </render:Library>
@@ -0,0 +1,37 @@
1
+ <!--MachineBlocks Render Target — README
2
+ FQN: com.machineblocks.bml.target.render.README-->
3
+ <render:README xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:render="com.machineblocks.bml.target.render"
6
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation"
7
+ xmlns:scad="com.machineblocks.bml.documentation.scad">
8
+
9
+ <baseType>
10
+ core:ReadMe
11
+ </baseType>
12
+ <is>
13
+ Reading entry for the MachineBlocks SCAD render target library
14
+ </is>
15
+ <documentation>
16
+ @machineblocks/render-target compiles MachineBlocks BML to .scad files the
17
+ V3 library in @machineblocks/core can render. Registry name:
18
+ machineblocks-v3-scad.
19
+
20
+ This library is the SSOT for target registration, the two V1 processors,
21
+ FQN-to-module naming, imports, settings emission, assembly patterns, sets,
22
+ the customizer, source maps, and MBOM-to-SCAD serialization. Type shapes and
23
+ the mb_block runtime stay in @machineblocks/core.
24
+
25
+ The target calls @blockml/block-render-engine (compile strategy for both
26
+ V1 processors). It is browser and Node compatible.
27
+
28
+ Start at com.machineblocks.bml.target.render.documentation.Introduction.
29
+ For the runtime API, also read
30
+ com.machineblocks.bml.documentation.scad.ScadRenderTarget in @machineblocks/core.
31
+ </documentation>
32
+ <references>
33
+ <see type="rdoc:Introduction" relation="ReadFirst" />
34
+ <see type="scad:ScadRenderTarget" relation="SeeAlso" />
35
+ <see type="rdoc:V1Scope" relation="SeeAlso" />
36
+ </references>
37
+ </render:README>
@@ -0,0 +1,47 @@
1
+ <!--Render Target Documentation — AssemblyPatterns
2
+ FQN: com.machineblocks.bml.target.render.documentation.AssemblyPatterns-->
3
+ <rdoc:AssemblyPatterns xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ Semantic MBOM values to SCAD assembly helper calls
12
+ </is>
13
+ <documentation>
14
+ Assembly patterns exist in SCAD and have no BML equivalent. The renderer
15
+ inserts them from the semantic MBOM value and the composition structure.
16
+ The mapping table is declarative and configurable, not hardcoded in
17
+ processor control flow.
18
+
19
+ MBOM semantic value to SCAD output:
20
+
21
+ - baseCutoutType = "groove" on a top part
22
+ -> mb_assembly_groove(assembly, renderGroups, group_top)
23
+ - tongue = true on a bottom part
24
+ -> mb_assembly_tongue(assembly, renderGroups, group_bottom)
25
+ - offset on an assembly-dependent part
26
+ -> mb_assembly_offset([x, y, z], assembly, renderGroups, group_top)
27
+ - render per part
28
+ -> mb_group_render(renderGroups, group_bottom)
29
+ - id per part
30
+ -> mb_block_id(blockId, part_bottom)
31
+ - baseAdjustment, namespace-filtered
32
+ -> mb_params_filter(baseAdjustment, ns_bottom)
33
+
34
+ For each composition child the renderer emits part variables inside the
35
+ wrapper children block:
36
+
37
+ part_bottom = "bottom";
38
+ group_bottom = part_bottom;
39
+ ns_bottom = part_bottom;
40
+
41
+ The part name is the composition child id.
42
+
43
+ </documentation>
44
+ <references>
45
+ <see type="rdoc:LeafOptimization" relation="ReadNext" />
46
+ </references>
47
+ </rdoc:AssemblyPatterns>
@@ -0,0 +1,60 @@
1
+ <!--Render Target Documentation — CompositeRendering
2
+ FQN: com.machineblocks.bml.target.render.documentation.CompositeRendering-->
3
+ <rdoc:CompositeRendering xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ Wrapper mb_block and nested children
12
+ </is>
13
+ <documentation>
14
+ A composite block (non-empty composition) is a wrapper mb_block() with
15
+ nested child calls, inside a typed module named by FqnNaming.
16
+
17
+ Module body order:
18
+
19
+ 1. Native parameters via mb_param_* getters.
20
+ 2. Custom parameters via mb_param.
21
+ 3. assembly = mb_assembly(config, settings, size, direction)
22
+ and renderGroups = mb_param_renderGroups(config, settings).
23
+ 4. Wrapper mb_block with id, base false, studs false, size, align, offset,
24
+ direction.
25
+ 5. One child region per composition child: part_/group_/ns_ locals, then
26
+ mb_block with id mb_block_id(...), render mb_group_render(...), size
27
+ expression, and assembly helpers from AssemblyPatterns.
28
+
29
+ Wrapper decision:
30
+
31
+ - 0 children and custom processor logic — that logic renders; no wrapper.
32
+ - 0 children and no custom processor — diagnostic MB_EMPTY_BLOCK.
33
+ - exactly 1 child — no wrapper; the child is rendered directly.
34
+ - 2 or more children — automatic wrapper. Children render inside it.
35
+
36
+ The wrapper always sets base false and studs false, ignoring the block's
37
+ own base and studs. The wrapper is a layout container. Geometry is the
38
+ children. The block's base and studs are passed to the NativeBlock children.
39
+
40
+ Cross.studs = true
41
+ wrapper: studs false (processor)
42
+ children: studs true (block property)
43
+
44
+ Composite blocks do not need to declare base false or studs false for the
45
+ wrapper. Those properties keep their meaning for the children.
46
+
47
+ The automatic wrapper is only the outermost container, once per processor
48
+ invocation. Nested blocks in the composition are real instances, not extra
49
+ wrappers.
50
+
51
+ Illustrative child settings (top part) include offset via
52
+ mb_assembly_offset and baseCutoutType via mb_assembly_groove. Bottom parts
53
+ include tongue via mb_assembly_tongue. Both forward baseAdjustment through
54
+ mb_params_filter with that part's namespace.
55
+
56
+ </documentation>
57
+ <references>
58
+ <see type="rdoc:SetRendering" relation="ReadNext" />
59
+ </references>
60
+ </rdoc:CompositeRendering>
@@ -0,0 +1,62 @@
1
+ <!--Render Target Documentation — Customizer
2
+ FQN: com.machineblocks.bml.target.render.documentation.Customizer-->
3
+ <rdoc:Customizer xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ OpenSCAD customizer section
12
+ </is>
13
+ <documentation>
14
+ The customizer generator writes the OpenSCAD customizer section for block
15
+ and set files.
16
+
17
+ For each exposed property:
18
+
19
+ - Variable declaration with default value
20
+ - Inline comment with customizer dropdown syntax where it applies
21
+ - Group comment /* [Group Name] */ for property groups
22
+
23
+ The hidden section /* [Hidden] */ holds derived variables that combine
24
+ customizer inputs before they are passed to the module. Internal module
25
+ computations are never placed in the hidden section.
26
+
27
+ OpenSCAD customizer supports only flat primitives. The processor splits
28
+ complex properties into several customizer variables and recombines them in
29
+ [Hidden]. Splitting follows NativeBlock type metadata and annotations.
30
+
31
+ split [x, y, z] — a vector becomes named scalars:
32
+
33
+ baseRoundingRadiusX = 0.5; // [0:0.1:2]
34
+ baseRoundingRadiusY = 0.5;
35
+ baseRoundingRadiusZ = 0.5;
36
+ /* [Hidden] */
37
+ baseRoundingRadius = [baseRoundingRadiusX, baseRoundingRadiusY, baseRoundingRadiusZ];
38
+
39
+ auto_toggle true — a NoneOr value becomes a boolean plus a value:
40
+
41
+ recessDepthAuto = true;
42
+ recessDepth = 0.5;
43
+ /* [Hidden] */
44
+ recessDepthResolved = recessDepthAuto ? "auto" : recessDepth;
45
+
46
+ suggestions — a dropdown comment from the property suggestions. Each
47
+ suggestion instance is serialized to its SCAD literal:
48
+
49
+ textColor = "#303D4E"; // [#303D4E, #EAC645, #58B99D]
50
+
51
+ Optional labels may come from documentation on the suggestion instances.
52
+
53
+ constraints — Min and Max map to customizer range metadata
54
+ [min:step:max] when both bounds exist. See the BlockML constraints
55
+ documentation for the constraint instances. Individual constraints may also
56
+ inform editor range hints.
57
+
58
+ </documentation>
59
+ <references>
60
+ <see type="rdoc:Presets" relation="ReadNext" />
61
+ </references>
62
+ </rdoc:Customizer>
@@ -0,0 +1,43 @@
1
+ <!--Render Target Documentation — DomainBoundary
2
+ FQN: com.machineblocks.bml.target.render.documentation.DomainBoundary-->
3
+ <rdoc:DomainBoundary xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ What this target reads from @machineblocks/core
12
+ </is>
13
+ <documentation>
14
+ This package depends on @machineblocks/core and does not copy its blocks.
15
+
16
+ Read there:
17
+
18
+ - com.machineblocks.bml.documentation.scad.ScadRenderTarget — orientation
19
+ - com.machineblocks.bml.documentation.scad.MbBlockApi — mb_block signature
20
+ - com.machineblocks.bml.documentation.scad.BlockFileStructure — file sections
21
+ as the library presents them
22
+ - com.machineblocks.bml.documentation.scad.TypesAndSerialization — short
23
+ serialization sketch; SerializationRules in this library is the compiler
24
+ emit contract when the two differ, and type BML wins for shapes
25
+ - com.machineblocks.bml.documentation.scad.ModulePatterns
26
+ - com.machineblocks.bml.documentation.scad.ScadDecisionRules
27
+ - com.machineblocks.bml.core.NativeBlock — parameter inventory
28
+ - com.machineblocks.bml.type.* — type shapes
29
+ - com.machineblocks.bml.examples.* — example BML
30
+ - blocks/com/machineblocks/scad/** — corresponding SCAD, including
31
+ examples/Cross.scad and examples/Connector.scad
32
+ - lib/block.scad and config/mb_config.scad — runtime imports
33
+
34
+ Do not move those files into this package. When an example .scad and this
35
+ target's emit rules diverge, the BML example plus this library are the
36
+ intended compiler output; hand-maintained SCAD may still show the older
37
+ wrapper style that LeafOptimization removes.
38
+
39
+ </documentation>
40
+ <references>
41
+ <see type="rdoc:Introduction" relation="SeeAlso" />
42
+ </references>
43
+ </rdoc:DomainBoundary>
@@ -0,0 +1,58 @@
1
+ <!--Render Target Documentation — ExpressionRenderer
2
+ FQN: com.machineblocks.bml.target.render.documentation.ExpressionRenderer-->
3
+ <rdoc:ExpressionRenderer xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ Expression values to SCAD expressions
12
+ </is>
13
+ <documentation>
14
+ Canonical BOM stores expressions as ExpressionValue { raw }. The expression
15
+ renderer obtains a typed AST via parseExpression() (a working-model utility,
16
+ not a canonical BOM field) and serializes it to SCAD.
17
+
18
+ Static: if the expression has no runtime-dependent roots, emit the resolved
19
+ value. ${ [1, 1, 1] } becomes [1, 1, 1].
20
+
21
+ Dynamic: if it references block properties or bml:with variables, emit a
22
+ SCAD expression. StructType members are addressed by name in BML. The
23
+ expression language rejects a numeric index on a StructType (size[0]).
24
+ A collection index (items[0]) stays an index.
25
+
26
+ When the property's SCAD form is a positional array, a named member becomes
27
+ the declaration-order index of that field. That is the default StructType
28
+ serialization and the V1 path. SizeXYZ declares x, y, z, so:
29
+
30
+ ${ [size.x, size.y, size.z - 1] }
31
+ -> [size[0], size[1], size[2] - 1]
32
+ ${ #math.max(size.z - 1, 0) }
33
+ -> max(size[2] - 1, 0)
34
+
35
+ When the property's SCAD form is an OpenSCAD object, the member stays
36
+ name.member. That form belongs to the future object() settings emitter.
37
+
38
+ Root mapping:
39
+
40
+ - myProperty -> SCAD local variable of that name
41
+ - myProperty.member on an array-form value -> name[declarationOrdinal]
42
+ - myProperty.member on an object-form value -> name.member
43
+ - items[i] on a collection -> items[i]
44
+ - withVariable -> SCAD local from the bml:with scope
45
+ - #math.min(a, b) / #math.max(a, b) -> min / max via the native map
46
+
47
+ V1 does not execute @bean calls or model bindings as SCAD. A TypeScript
48
+ implementation whose arguments are all literals is evaluated at compile
49
+ time and emitted as that literal. Any other @bean call is not emitted;
50
+ the diagnostic is BML_FUNCTION_NO_RUNTIME_IMPL. OpenSCAD capability
51
+ implementations (FQN-prefixed functions) are a later processor and are
52
+ not required for V1 block and set emit.
53
+
54
+ </documentation>
55
+ <references>
56
+ <see type="rdoc:AssemblyPatterns" relation="ReadNext" />
57
+ </references>
58
+ </rdoc:ExpressionRenderer>
@@ -0,0 +1,42 @@
1
+ <!--Render Target Documentation — FileStructure
2
+ FQN: com.machineblocks.bml.target.render.documentation.FileStructure-->
3
+ <rdoc:FileStructure xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ Required section order of a generated SCAD block file
12
+ </is>
13
+ <documentation>
14
+ Every generated SCAD file follows the MachineBlocks block file structure.
15
+ The header is mandatory. Section comments are mandatory even when the
16
+ section is empty.
17
+
18
+ /**
19
+ * MachineBlocks.com Block File
20
+ *
21
+ * Name: Wall
22
+ * Filename: Wall.scad
23
+ * Package: com.martianmicro.anyclosure.Wall
24
+ * Generated by: machineblocks-render-target (package version)
25
+ */
26
+
27
+ /* Imports */
28
+ /* Customization */
29
+ /* Main Module Call */
30
+ /* Main Module Definition */
31
+ /* Optional Sub Modules */
32
+ /* Optional Helper Modules */
33
+ /* Optional Global Functions */
34
+
35
+ The historical header said "Generated by: bom" plus a version token. New files say
36
+ machineblocks-render-target plus this package version.
37
+
38
+ </documentation>
39
+ <references>
40
+ <see type="rdoc:SettingsFormat" relation="ReadNext" />
41
+ </references>
42
+ </rdoc:FileStructure>
@@ -0,0 +1,85 @@
1
+ <!--Render Target Documentation — FqnNaming
2
+ FQN: com.machineblocks.bml.target.render.documentation.FqnNaming-->
3
+ <rdoc:FqnNaming xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ FQN to SCAD module name and file path
12
+ </is>
13
+ <documentation>
14
+ Every MBOM block class is identified by its definition FQN. This target
15
+ maps that FQN to a manifestation FQN, then to a module name and a file path.
16
+ The mapping is a MachineBlocks convention, not a BlockML platform rule.
17
+ Other targets do not replace a bml segment and do not emit one file per block.
18
+
19
+ Automatic mapping applies when targetOptions omit sourcePackage and
20
+ targetPackage. Split the FQN on "." and replace the one segment whose text
21
+ is exactly bml with scad. The match is case-sensitive and segment-wide.
22
+ mybml and bmlmodels are not bml. The replacement is not a substring search
23
+ and does not prefer the first or last segment.
24
+
25
+ Definition FQN: com.machineblocks.bml.examples.Cross
26
+ Manifestation FQN: com.machineblocks.scad.examples.Cross
27
+ SCAD module: mb__com__machineblocks__scad__examples__Cross
28
+ Output file: {srcDir}/com/machineblocks/scad/examples/Cross.scad
29
+
30
+ Zero bml segments: MB_TARGET_PACKAGE_UNDETERMINED. The message names the
31
+ source FQN and tells the caller to pass --target-package and, if needed,
32
+ --source-package. More than one bml segment: MB_TARGET_PACKAGE_AMBIGUOUS.
33
+ The message names the source FQN. Neither case writes a file.
34
+
35
+ Explicit mapping applies when both sourcePackage and targetPackage are set.
36
+ A definition FQN equal to the source package, or starting with that package
37
+ plus a dot, keeps the remainder and swaps the root:
38
+
39
+ sourcePackage com.example.models
40
+ targetPackage com.example.scad
41
+ com.example.models.bricks.MyBrick
42
+ -> com.example.scad.bricks.MyBrick
43
+
44
+ The bml-to-scad replacement is not applied on top. A selected block outside
45
+ the source package is MB_SOURCE_OUTSIDE_ROOT. A referenced FQN outside the
46
+ source package (an import or a child module) uses automatic mapping instead.
47
+ If that automatic mapping fails, the compile fails and the host writes nothing.
48
+
49
+ Preset JSON uses the same manifestation with extension .json.
50
+ The output root is the configured blocks directory (srcDir), not a guessed
51
+ dist, build, or scad directory.
52
+
53
+ Name rules:
54
+
55
+ - Segments separated by double underscore (__)
56
+ - Packages lowercase
57
+ - Class names PascalCase
58
+ - Subclasses: additional PascalCase segment
59
+ - Private helpers: __help__camelCase (not a block)
60
+ - Private functions: __func__camelCase (not a block)
61
+
62
+ Examples:
63
+
64
+ com.machineblocks.bml.bricks.Standard
65
+ -> mb__com__machineblocks__scad__bricks__Standard
66
+
67
+ subclass Bottom of a manifested Wall
68
+ -> mb__com__example__scad__Wall__Bottom
69
+
70
+ private helper
71
+ -> mb__com__example__scad__Wall__help__myHelper
72
+
73
+ private function
74
+ -> mb__com__example__scad__Wall__func__myFunc
75
+
76
+ The names help and func are reserved and cannot be subclass names.
77
+
78
+ Multiple block classes may share one SCAD file. The file is named after the
79
+ primary class. The output root is srcDir.
80
+
81
+ </documentation>
82
+ <references>
83
+ <see type="rdoc:Imports" relation="ReadNext" />
84
+ </references>
85
+ </rdoc:FqnNaming>
@@ -0,0 +1,57 @@
1
+ <!--Render Target Documentation — HelperFunctions
2
+ FQN: com.machineblocks.bml.target.render.documentation.HelperFunctions-->
3
+ <rdoc:HelperFunctions xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ Which values are computed in SCAD versus in the compiler
12
+ </is>
13
+ <documentation>
14
+ Some helpers run at SCAD render time instead of being precomputed.
15
+
16
+ Decided — SCAD runtime:
17
+ - mb_set_bounding_box(STEPS)
18
+ - mb_assembly(config, settings, size, direction)
19
+ - mb_assembly_tongue(assembly, renderGroups, group)
20
+ - mb_assembly_groove(assembly, renderGroups, group)
21
+ - mb_assembly_offset(offset, assembly, renderGroups, group)
22
+ - mb_group_render(renderGroups, group)
23
+ - mb_block_id(blockId, partId)
24
+ - mb_parts_total_size(parts)
25
+
26
+ The assembly helpers and mb_group_render read assembly mode or
27
+ renderGroups.
28
+
29
+ mb_block_id is str(blockId, "/", part). blockId comes from
30
+ mb_param_id(config, settings, fqn) and can be overridden from outside, so
31
+ the renderer emits the call. NativeBlock documents the part id as
32
+ "blockId/partName".
33
+
34
+ Decided — mb_params_filter(baseAdjustment, namespace, overrides?):
35
+ The parameter name is baseAdjustment. Core 3.0.0 renamed it from
36
+ baseSideAdjustment. When the map is the runtime parameter (config or
37
+ customizer), emit the call. When the map is a static literal, emit the
38
+ filtered pseudo-map. The optional third argument applies fixed overrides
39
+ after the namespace filter. Entries without a namespace and entries with
40
+ numeric keys are ignored.
41
+
42
+ mb_parts_total_size(parts) is the SCAD bounding box of the parts after
43
+ direction resolution. Each entry is [id, size, direction, offset], the
44
+ same layout as a STEPS row. id is required. size, direction, and offset
45
+ are indexes 1, 2, and 3. The renderer emits the call:
46
+
47
+ size = mb_parts_total_size(parts);
48
+
49
+ Rule: render-dependent values (assembly, renderGroups, overridable
50
+ blockId) resolve at SCAD runtime. Structural and static values are
51
+ precomputed in MBOM.
52
+
53
+ </documentation>
54
+ <references>
55
+ <see type="rdoc:SerializationRules" relation="ReadNext" />
56
+ </references>
57
+ </rdoc:HelperFunctions>
@@ -0,0 +1,49 @@
1
+ <!--Render Target Documentation — Imports
2
+ FQN: com.machineblocks.bml.target.render.documentation.Imports-->
3
+ <rdoc:Imports xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ use and include paths emitted into each SCAD file
12
+ </is>
13
+ <documentation><![CDATA[
14
+ Every generated file imports the MachineBlocks V3 library and the project
15
+ config. Paths are relative to the output file, using mbLibPath from
16
+ targetOptions under the key machineblocks-v3-scad. The compiler
17
+ RenderSession has no mbLibPath field. When mbLibPath is absent this slice
18
+ returns files: [] and diagnostic BML_MB_LIB_PATH_MISSING.
19
+
20
+ Standard imports (angle brackets are SCAD include syntax):
21
+
22
+ use <{relative_path_to_scad_lib}/lib/block.scad>;
23
+ include <{relative_path_to_scad_lib}/config/mb_config.scad>;
24
+
25
+ Ordinary composite compositions render leaf instances as mb_block()
26
+ (NativeBlock). They do not use-import dependency block SCAD files.
27
+
28
+ Sets (com.machineblocks.bml.core.Set) reference typed block modules by the
29
+ placed part's type FQN. The set processor emits a use import for each
30
+ distinct type file, for example use <../wall/Wall.scad>, and each instance
31
+ module calls that type's manifestation module.
32
+
33
+ When expressions reference a #built-in call that is not a native SCAD
34
+ mapping, the processor adds a use import for that service file, and only
35
+ when the service is actually used:
36
+
37
+ use <{relative}/blocks/org/blockml/bml/service/Math.scad>;
38
+ use <{relative}/blocks/org/blockml/bml/service/Strings.scad>;
39
+
40
+ Service SCAD files live in @machineblocks/core at
41
+ blocks/org/blockml/bml/service/ (Math.scad, Strings.scad, Numbers.scad,
42
+ Lists.scad, Bools.scad). They are pre-rendered artifacts. BML service
43
+ definitions in @blockml/core are the SSOT. Import paths are always relative
44
+ to the output file directory.
45
+ ]]></documentation>
46
+ <references>
47
+ <see type="rdoc:NativeMappings" relation="ReadNext" />
48
+ </references>
49
+ </rdoc:Imports>
@@ -0,0 +1,43 @@
1
+ <!--Render Target Documentation — Introduction
2
+ FQN: com.machineblocks.bml.target.render.documentation.Introduction-->
3
+ <rdoc:Introduction xmlns="http://blockml.org/bml"
4
+ xmlns:core="org.blockml.bml.core"
5
+ xmlns:rdoc="com.machineblocks.bml.target.render.documentation">
6
+
7
+ <baseType>
8
+ core:Documentation
9
+ </baseType>
10
+ <is>
11
+ Purpose and place of the MachineBlocks SCAD render target
12
+ </is>
13
+ <documentation>
14
+ This target serializes MBOM blocks into MachineBlocks V3 SCAD files.
15
+ It is a product render target, separate from @machineblocks/core and from
16
+ the BlockML toolchain targets (blockdoc, xsd, fatblock).
17
+
18
+ @machineblocks/core holds the domain BML, documentation, the SCAD runtime
19
+ (lib/block.scad and related files), and example pairs such as
20
+ com.machineblocks.bml.examples.Cross with
21
+ blocks/com/machineblocks/scad/examples/Cross.scad. This package reads that
22
+ library; it does not vendor it.
23
+
24
+ Output is MachineBlocks World interpretation: SCAD mb_block() calls. That is
25
+ not a BlockML platform rule. Other targets may emit React, KiCad, or Python
26
+ with no block concept. Mapping used here:
27
+
28
+ - BML NativeBlock — mb_block() at the leaf (explicit 1:1)
29
+ - BML composition — nested mb_block() tree
30
+ - Domain types such as Wall — lowered to mb_block() settings
31
+ - BML Set — STEPS array plus view submodules
32
+
33
+ All MBOM-to-SCAD mappings are declarative. Processors do not hardcode
34
+ parameter inventories. Native parameters come from NativeBlock.bml.
35
+
36
+ The target is browser and Node compatible. No Node-only APIs.
37
+ Host entry for users is @machineblocks/cli.
38
+
39
+ </documentation>
40
+ <references>
41
+ <see type="rdoc:V1Scope" relation="ReadNext" />
42
+ </references>
43
+ </rdoc:Introduction>