Skip to content

Colours, coordinate systems, centre of mass, bounding box and section properties - #284

Merged
andrewbartels1 merged 4 commits into
mainfrom
feat/appearance-and-reference
Nov 30, 2026
Merged

andrewbartels1 merged 4 commits into
mainfrom
feat/appearance-and-reference

Conversation

@andrewbartels1

Copy link
Copy Markdown
Owner

Six new tools, all in beta (queue items 36 and 39).

Colours (set_appearance, get_appearance)

  • Colour the whole part, one feature, one body, or the face at a point. Colours are [r, g, b] or #rrggbb, with optional transparency.
  • reset: true removes a feature's, body's or face's own colour.
  • get_appearance reads the colour that shows and says which level it comes from. A face's colour shows over its feature's, a feature's over its body's, and a body's over the part's.
  • Every colour is read back from SolidWorks after it is set. SolidWorks needs the values as an array of doubles; a plain list was misread, which is why the boolean demo's bodies came out green.

Reference and analysis extras

  • create_coordinate_system: a coordinate system at a point, with axes along the model's. Its transform is read back.
  • create_center_of_mass_point: SolidWorks' Center of Mass point.
  • create_bounding_box: the Bounding Box feature, with the stock size.
  • get_section_properties: a planar face's area, centroid, second moments of area, polar moment and principal moments.

Probes and live tests (SolidWorks 2026 SP4)

  • Two probe scripts settled each call's shape. The results are in design.md.
  • The live tests pass:
    • colours on a block: blue top face, feature-green sides, the body's orange hidden under the feature's colour, and a reset;
    • section: 1,600 mm² and 213,333.3 mm⁴;
    • coordinate system at (20, 10, 20);
    • centre of mass at (0, 5, 0);
    • bounding box 40 × 10 × 40;
    • one refusal on purpose for each family (colours and reference extras).
  • A picture exported from SolidWorks showed each result as expected.
  • The first live run found that SolidWorks ignores the coordinate system's flip flags when no axis is selected. Those flips were dropped rather than shipped as inputs that do nothing.

Also in this PR

  • Fixes code-scanning alert 244 (Bandit B610). A callback was named extra, which Bandit took for Django's QuerySet.extra. There is no SQL; it is renamed to own_fields.
  • Archives the merged helix and multi-body OpenSpec changes.

Spec: openspec/changes/appearance-and-reference-tools/.

Checks

  • ruff and mypy are clean.
  • 5,046 unit tests pass, with coverage at 100%.
  • The strict docs build is clean.

There is no demo GIF yet; that waits for your demo.

…rance, get_appearance, create_coordinate_system, create_center_of_mass_point, create_bounding_box, get_section_properties
…ix and multi-body changes; changelog and queue
@andrewbartels1
andrewbartels1 merged commit a9b9cb9 into main Nov 30, 2026
16 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