Repository navigation
Cadova 1.1.0
Web Customizers
Cadova can now turn a parametric model into a web page where anyone can adjust its parameters, see a live 3D preview and download the result. Run swift package generate-customizer in a model package to build it. The model is compiled to WebAssembly and runs entirely in the visitor's browser, so the page is a folder of static files you can host anywhere. The new Publishing a Web Customizer article explains how to make and publish one, including a GitHub action that builds the page and publishes it to GitHub Pages. To see some in action, try the keystone box, QR code sign and patch panel customizers.
Use @Parameter to declare the values a customizer should offer. Each parameter can have an optional range, step, unit and description. It can be an Int, Double, Bool, String, Angle or Color, or an enum that conforms to ParameterChoice. Outside a customizer, a parameter just has its default value. Models that use the same parameter declaration share its value, and a parameter declared in a Project or Group is shared by the models in it. The page also shows the model's author, license and source from its metadata.
A model can read @Environment(\.buildDestination) to tell whether it's being built as a file, for a customizer's live preview, or for a customizer download. This is useful for small presentation differences, such as showing a part upright in the preview that prints face down.
Cadova itself now builds for WebAssembly (WASI). There are no system fonts there, so Text needs a font file loaded with withFont(_:style:size:from:).
Additions
ModelFileGeneratorcan report its cache size withapproximateCacheByteCountand trim it withpruneCache(toApproximateByteCount:), to keep memory in check when building many different models.
Improvements
- Fillets and chamfers made with
extruded(height:topEdge:bottomEdge:), or cut into a flat face of a prismatic body withcuttingEdgeProfile(_:on:), now blend seamlessly into the wall, follow sharp corners and tight holes accurately, and build faster.
Fixes
shapingEdgeswith a concave edge shape no longer adds material on the far side of a thin wall.- Fixed a crash when exporting an empty 2D model as SVG.
- The
--modelcommand line option now also filters models that aren't inside aProject. - Fixed an Objective-C warning about duplicate classes at launch when a model uses the prebuilt XCFramework and also depends on Nodal.