Set $preview=true for live preview and add extra args escape hatch#55
Set $preview=true for live preview and add extra args escape hatch#55CraigHutchinson wants to merge 5 commits into
Conversation
Use OpenSCAD's native --preview / --preview=throwntogether / --render flags instead of injecting -D $preview=..., so $preview is set correctly by OpenSCAD itself. Live preview defaults to --preview (OpenCSG, fast); exporting to the slicer always uses --render (full CGAL geometry). Adds four new settings: - openscad.previewRenderMode: choose preview (default) or throwntogether - openscad.extraArgs: extra CLI args for every invocation - openscad.previewExtraArgs: extra args for preview only - openscad.renderExtraArgs: extra args for export/render only Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Allows users to explicitly opt back into full CGAL rendering for the preview panel, matching the behaviour prior to this setting being added. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
as a bonus - I tested the fix and can also set |
|
I need to verify - its possible |
OpenSCAD's canPreview() only returns true for PNG — not 3MF, STL or any other geometry format — so --preview alone never sets \$preview=true on those formats. Pair each preview render mode flag with -D \$preview=true so designs using \$preview for detail control behave correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
--preview/--preview=throwntogether do not set $preview=true for geometry formats (3mf, stl, etc.) — OpenSCAD's canPreview() only allows it for PNG. The flags also have no effect on geometry evaluation, which always uses CGAL. The whole RenderMode enum, previewRenderMode setting, and renderModeArgs() were complexity with no real effect. Replace with a plain preview boolean: preview renders inject -D \$preview=true, exports omit it (OpenSCAD defaults to false). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- openscad.preview (boolean, default true): controls whether $preview=true is injected for live preview renders; disable to match export quality - Rename previewExtraArgs/renderExtraArgs to extraArgsPreview/extraArgsExport so all three extraArgs settings sort adjacent in the VS Code settings UI Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Looks like OpenSCAD isn't playing nice with this - should have been simple - moving to DRAFT as looks like the |
|
The issues in setting $preview have been raised as an OpenmSCAD bug: openscad/openscad#6867 The pr as it stands is still valuable to support supplying extra arguments and the upstream issue isn't necessarily a blocker for this being added. |
OpenSCAD's
$previewspecial variable is the idiomatic way designs self-optimise —$fn = $preview ? 12 : 72is a common pattern to keep the live preview snappy while producing full-quality geometry on export. The problem: OpenSCAD's CLI only sets$preview=trueautomatically for PNG output. For geometry formats like 3MF and STL, it is alwaysfalse— regardless of any render mode flag — becausecanPreview()in the OpenSCAD source explicitly excludes them. So every live preview rendered by this extension was silently running at full export quality on every keystroke, making previews slow and$preview-based detail switches invisible.This PR injects
-D $preview=trueexplicitly when rendering the live preview panel, and leaves it unset (defaulting tofalse) for slicer exports. That single change makes$previewwork as users expect with no design changes required. A newopenscad.previewsetting (defaulttrue) lets users opt out if they want to see full render quality in the preview panel.Three
extraArgssettings are also added as a general escape hatch, so users can inject any additional OpenSCAD CLI flags without waiting for an extension update — useful for workarounds like this one and for enabling experimental features.Closes #54.