Skip to content

Builtin arguments: undef means not given; h/a aliases; linear_extrude default height 100 - #230

Merged
revarbat merged 1 commit into
mainfrom
fix/explicit-undef-args
Oct 4, 2026
Merged

revarbat merged 1 commit into
mainfrom
fix/explicit-undef-args

Conversation

@revarbat

@revarbat revarbat commented Oct 4, 2026

Copy link
Copy Markdown
Member

Refs BelfrySCAD/BelfrySCAD#680

Summary

getArg returned an argument given as undef as a value, so rotate_extrude(angle=undef) revolved 0° instead of 360°. Wrappers forward their own optional parameters as undef, and BOSL2's new rotate_extrude override does exactly that (_rotate_extrude(angle=angle, ...)), so with current BOSL2 every plain rotate_extrude() came out as its flat profile (#680).

Upstream treats undef as absent in every builtin (if (v.isDefined())). getArg now does too.

Checked against OpenSCAD 2026.02

Every builtin argument I could reach, each called with ARG=undef and with it left out (47 cases). Before this change six differed from OpenSCAD — rotate_extrude angle, linear_extrude height, cylinder h, square size, text size and spacing (several produced nothing at all). After it, none differ.

Also, as upstream

  • linear_extrude(h=...) and rotate_extrude(a=...) are accepted as aliases — BOSL2's new overrides forward them. Both given: warning Specified both "height" and "h" (resp. "angle" and "a"), and the primary name wins. Both added to builtinParamNames.
  • linear_extrude() with no height is 100 tall, as upstream (it was 1).

Not done here: linear_extrude(v=...), upstream's extrusion-direction vector. It is declared in builtinParamNames but still not implemented; a separate change.

Tests

tests/test_undef_args.cpp (5 tests): undef is the default for each of the six, positionally too; a wrapper forwarding its own optional angle revolves fully; the default height; h/a with no warning; both names given warns and the primary wins. Full ctest: 2019 passed. Binding tests: 61 passed. The reported BOSL2 case now matches OpenSCAD's bounding box exactly.

Before releasing this: the full BOSL2 docsgen A/B.

🤖 Generated with Claude Code

…ight 100

getArg returned an argument given as undef as a value, so
rotate_extrude(angle=undef) revolved 0 degrees instead of 360. Wrappers
forward their own optional parameters as undef: BOSL2's new rotate_extrude
override passes angle=angle, which flattened every plain rotate_extrude()
into its profile (BelfrySCAD#680). Every upstream builtin treats undef as
absent (if (v.isDefined())); getArg now does too. Checked against OpenSCAD
2026.02 argument by argument (47 cases): rotate_extrude angle,
linear_extrude height, cylinder h, square size and text size/spacing were
the ones that differed, and now match.

Also, as upstream: linear_extrude accepts h= and rotate_extrude a= as
aliases (BOSL2's overrides forward them), warning 'Specified both
"height" and "h"' and taking the primary name when both are given; and
linear_extrude's default height is 100, not 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@revarbat
revarbat merged commit 146d200 into main Oct 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant