Compare commits

...

106 Commits

Author SHA1 Message Date
bherbruck cfffba411e Open a design from a newer SolidCraft with a warning instead of refusing it
A newer format number or an unknown change no longer blocks opening. What
this version can read opens; a feature it can't read stays on the timeline
with an error, and fields, sections and container parts it doesn't know are
named in the reply and written back by Save, under the file's own number.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 21:30:14 -05:00
github-actions[bot] f8a98eed33 Regenerate generated files and fold pending files [skip ci] 2026-11-04 19:59:52 +00:00
github-actions[bot] 7629421375 Regenerate generated files and fold pending files [skip ci] 2026-11-04 19:48:22 +00:00
Homero Thompson d034633265 Desktop: the file chooser says when it is not the desktop's own (#10618)
* test: the file chooser says when it is not the desktop's own (#10159)

rfd falls back to zenity in silence when the XDG portal is not there, and the
user gets a foreign window with no explanation. The host must be able to say so.

RED: the test fails with 'without a D-Bus session bus the file chooser is not the
desktop's own: the user has to be told'.

* fix: say when the file chooser is not the desktop's own (#10159)

rfd opens the file chooser through the XDG desktop portal; without the portal it
falls back to zenity, a window that does not belong to the app, and the app never
says so. The user gets a foreign window and no explanation.

The host now asks the session bus, on a thread of its own, whether the portal is
there, and keeps the answer. When a file is opened and the chooser is not the
desktop's own, the reason goes to the session log (Help > Messages), which is
where a user looks for it.

* fix: the file chooser messages read as notices, not assertions (#10159)

The maintainer asked for two things on the pull request: the strings of the
pending catalogue read like a test assertion ("the user has to be told...")
rather than a notice a person would see, and the doc comment above
desktop_chooser_fallback was there twice.

The three reasons are now plain messages, in every locale of the file: they
say what the chooser is and why, and stop there. The doc comment of the
function is now the only one, and it says what it did.
2026-11-04 19:12:58 +00:00
Yishin Li fc51df3b01 cadmpeg 0.6.7: FreeCAD placements, sphere faces and closed shells come in right (#10382)
Only the version moves: SolidCraft builds against 0.6.7 unchanged. 0.6.7 applies App::Part
and link placements once, writes a sphere's seam ring as a valid loop, and indexes the
lookups that made large assemblies slow to decode. Two real FreeCAD documents that 0.6.3
refused as invalid open with it.


Claude-Session: https://claude.ai/code/session_01MvsHJx9gzG4447TABcpZFo

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 19:01:59 +00:00
austin62jake 8f4d7959df Agents and scripts: Parameter Sweep describes its exact parameters and reply (#10977) (#10978)
* claim: #10977

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Parameter Sweep: input and output schemas (#10977)

inspect.parameter_sweep gets a typed contract and reply types in
schema/parameter_sweep.rs and leaves unconverted.txt. Each key reads as
the handler reads it, with its message; the reply is built from
ParameterSweep and its item types, with the same JSON as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Parameter Sweep schema: a missing parameter reaches the handler's message

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* parameter_sweep schema: do not publish a null default on the required parameter

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
2026-11-04 19:00:58 +00:00
Tury991 338fa197d3 Dimension text: round values to a step (#4896) (#11380)
* claim: #4896

* feat(doc): support dimension text rounding steps (#4896)
2026-11-04 19:00:07 +00:00
SS-EN 727bb23c7e Section Analysis: a body standing on another keeps its own cap, also in CPU pictures (#4622)
Where one body stands on another (a post on a plate), the post's bottom,
seen through the cut, and the plate's top are the same plane. In the CPU
rasterizer (headless pictures without a GPU) the plate's top won that
depth tie and showed through the post's cut. The cut now wins a tie by a
few f32 steps (DEPTH_EPS).

The viewport already draws this right since #6363 and #6728; a GPU
regression test now covers it, both creation orders, orthographic and
perspective, with both depth formats.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 18:52:15 +00:00
CarelT 8d6c45f640 UI kit: one shared needs-attention mark, used by the agent chat's badge (no behaviour change) (#5424)
* UI kit: one shared needs-attention mark, used by the agent chat's badge

The agent chat's "waiting" badge becomes `ui_kit::attention_mark` (a count, or
a plain dot) in `ui_kit/attention.rs`, so other things that wait for the user
(linked designs that changed, #5354) share one mark. The count is drawn
exactly as before. No change in behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* UI kit: sort the attention re-export

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ui_kit attention mark: take the corner inset from Tokens::space_3

The inset came from the agent chat panel as plain numbers, which font_sizes_and_dense_form_metrics_come_from_tokens refuses outside theme::Tokens (review on #5424). space_3 is 3.0, so nothing moves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Carel Theron <careltheron@Carels-MacBook-Pro.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
2026-11-04 18:52:05 +00:00
Jackson Oursland 6d16fae4ed Render preview: extract the product scene only when what it shows changes (#7465)
The live product preview's signature included the session revision, which
every command moves: a selection click extracted every body and built every
product vertex again (118 ms on a 200-body assembly) before the key comparison
skipped the upload. The signature is now the document and world state (held,
so their addresses are not reused) and every input of body visibility,
including hidden folders and the active sketch.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-04 18:51:42 +00:00
semmelrinde ef92f35b16 Sketch drag: a step solved ahead that solves becomes the sketch, one step per core (#7648) (#7649)
Past a failed step a scripted drag solves the next steps at once and takes
those that fail in a row as tried; the first that solved was then solved
again by the walk. It now becomes the sketch from its solved copy, so no
step is solved twice. A batch holds one step per core (at most 8), and on
one core or in the browser build, where a batch would run its steps one
after another, the walk solves the steps itself. The walk takes the same
steps with the same outcomes, so results and counted solves don't change.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 18:51:32 +00:00
kaltenbrunnermarkus 232a902680 Circular pattern: cutting many copies of a hole is faster (#9007) (#9038)
* claim: #9007

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Circular pattern: cut copies of a hole that lie apart in one go, and check missed copies cheaply (#9007)

The check for copies that remove no material intersected every copy with
the whole body; a point test along the hole's axis (and through the middle
of the copy's overlap with the body) now proves most copies take material
and only the rest are intersected. Copies the kernel's coarse box test
takes for meeting are measured on finer meshes and, when clearly apart,
joined with join_apart and cut once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Format (#9007)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Look for a copy's material through the middle of each of its faces (#9007)

A tool of two pieces (two circles cut at once) turned by 45 degrees has the
middle of its box between the pieces; the lines along the axes through it
miss both, and the copy was intersected. The lines through the middle of
each face's box run along each cylinder's axis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Circular pattern: cut copies that notch the same round face one by one (#9007)

Copies whose boxes only finer meshes show apart were cut in one go. When
several of them notch the same curved face of the target (grooves along a
bore), the result kept extra lines on that face: a revolved ring with 37
grooves came out in 184 faces instead of the 151 a one-by-one cut leaves,
at the same volume. Such copies are now cut in turn; copies that only
share flat faces (through holes in a tube wall) are still cut at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Circular pattern: tell copies apart and find copies that cut nothing on exact shapes (#9007)

The checks this pull request added decided on meshes, which `cargo xtask
mesh-decisions` now refuses. They decide on the exact shapes instead:

- Two tools whose boxes meet are apart when their union comes out in two
  pieces that share no face, edge or vertex (crossing, nested and touching
  tools do not).
- A copy takes material when a point along its axis, the axes of its round
  faces or the middle of the box it shares with a target is inside both, by
  exact point classification; only copies that test cannot place are
  intersected.
- Copies that notch the same round face are no longer cut one by one: cut
  in one go they now leave the same faces as one by one (a revolved bore
  with 37 grooves: 80 faces either way, as on main).

The test of copies that come close now uses 8.5 mm, where they overlap; at
9 mm they are 0.012 mm apart and are cut in one go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 18:42:02 +00:00
PaddleStroke cfc4908291 Sheet metal: returns on a notched tray now close at the convex corner (#8823) (#9714)
* claim: #8823

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sheet metal: returns on a notched tray close at the corner away from the notch (#8823)

Closing two returns at a corner was refused when either return already lay
over another flange in the flat pattern, even far from that corner. On a tray
with a notch, the walls on either side of the notch's inner corner both unfold
into the notch, so the return on one of them lies over the other there; the
return's opposite convex corner was then left open ("closed, the flanges would
overlap in the flat pattern") and the two returns ran through each other.

A closure is now refused only when it makes the two returns overlap or adds to
what either already shares with another flange in the flat.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 18:41:07 +00:00
froglemonade2 1432131e95 English: command labels in title case, other labels in sentence case (#9085) (#10734)
* English: command labels in title case, other labels in sentence case (#9085)

The rest of #9085 after #9194 (the plural and the spelling) and #9907
(the Preferences page names). Command labels are in title case (422 of
430 were already); the seven in sentence case follow, and Fix/UnFix
reads Fix/Unfix. The UI text skill states the rule. The user docs name
the Preferences footer's button by its current label, Restore page
defaults (#10295).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Navigation bar menu test: the echo names the command by its own label

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* UI text skill: state the case rule in one short sentence, under the 3600 limit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Localization doc: the case rule in full, with examples

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Localization doc: the example button is Restore page defaults now

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 18:39:52 +00:00
CaRLymx 35bc04847a Spanish (es-ES): catch up with en.json (2026-11-04) (#10895)
* i18n: make engine errors translatable

Engine errors (`EngineError::BadParams` and the offset/path errors the kernel
returns) were shown in English regardless of the active locale.

- Add `tr_engine_error`, which maps the known messages to `sketch.error.*`
  keys and returns anything unknown unchanged.
- Normalise the `invalid parameters for `<command>`: ` prefix before matching,
  and interpolate the offset id into the translated message.
- Route `friendly_error` through `tr_engine_error`.
- Avoid redundant status writes in `run_points`/`run_entities`.
- Ship the es-ES pending strings for the sketch tool hints.

* Spanish (es-ES): catch up with en.json

Translate the 734 messages `es.json` was missing and fix `ui.project`
("Proyecto" → "Proyectar", the action behind the sketch project tool).

The catalogue now matches `en.json` key for key (5,591 entries), keeps every
placeholder intact and stays alphabetically sorted. That includes the 61
messages added upstream since the last catch-up (92a9a5e0).

Terminology: "Turntable" → «Plato giratorio», "hover" → «pasar el puntero»,
"card" → «tarjeta».

* i18n: attribute the sketch hints and keep the offset error neutral

The pending sketch hints file adds an asset, so it gets its own row under
attribution/pending rather than editing ATTRIBUTION.md.

The engine reuses the offset-ends error for trim, extend and break, so the
message no longer tells the user to trim: it asks them to edit the source
curves instead.

* i18n: translate shortcut-started tool hints and fix the break message

Shortcuts are handled in logic(), before ui() installs the language scope, so a
tool started by its key stored the English hint even with another language
selected. Install the scope for the whole frame.

The engine has nothing to break, so say so: "nothing to break here".

* i18n: scope a tool start so its hint uses the app language

A direct start can run outside the frame scope (and a shortcut runs in logic),
so the hint was built with the thread default. Open the scope where the tool
starts.

* Spanish (es-ES): translate the 30 new messages

The blur preferences, the dimension step settings and the fillet turn modes
arrived upstream after the last catch-up.

* i18n: scope command errors and use US spelling in the hints

The native menu runs Undo and Redo before the frame scope exists, so an error
from them was translated in the thread default language.

The pending hints mixed British spellings into the English source; the English
catalog is US-spelled, so the fallbacks say center and en-GB keeps centre.
2026-11-04 18:39:43 +00:00
Mateusz Sych 06def2231d Agent chat: tell the agent the design changed by hand since its last reply (#10854) (#11144)
* claim: #10854

* Agent chat: tell the agent the design changed by hand since its last reply (#10854)

The chat remembers the design as the agent last saw it, at the end of a
turn it answered or worked in. When the next message goes and the design
is no longer that one, a note goes before the message for the agent (not
into the conversation, like the note after an interruption): the user
changed the design by hand, which parameters changed from what to what,
which features are new, edited or removed, where the History marker went,
and to read the design again before reusing positions, picks or sizes.

A new chat and a stopped backend forget it, so a session that has seen
nothing gets no note. Each list names at most 12 items and counts the
rest; names and expressions are cut at 60 characters.

* Agent chat docs: the design-changed note asks the agent to read the design again (#10854)

---------

Co-authored-by: MateuszSychXpl <151755914+MateuszSychXpl@users.noreply.github.com>
2026-11-04 18:39:09 +00:00
PaddleStroke d39fd6c397 Assistant: discover Mistral Vibe and offer sign-in (#11692) (#11704)
* claim: #11692

* Assistant: discover Mistral Vibe and support its sign-in (#11692)
2026-11-04 18:38:05 +00:00
Brett Lawson 4faf63e48a Loft: profiles picked one after another in one sketch are one section (#11720) (#11906)
* Loft: profiles picked one after another in one sketch are one section (#11720)

The Loft dialog made every picked profile its own section, so two picks in
one sketch (both halves of a split outline, say) became two sections in one
plane and the loft was refused. Consecutive picks in one sketch now form one
section {sketch, profiles: [...]}; a later return to that sketch is still a
section of its own, so the there-and-back loft of #8221 is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SdcgEu4Lr3moCCisdZShKz

* Loft: an unchanged edit keeps a section of all profiles "all" (#11720)

An edit loads a section of "all" as each profile of its sketch; now that
those picks make one section, OK saved them as indices. Indices fill a
letter's counters that "all" keeps as holes, so a later rebuild could
change the loft. Like Extrude, Revolve and Emboss, a section that was
"all" stays "all" while the picks are unchanged and cover every profile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SdcgEu4Lr3moCCisdZShKz

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 18:37:41 +00:00
takuto-NA 91ecea8cfd Properties: account for sheet perforations (#6025) (#6028)
* claim: #6025

* fix(engine): account for sheet perforations in physical properties

* fix(inspect): retain kernel topology counts for sheet bodies
2026-11-04 18:30:31 +00:00
PaddleStroke c8c0c28fc8 Point clouds: keep every PTS point within the import limit (#11093) (#11717)
* claim: #11093

* Point clouds: count point rows before thinning PTS imports

* Point clouds: exclude invalid coordinates from text sampling
2026-11-04 18:27:21 +00:00
PaddleStroke f91db06904 Sketch Project: links to old numbered faces can be recovered (#11666) (#11707)
* claim: #11666

* Sketch: recover legacy references on original whole faces
2026-11-04 18:24:02 +00:00
Andrzej Błasik 9df9d1fbdc fix(smlib): NURBS weights compare within rounding of the coordinates' size (#11974)
same_nurbs compared the weights of a face's NURBS form and the rebuilt
analytic surface's NURBS within an absolute 1e-12. A weight is found from
the control points, so its rounding grows with the coordinates: 3.8e-12 at
coordinates of about 320 on a cone. The face was refused with "a NURBS form
that is not its analytic surface". Weights now compare within
1e-12 * max(1, |coordinates|), as same_nurbs_curve already does for points.
2026-11-04 18:23:53 +00:00
rugbymauri 8068e8f4b8 Preferences: the theme strip's arrows page by a screenful of themes (#11434) (#11600)
* claim: #11434

Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>

* Preferences: the theme arrows move by the themes that fit in view

The previous and next arrows beside the theme cards in Preferences >
Appearance moved the row by one card per click, although their hover
text says "Previous themes" and "Next themes". With 26 themes and about
six cards in view, reaching the last theme took some twenty clicks.

The shared carousel now moves by the number of cards that fit at the
current width, so one click shows the next screenful. The last page
ends on the last card, the first page starts on the first, and the
arrow at an end stays dimmed and inert. The step follows the window
width, and the row still opens on the chosen theme.

Fixes #11434

Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>

---------

Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>
2026-11-04 18:21:39 +00:00
PaddleStroke 863b0777da Sketch: dragging a constrained line by its middle no longer stalls (#11696) (#11714)
* claim: #11696

* Sketch: move constrained lines that stall during dragging
2026-11-04 18:19:46 +00:00
austin62jake 80889762ce Agents and scripts: Configure, Configuration Column, Row and Rule describe their exact parameters and reply (#11895) (#11896)
* claim: #11895

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Configuration table: input and output schemas for Configure, Configuration Column, Row and Rule (#11895)

describe_command now gives the exact parameters and reply of the four
commands that change a design's configuration table, and the warn and
strict parameter checks use them. The handlers read their parameters
from the raw JSON, so the new contracts in schema/config.rs read each
key as its handler does, with its message: lists of names as
params::string_list (whose json_brief and MAX_STRING_LIST become
pub(crate)), exactly one column target, faces picked or a face column's
key, a row's cells, and rules (whose schema describes them; the handler
keeps its own check). What only the design can answer stays the
handler's. All four reply with ConfigTableReply, as config.table does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-04 18:19:35 +00:00
rugbymauri a3f293c987 Error messages: an out-of-range value names the field that is wrong (#9625) (#9684)
* claim: #9625

Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>

* Name the value at fault when a hole, sheet rule, joint or extrude is refused (#9625)

Several refusals were right but named a check the input had passed, so
the user changed the wrong field:

- solid.hole: an unknown `fit` was reported as an unknown bolt size; it
  now says the fit must be close, normal or loose. A countersink angle
  out of range was reported as a countersink too narrow; the angle and
  the width are now checked apart. A `diameter` number out of range was
  reported as missing; it now gives the range, as other parameters do.
- Sheet rules: a thickness of 10000 mm or more said "must be positive";
  it now gives both limits. The K-factor and the bend radius are named
  on their own, and the message no longer implies a radius of 0 is
  refused.
- joint.drive: a number out of range said "numbers or expressions"; it
  now gives the range.
- Extrude: a distance past the kernel's limit said `end = 1000000000`;
  it now says the extrusion is too long and gives the limit.

Fixes #9625

Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>

* Refuse a too-long extrusion before the kernel and match the countersink floor (#9625)

The kernel is paused, and its `finite()` check also guards a revolve's
angle and a cylinder's and a torus's sizes, so its message must not say
"extrusion". crates/kernel is back as it was; the doc evaluator now
refuses an extrude (plain, tapered, or redefined from the Edit Extrude
dialog) whose end lies 10000000 mm or more from the sketch plane,
mirroring the kernel's limit, and says so. A cylinder of radius 2e7
keeps the kernel's own message.

The countersink check refused 0.1° while the message said "more than
0°". The floor stays (the cone grows as 1 / tan of the half angle) and
the message now names it: more than 0.115°.

Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>

---------

Signed-off-by: Maurizio Monticelli <maurizio@whatwedo.ch>
2026-11-04 18:18:14 +00:00
PaddleStroke e27d17c421 Assistant: offer the Mistral AI endpoint in Add Agent (#11246) (#11715)
* claim: #11246

* Assistant: offer the Mistral AI API endpoint (#11246)
2026-11-04 18:16:34 +00:00
github-actions[bot] 52bc27aaf6 Regenerate generated files and fold pending files [skip ci] 2026-11-04 18:48:25 +00:00
github-actions[bot] c357b1565e Regenerate generated files and fold pending files [skip ci] 2026-11-04 18:40:09 +00:00
cronos de9a2bc846 Shaded with hidden edges: optionally select edges through faces (#11841)
* Allow optional hidden-edge picking in Shaded with hidden edges

Keep visible-only picking as the default. Cover the preference, hover cache,
section and body visibility, and Fillet inputs in the existing UI tests.
Use platform-absolute fixture paths in the Windows CI argument-parser test.

* Respect section caps and visible-edge ties in hidden-edge picking

* Keep section caps as occluders behind nearer kept faces
2026-11-04 18:13:40 +00:00
Mateusz Sych 6b6bd26648 Agent chat: a prompt's bubble is as tall as its message (#11882) (#11883)
* claim: #11882

* Agent chat: a prompt's bubble is as tall as its message (#11882)

The prompt's Copy message row (#10741) was laid out right to left and centred
across its height. egui gives such a row all the height left in the
conversation's view, so a prompt near the top of a conversation stretched
down over the empty view, with Copy message floating in the middle. The row
is top-aligned now.

* Agent chat: keep the test's harness bound (#11882)

---------

Co-authored-by: MateuszSychXpl <151755914+MateuszSychXpl@users.noreply.github.com>
2026-11-04 18:13:19 +00:00
ABDULLAH 8239b914ba Arabic: rim term in the Lip help, Up/Down keys in the dimension step preferences, frame-rate note (#11870)
* Arabic: rim term and the shell-first step in the Lip help

* Arabic: Up/Down keys in the dimension step preferences, frame-rate note matches the English
2026-11-04 18:12:49 +00:00
Janiz-zzz e95946ac82 i18n(fi): translate the 822 messages Finnish lacks (#12036)
Added as assets/locales/pending/finnish-catch-up-2026-11.json so it
folds after merge: help texts, the redesigned Preferences (sketch,
navigation, dimension values, panel blur), fillet corner, setback and
turn options, threads, import report, browser and viewport messages.
cargo xtask i18n lists nothing missing for fi.

Co-authored-by: Janiz-zzz <267742026+Janiz-zzz@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 18:11:29 +00:00
cronos 46ce12b7f0 perf(ui): reuse assembly rendering caches during orbit (#2889) 2026-11-04 18:06:34 +00:00
austin62jake aba00427fa Render shots: input and output schemas for Duplicate, Rename and Remove (#11450) (#11451)
The handler's strict parameter type moves to schema/render_shots.rs as
ShotParams, with descriptions and JsonSchema, and becomes the contract of all
three commands; the handler reads the same type. It builds ShotChange instead
of a json! literal, and takes its operation as a ShotOperation enum.

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-04 18:02:53 +00:00
alfonsotames cccf8c1ece Snap points: a flat face offers its corners, edge middles and every hole's centre (#11476) (#11477)
* Snap points: a flat face offers its corners, edge middles and every hole's centre (#11476)

A flat face now offers its whole outline as snap points, read from the
exact faces and edges: every corner, the middle of every straight edge
and the centre of every round edge, holes included, as well as the centre
of its area. Corners on a closed circle's seam, or where the kernel split
one circle into pieces, are left out.

snap_points_from gives each point with where it came from (SnapSource):
the face it was picked on, the face's outward normal and a point inside
its edge, so a tool can keep the point by name (joint.create's edge,
corner and on) and turn a frame to the face. SnapPoint itself does not
change, so code that builds one keeps compiling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Snap points: a round face's end centres say which way their end faces (#11476)

The centres at a cylinder's or cone's two ends now carry a normal in their
SnapSource: the axis pointing out of that end, which is the normal of the
face a hole opens onto or of a pin's end. A joint origin taken from one can
then lie on that face, as the centres a flat face offers already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Snap points: a hole centred on its face keeps its own point and rim (#11476)

Snap points were one point when they lay at one place, whatever their kind,
so a hole centred on its face was lost behind the face's centre, and with it
the rim its point keeps. Now only points of one kind are merged: the face's
centre and the hole's centre both stay, and only the hole's has its rim.

SnapSource::normal's doc now says it is also the axis out of a cylinder's or
cone's end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Snap points: a washer's two rims keep a centre each (#11476)

Centres at one place are one point only when they are on one circle: the
inner and outer rims of a washer face now keep a centre each, with its own
rim, while the pieces the kernel split one circle into are still one point.

SnapSource::normal's doc now says that at a round face's end it is the
axis out of that end of the face, which at a blind hole's bottom points
into the material below, not out of it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Snap points: rims are told apart by their radii's size, not their place (#11476)

Two centres at one place were one circle when their rims' radii differed by
less than the place's tolerance, which grows with the distance from the
origin: 60 m out, rims of 4 and 4.05 counted as one and one lost its point.
The radii are now compared with a tolerance from the radii themselves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Snap points: nearby points stay apart far from the origin (#11476)

Points of one kind at one place were merged within a tolerance of 1e-6 of
their distance from the origin, 0.06 mm at 60 m, so two small holes there
whose centres are 0.05 apart lost one centre. Places now use 1e-9 of that
distance (0.06 µm at 60 m): well above the rounding of coordinates and of a
circle fitted to an imported edge, so a point found twice is still one, and
far below any feature. The radii keep their own tolerance.

The merge is its own function, so its test can give it points directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Alfonso Tamés <mufufu@Mufufu-MacBook-Pro.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 18:02:44 +00:00
Jackson Oursland fb80454368 User guide: window tour gets a numbered screenshot and a navigation clip (#10323)
* Book: a numbered window screenshot and a navigation clip, from a capture script

The window tour now opens with a screenshot of the real window, its parts numbered in the
order the page describes them, and a short looping clip of orbit, pan, zoom and Home.

examples/demo/doc_shots.py makes both, and any later figure: each shot is a function that
starts a fresh app (its own settings) under Xvfb, drives it over the control channel with
the demo's Demo driver, and writes a still (numbered callouts, palette-optimised PNG) or an
H.264 clip (the drawn pointer of overlay.py, short button labels, idle cut by trim_idle.py)
into docs/book/src/media/. CONTRIBUTING.md says how to redo a figure when the UI changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* doc_shots: clips keep a moment on each result; the window tour again on 0.29.0

trim_idle.py takes --hold S, the seconds of each idle stretch to keep (default 0.1, as before,
so the README demo is unchanged). The guide's clips keep 0.8 s, so a reader can see what each
step did before the next begins. The window screenshot and the navigation clip are made again
with it, on SolidCraft 0.29.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 17:33:39 +00:00
Dahak Builds f92e16fa25 Keep orbit gizmo drag tracking past the window edge (#9943) (#9978)
* Claim #9943: keep orbit gizmo drag tracking past the window edge

* Warp the orbit gizmo drag back to the window centre at the edge (#9943)

---------

Co-authored-by: Dahak Builds <dahakbuilds@users.noreply.github.com>
2026-11-04 17:16:33 +00:00
Dahak Builds dcbedbd805 Don't blindly reopen a design that stopped the last session (#5064) (#10443)
A design that crashes or hangs the app while it is being reopened was
reopened blindly every launch, bricking the app each time. A launch that
reopens designs now marks them in the recovery folder; the marker is
cleared as each design finishes opening. A launch that finds the marker
left behind skips those designs once and says which one the last session
stopped on, so the app starts usable and the loop breaks.

Co-authored-by: Dahak Builds <dahakbuilds@users.noreply.github.com>
2026-11-04 17:16:15 +00:00
Dahak Builds 9bb216a357 Ribbon: only switch the tab when a command actually starts (#10540) (#10549)
* claim: #10540

* Ribbon: only switch the tab when a command actually starts (#10540)

select_command_tab ran before the command's own checks, so a command that
only reports a missing parameter or nothing to work on still moved the
ribbon. The ribbon now moves when the command starts and a refused command
puts the tab back, as a disabled command already never leaves it. View
display toggles and choices menus keep the ribbon's tab however they are
started, matching F6, the navigation bar and the view cube.

Written by Qwen.

* rustfmt (#10540)

Written by Qwen.

---------

Co-authored-by: Dahak Builds <dahakbuilds@users.noreply.github.com>
2026-11-04 17:16:09 +00:00
github-actions[bot] fd9b3fd9f2 Regenerate generated files and fold pending files [skip ci] 2026-11-04 18:00:54 +00:00
Mateusz Sych 6488a540c9 Windows: a lost graphics device restarts the app instead of crashing (#10240) (#11109)
* claim: #10240

* Lost GPU: a loss met by a queue write restarts the app instead of crashing (#10240)

The per-frame probe (#6528) finds a device the driver reset before the
frame's uploads, but the driver resets a device at any moment: a reset
that lands after the probe is still met first by a queue write or the
present, and wgpu-core unwraps the driver's Lost there
(PendingWrites::activate) instead of losing the device. That panic
ended the app and wrote a crash report.

- egui-wgpu: the painter runs each frame under DeviceLost::survive. A
  panic the frame meets is taken for the loss once the probe then finds
  the device lost (the probe's path loses the device and runs its lost
  callback); the painter draws nothing more and the app restarts as for
  any lost device, keeping unsaved changes for recovery. Any other panic
  carries on unwinding.
- Crash reports: a panic inside wgpu-core that unwraps Lost is the
  device loss, not a bug, and is not reported. A command that meets it
  fails; the next frame's probe restarts the app.

---------

Co-authored-by: MateuszSychXpl <151755914+MateuszSychXpl@users.noreply.github.com>
2026-11-04 17:15:58 +00:00
froglemonade2 3e70ad9876 View navigator: right-click to choose Axes, Cube or a Custom body (#10266)
* View navigator: a custom body as the navigator, and a right-click menu to switch types

A right-click anywhere on the view navigator opens a menu with its three types: Axes, Cube and
Custom. Custom opens the Custom View Navigator panel (a feature panel with OK and Cancel): pick a
body in the view, its texture (Themed: the cube's colours; Modeled: the body's own appearance and
the view's edge colour), and whether the cube's rotation arrows and Home button go around it. The
navigator previews the panel's choices while it is open; Cancel leaves it as it was.

The custom navigator draws the body at the cube's size through a small depth-buffered raster, so
hidden faces stay hidden; hovering a face highlights it, a click looks straight at it (and frames
the model with navigator_fit on), a drag orbits. Until a body is chosen it draws the cube.

The body is kept as a packed snapshot (16-bit, base64) with the preferences and in settings
profiles, so it stays across runs and designs and travels with an exported profile. Bodies over
10,000 triangles, and long or flat ones (thinnest width under a fifth of the widest), are refused.

New command view.navigator (style, body, texture, arrows, home) does the same without opening
anything; new preferences navigator_texture, navigator_arrows and navigator_home, and a Custom
choice for navigator_style. Defaults are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Custom view navigator: a hovered face in Modeled takes the view's selection colours

In the Modeled texture the face under the pointer is filled and outlined the way the view selects
a face of the model (sel_face, sel_edge), not in the cube's hover blue and accent, which Themed
keeps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Custom view navigator: a hovered face in Modeled lights up as the view's mouse-over does

The face under the pointer keeps its own colour, a little lighter (hover_face_lift) and still
shaded, with its edges in the view's mouse-over edge colour (hover_edge), as the 3D view shows a
face under the pointer; not the selection colours. Themed keeps the cube's hover blue and accent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Custom view navigator: rotation arrows and Home on by default

navigator_arrows and navigator_home start on, so a new custom navigator has the cube's arrows and
Home button around it; the Custom View Navigator panel turns either off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Custom view navigator: the strings in every complete language, and test fixes

- The new messages in Arabic, Hebrew and Vietnamese (complete catalogs, like Japanese and Chinese).
- The navigator's raster goes through one colour helper, listed with its reason among the files
  allowed colour literals (the design's appearance shaded into pixels).
- nav_settings joins the requested-icon manifest (the view.navigator command's icon).
- A visible edge piece is kept only when the stretch seen with it, across the edge's segments, is
  at least two samples long: a hidden edge no longer shows a sliver at a silhouette corner.
- The navigator layout test treats Custom without a body as the cube it draws; the panel and
  size tests no longer assume an empty undo list, the style before opening, or a coarse sphere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Custom view navigator: profiles carry its texture, arrows and Home

Settings profiles keep a fixed set of preference keys (#9907), which the custom navigator's newer
settings are not part of. They travel in the profile's own `view_navigator` entry, next to its
body (`view_gizmo`): captured, checked (a value this version can't read is left out) and applied,
leaving the fixed key set unchanged. The cube's arrow inversion (#10286) applies to the custom
navigator's arrows too, through the shared arrows().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Custom view navigator: follow main's Vec3 move and fallible world_state

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Custom view navigator: list view.navigator in the rig's EXEMPT, refuse a stored body that can't save again, right-click without a widget over the navigator

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Custom view navigator: keep the body unless picked again, save only a profile that reads back, no navigator menu through a popup

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Custom view navigator: refuse a stored body with a triangle past its points

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Custom view navigator: a stored body meets the triangle and aspect limits a picked one does

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Custom view navigator: a body at the 5:1 limit stays inside it once packed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 17:12:27 +00:00
Igor Bronovskyi 30842efb22 Ukrainian: translate the 174 messages main gained after the 3 November sync, panel layout and the redesigned preferences included (#11064)
* i18n(uk): translate the 80 messages main gained after batch 11

* i18n(uk): translate the messages main gained after 2 November

Add Ukrainian for the 158 English messages upstream added since the last
sync, and update 10 existing translations whose English text changed.

The new messages go in assets/locales/pending/uk-sync-2-nov.json, as the
locale files are not edited for new messages. The changed English text is
updated in assets/locales/uk.json, because a pending file cannot change an
existing message.

* i18n(uk): translate the messages main gained after the 3 November sync

Add Ukrainian for the 174 English messages upstream added since the last
sync, and update 56 existing translations whose English text changed.

The new messages go in assets/locales/pending/uk-sync-2-nov.json, as the
locale files are not edited for new messages. The changed English text is
updated in assets/locales/uk.json, because a pending file cannot change an
existing message.

* i18n(uk): apply CodeRabbit review fixes

Use the catalog's established wording: 'вибрати' in the keyboard hint,
name the linked component in the double-click help, and use the command
labels 'Упор', 'Бобишка' and 'Клацкове з'єднання' in the placement group.

* i18n(uk): use "Защіпкове з'єднання" for Snap Fit

The catalog called the plastic snap-fit joint "Клацкове з'єднання", a
calque of "snap". Use the standard "Защіпкове з'єднання" and
"защіпковий гачок" in the command label, help, sample description and
the design tools placement group. The drag hint already said "защіпку".

* i18n(uk): replace calques and outdated terms

Use "збіг" for coincident, "виступ" for lip, "ступиця" for hub, "шаблон" for preset, and "наддискретизація" for supersampling. Render and panel host texts now say "рендерер" or "середовище"/"вікно" instead of "хост".
2026-11-04 17:05:44 +00:00
Colin Faulkingham 549aef17a5 Changing anti-aliasing no longer resets the saved window system (#10116) (#10147)
* claim: #10116

* fix: preserve the saved window-system preference at startup

* fix: preserve graphics preferences in safe mode
2026-11-04 16:57:30 +00:00
Daniel 4d738cd210 Sketch: an ellipse is drawn with its axes, and D measures its half-axes (#9291) (#9292)
* Sketch: an ellipse comes with its axes, and D measures its half-axes

An ellipse could only be sized by its minor radius, drawn like a circle's
radius, and there was no way to give its full axes. sketch.ellipse now also
adds the major and minor axes as construction lines through the centre.
The major axis runs from the major end to the point opposite it; the minor
one is perpendicular to it, ends on the ellipse, and both are bisected by
the centre. That adds six coordinates and six equations, so the ellipse
keeps its five degrees of freedom, and it needs no new constraint kind and
no format change.

With the axes in place every ellipse size is an ordinary dimension. D on an
axis line gives its length, the whole axis. D on the outline gives a half-
axis, the distance from the centre to an axis end, chosen the way a line
chooses horizontal or vertical but in the ellipse's own frame: text pulled
across the major axis measures along it (the major half-axis), text pulled
out past an end of it measures across it (the minor one). The end on the
text's side is used. Near the boundary between the two, a dimension being
placed keeps the half-axis it had (sketch.dimension's previous_axis, which
the Dimension tool sends), so the preview does not flip. A half-axis and
its whole axis determine each other, so the second becomes a driven
dimension through the existing redundancy path.

Deleting the ellipse leaves its axes, as deleting a Center Rectangle's
edges leaves its construction diagonals. Ellipses without axes, from
existing designs, keep the minor radius as before, and type radius still
gives it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Guide: an ellipse's axes and half-axis dimensions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: test that an ellipse's half-axis preview keeps its axis near the boundary

The Dimension tool sends the half-axis its last preview chose, so near the
boundary between the major and the minor half-axis the preview keeps it.
This covers that path from the tool, from both sides of the boundary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: an ellipse's axes select and drag with it, as a rectangle's diagonals do

A double-click on a Center Rectangle's edge or diagonal selects its edges
and both diagonals, and dragging a diagonal moves the rectangle without
changing it, because its lines share corner points. An ellipse's axes are
held by constraints instead, so a double-click selected only the ellipse
(and Delete then left the axes behind), and dragging the major axis moved
the ellipse but stretched its minor half-axis.

Sketch::ellipse_axes now finds an ellipse's construction axes (the
detection sketch.dimension already used, moved into the sketch crate).
Sketch::chain treats an ellipse and its two axes as joined, so a
double-click on any of them selects all three. Dragging either axis moves
the ellipse and both axes as one, keeping both half-axes. Dragging the
outline still sets the minor half-axis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: a corner test reads its line's id instead of assuming l1

sketch.ellipse now adds two axis lines, which take the first line ids, so
the extend test reads the id of the line it draws from the reply.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: an ellipse's axes cut a trim, as a Center Rectangle's diagonals do

Trim, extend and break take every other curve as a cutter, construction
lines included, so an ellipse's construction axes stop them as a Center
Rectangle's diagonals do. A test now states it for both shapes, and the
guide says it. The freeform cutter test keeps the axes it used to delete
and asserts the piece a trim removes: from where the major axis crosses
the circle to where the ellipse does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: test dragging an ellipse's outline with its axes present

Dragging the outline sets the minor half-axis, and the minor axis line,
held on the ellipse at one end, follows it; the centre and the major
half-axis stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: other dimension types on an ellipse with axes keep the minor radius

Only auto, major and minor give a half-axis on an ellipse drawn with its
axes. Any other type (radius, diameter, horizontal and the rest) gives
what it gives on an ellipse without axes, as the parameter doc says,
instead of quietly becoming a half-axis chosen by the text. The arm for
a missing text_at is dropped: with no text the rule already picks the
minor half-axis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: test an ellipse's half-axis dead zone from the major side too

The tests only showed a previous minor half-axis being kept near the
boundary; the point they used on the major side is major by geometry
alone. A point inside the band where geometry says minor now shows a
previous major half-axis kept, in the engine and in the Dimension
tool's preview.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: a placed ellipse half-axis is the one its preview showed

On an ellipse already sized, a half-axis is added as a driven dimension
on the click, and that command left out the half-axis the preview kept
near the boundary, so the click could place the other one. It now
passes it as the preview does.

The remembered half-axis also comes only from a draft whose text was
placed (one without text is the minor half-axis by default and biased
the first placement), is kept per sketch as well as per picks, and is
forgotten once a dimension is placed or the picks are cleared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: say how an ellipse's axes are recognised and what that costs

The axes are read from the constraints, with no mark in the design, so
the doc comment says which lines count, that deleting the midpoint or
point-on-curve constraint leaves an ellipse without axes, and that each
lookup scans curves times constraints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: an ellipse with one axis deleted still picks its half-axis by the text

With one construction axis deleted, D on the ellipse fell back to the minor radius wherever the
text was pulled, because the half-axis choice needed both axes. It now reads what is left of
them and chooses as before: the major half-axis goes to the major end (also from the far side,
when the point opposite is gone with its line), the minor one to its axis end, or as the minor
radius when the minor axis is the one deleted. An ellipse with neither axis keeps the minor
radius.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: the one-axis half-axis test checks what is measured to

The test for an ellipse with one axis deleted checked only the reply's axis and value, which
both ends of an axis give alike. It now checks the dimension's kind and end: the axis end on
the text's side, the major end from either side once the point opposite is gone, a radius once
the minor axis is. With the major axis deleted and no text the reply names the minor axis and
measures to its end, where it used to be a radius with no axis named.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: an ellipse's minor radius is drawn as its half-axis, without R

A radius on an ellipse is the minor half-axis, and it was drawn as a circle's radius: one
leader from the centre towards the text, marked R, which measures nothing a reader can see.
It is now drawn as the distance from the centre to the minor axis end on the text's side,
the way the half-axis is drawn while the ellipse has its axes, and labelled with the length
alone. This is what D gives once the minor axis line is deleted, and on an ellipse with no
axes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: an ellipse's half-axis keeps a radius's stored text

The half-axis frame read the stored text from the middle of the half-axis, so a radius placed
on an ellipse in an existing design would show its text somewhere else. The text is stored from
the centre again, as a radius's always was, and the side drawn to follows it. An unplaced one
sits where a linear dimension to the minor axis end puts its text, and stacked texts step out
from the centre as a radius's do. A view test reads the painted label, so the drawing cannot
go back to R unnoticed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: an ellipse moved, turned or scaled takes its axes along

Move, Sketch Transform and Scale moved only the curves picked, so an ellipse moved without its
axes left them where they were: its centre no longer halved them, the minor end left the
ellipse, and the sketch stayed unsolved. A Center Rectangle's diagonals share its corners and
always go along; an ellipse's axes share only the major end. The axes now go with the ellipse,
as they do when it is dragged. Copy is unchanged: it copies no constraints, for a rectangle
either.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: a preference draws ellipses without their axes, as before

Drawing an ellipse with its construction axes changes what the Ellipse tool makes out of the
box, so the old ellipse stays one setting away: Preferences › Sketch › Draw ellipses with their
axes, on by default. Off, the tool draws the ellipse alone. sketch.ellipse takes axes: false
for the same, and keeps drawing the axes when it is not given.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: sketch.ellipse refuses an axes value that is not true or false

A string such as "false" was read as not given, so the axes were drawn; it is now refused as
the text commands refuse a non-boolean bold or italic. The move test also covers an ellipse
whose minor axis was deleted: the major axis left goes along.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: D picks a half-axis on an ellipse without axes too

An ellipse with no axis lines (both deleted, a mirrored copy, one from an older design) gave the
minor radius wherever the text was pulled, so its major half-axis could not be dimensioned on
it. The half-axis is now chosen by where the text is on every ellipse: the major one to the
ellipse's own major end, the minor one as its minor radius. With no text it is the minor
radius, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: with one half-axis dimensioned, D on the ellipse gives the other

D on an ellipse chose the half-axis by where the text was pulled even when that half-axis was
already held by a dimension, so the second D usually guessed the one already there and was
refused as over-constrained. With a driving dimension already on one half-axis (to an axis
end, the minor radius, or the whole axis along its line or between its ends), D with no type
now gives the other, in either order and with or without the axis lines. With both held it
chooses as before; an explicit major or minor is kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: the held half-axis rule is documented and its cases tested

The Dimension command's parameters and the guide now say that with one half-axis held, D on
the ellipse gives the other. Tests cover the whole axis held as a distance between its ends
and as its line's length with the other axis deleted, and check that a mirrored ellipse has
no axes. The placement test undoes its first dimension, so its second half still tests where
the text is rather than the held half-axis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: Transform previews an ellipse with its axes

OK in Sketch Transform moves, turns and scales an ellipse's axes with it, but the window drew
where OK would leave only the picked curves, so the axes stayed put in the preview until OK. An
ellipse picked alone is now drawn with the axis lines it has.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: the typed-radius ellipse test counts the ellipse's axes

Main's #10282 test drew an ellipse with typed radii and expected one curve; with the
ellipse_axes preference on by default the tool also draws the two axes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: an ellipse's remaining axis still drags and selects it

With one axis deleted, dragging the other axis did not hold the ellipse (with the minor axis
left, the drag squashed it), and a double-click on the ellipse or that axis selected only the
one curve. The drag and Sketch::chain now read whichever axes are left through
ellipse_axis_lines, as Transform and Move already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: drop the unreachable third arm of the held half-axis check

A distance from the centre to the major end or the point opposite it is already matched by the first arm, so the third arm and its major_end closure never ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: D on an ellipse's axis line is the whole axis wherever the value is pulled

An axis line took the free line's rule, so on a turned ellipse a value pulled beside or above the box the axis spans gave its horizontal or vertical distance. An ellipse's axis is a construction axis, so auto now always gives its length, which the held half-axis check already counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: an ellipse's axis is never a side of a Fillet or Chamfer corner

A line drawn from an ellipse's major end shares that point with the major axis, so Fillet or Chamfer there took the two as a corner (two lines skip the construction filter) and rounded the line into the axis. The axes are left out of a corner, picked by its point or as a and b.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: test the move reply, extend and the one-axis Transform preview for ellipse axes

The reply of sketch.move, sketch.transform and sketch.scale lists the axis lines, Extend stops at an axis, and Sketch Transform previews an ellipse with the one axis left after the other was deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: with Draw ellipses with their axes off, D on an ellipse is its minor radius as before

The preference brought back the old drawing only; D on an ellipse had changed with no way back. sketch.dimension takes half_axes (default true, refused when not true or false); false makes auto on an ellipse the minor radius wherever the text is. The Dimension tool and the context menu's Sketch Dimension pass it from the preference, and with it off a radius on an ellipse is drawn and labelled R as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: read an ellipse's axes in one pass over the constraints

ellipse_axis_lines scanned every constraint for every curve, so 500 ellipses with their axes (1500 curves, 2000 constraints) took 1.6 s to read and Move on all of them 2.0 s. It now collects the lines the centre bisects first: 3 ms and 0.36 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: the dimension and corner parameters say how an ellipse's axis lines take part

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Preferences: Draw ellipses with their axes says D gives the minor radius when off

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: ask only the ellipses centred on a line's midpoint whether it is their axis

is_ellipse_axis read every ellipse's axes to answer for one line. An axis is bisected by its ellipse's centre, so it now asks only the ellipses centred on a point that bisects the line. The answer is the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: a horizontal or vertical dimension across a level major axis holds it for D on the ellipse

half_axes_held counted a distance, a length and a radius, but not a horizontal or vertical dimension across the major axis, which is its length when the axis lies that way. D on the outline could then take the held major half-axis and be refused as determined; it now gives the minor one. Across a slanted axis such a dimension is only a projection and does not count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Dimension: a draft on an ellipse is drawn with the axes preference it was made with

The frame read the preference as it is now, while the dimension added is the draft's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: a horizontal or vertical dimension across an upright minor axis holds it too

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: drop the unused Sketch::ellipse_axes; ellipse_axis_lines says how the axes are read

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: an ellipse's own axes do not cut it, so Trim takes a lone ellipse whole and stops at real crossings

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: Fillet and Chamfer offer no corner at an ellipse's axis end, as the engine takes none

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: a deleted ellipse leaves its centre on its axes, as a Center Rectangle's centre stays

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: ellipse axis docs say what they do, and the corner picker tests a curve's ends before its axis role

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: the trim-at-a-crossing test checks that part of the ellipse is left

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: an ellipse axis moved, turned or scaled on its own takes its ellipse along, as a drag does

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: a selection dragged by an ellipse axis takes the ellipse along, as the axis alone does

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Docs: the Sketch preferences page lists Draw ellipses with their axes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: the ellipse axes help text says D gives the minor radius, drawn and labelled R as before, wherever the value is pulled

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 16:54:46 +00:00
github-actions[bot] 1cfe77bb85 Regenerate generated files and fold pending files [skip ci] 2026-11-04 17:13:13 +00:00
Nathan Dane e3f99de8af Onyx: a tactile stone-grey theme with broad subtle blur (#10338)
* Onyx: add the finished stone-grey theme and document its blur range

* Onyx: distinguish grey construction lines from gold dimensions
2026-11-04 16:35:28 +00:00
ReDead 40b1b70dec Shell: pick a body from the Browser for a closed hollow (#794) (#11441)
* claim: #794

Co-authored-by: ReDead <ReDead@users.noreply.github.com>

* Shell: pick a body from the Browser for a closed hollow (#794)

Faces/Body accepted only faces, so a Browser body click never filled the
Shell dialog. Accept bodies, build faces:[] with that body, restore empty-face
shells as a body pick, and keep the chip/highlights on the body itself.

Co-authored-by: ReDead <ReDead@users.noreply.github.com>

* Shell: refuse faces that sit on a different body than the Browser-picked one

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: ReDead <ReDead@users.noreply.github.com>
Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 16:01:35 +00:00
github-actions[bot] 0862f1679a Regenerate generated files and fold pending files [skip ci] 2026-11-04 16:25:53 +00:00
austin62jake 2cd54b6af9 Agents and scripts: the standard part commands describe their exact parameters and reply (#11003) (#11004)
* claim: #11003

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Standard parts: input and output schemas (#11003)

parts.library, parts.insert, parts.fastener and parts.resize get typed
contracts and reply types in schema/parts.rs and leave unconverted.txt.
Each key reads as the handler reads it, with its message; the replies
are built from PartsLibrary, InsertedPart and ResizedPart, with the same
JSON as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Standard parts schema: Vec3 comes from solidcore_record

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Standard parts schema: hole picks must start with a list

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* parts.insert schema: the first hole pick must be a point, not any list

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
2026-11-04 15:30:52 +00:00
N3MI-DG c9c063620a Hole: Bridged option for counterbores (#11103) (#11104)
* claim: #11103

* Hole: Bridge option for counterbores (#11103)

A counterbore hole takes an optional `bridge` length: two 3D-printing
layers that thick below the counterbore's floor, a slot along X across
the counterbore and then a square, both 0.02 mm wider than the hole, so
a printer bridges the step instead of sagging into it. Empty (the
default) keeps a plain counterbore.

The clearance keeps the bore, cut straight through both layers as for a
plain counterbore, clear of their sides: at exactly the hole's width it
ran tangent along them and broke through. The command and the geometry
refuse a layer that is not a positive length, layers that don't fit in
the hole below the counterbore, and a bridge on any other hole type.

The Hole dialog shows a Bridge field below Drill Point for counterbores.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Hole: translate the Bridge label for the complete catalogs (#11103)

Arabic, Hebrew, Japanese, Vietnamese and Chinese carry every English
message, so `cargo xtask i18n --check` needs the new label in each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Hole: bridged counterbores refuse layers past a through hole's exit, too narrow a counterbore and a malformed bridge (#11103)

- Through all, the second bridge layer must end inside a body (exact point classification),
  short of the exit face; the tool's reach is no measure of the material.
- A bridged counterbore must be at least 0.04 mm wider than the hole, so the slot's ends have
  room on its wall (no square root of a negative number reaches the extrude).
- `solid.hole` refuses a `bridge` that is given but not a length expression (`true`, `[]`, `""`)
  instead of making a plain counterbore; `null` still leaves it out.
- Loop2 and Seg2 now come from solidcore_record (main moved them).
- The "nothing saved" check looks for the `"bridge"` key: `format_pending` names
  `bridged-counterbore` in every design.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Unit defaults test: solid.hole has the bridge field too

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
2026-11-04 15:24:15 +00:00
Nathan Dane 9060abc83e Sliders: keep the parent material clear beneath the track (#10375) 2026-11-04 15:17:54 +00:00
austin62jake bec762fb2b Agents and scripts: the render library browsing commands describe their exact parameters and reply (#11443) (#11444)
* claim: #11443

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Render library: input and output schemas for List, Describe, Targets and Preview (#11443)

Describe, Targets and Preview read their strict parameter types from
schema/render_library.rs, which become their contracts. List keeps its two
readers (the physical profiles' takes availability: null, the other
catalogs' doesn't); its contract takes what either takes. The handlers build
LibraryPage, LibraryResource, LibraryTargets and LibraryPreview instead of
json! literals; a catalog resource is read into ResourceSummary through a
small Listed reader. The physical profiles' replies keep their JSON, which the
schemas describe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Render library schema: the list says which availability each catalog takes

render.library.list has two readers: the physical profiles' takes
availability all, usable or null; the other catalogs' (and a call
without kind, which lists surfaces) take all, usable, specification or
blocked, but not null. The schema now says so with an anyOf on kind.
The type still takes what either reader takes: the readers check the
query and the page before availability, so refusing it in the type
would change which message a call with two mistakes gets in strict.
A new test checks that the schema takes ten calls exactly when the
handler does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-04 14:50:44 +00:00
leValdemar19 826fce68eb Assembly: Move Occurrence says when the part's joints put it back (#11723) (#11791)
* claim: #11723

* Assembly: Move Occurrence says when the part's joints put it back (#11723)

A part that rigid joints hold to something grounded was moved, then put
back by the joint solve after the command, while occurrence.move still
replied with the moved transform. occurrence.move now solves the joints
before it replies. When they put the part back, the reply gives where the
part is, adds reverted: true and a warning that names the joint holding it
and what to change instead. A free chain of parts follows the move as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Move Occurrence: the warning names the joint for a part in a repeated assembly too (#11723)

A part inside an assembly placed more than once has no path of its own, so
the reverted-move warning asked for one instead of naming the joint. It now
looks at the placement the caller named, or else the first one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Move Occurrence: list the part's joints when no single joint holds it back (#11723)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 14:39:17 +00:00
SS-EN 73f50d7bb4 Viewport: hidden parts no longer draw their joint-origin triads (#11294)
* Viewport: hidden occurrences draw no joint-origin triads

A named joint origin's triad (red/green/blue axes, white dot) was drawn for every
origin, so hidden inserted hardware still showed one at its placement. It now
follows the occurrence's visibility (and its parents') and the Joints folder of
the design and of the placement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Viewport: a copy's joint-origin triad follows that copy's visibility

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 14:24:55 +00:00
github-actions[bot] d1927aac25 Regenerate generated files and fold pending files [skip ci] 2026-11-04 13:33:45 +00:00
Brett Lawson b224ad6dae Kernel rig: the Lip refusal case matches the reworded message (#10871) (#11937)
#10871 reworded Lip's refusal on a face that is not a shelled rim to
"Lip needs the rim of a shelled body: ...", but the plastic rig case
cov-lip-on-a-face-without-an-opening-refused still looked for "pick the
rim face of a shelled body". The case now matches the new message, so the
kernel rig's plastic shard passes again on main.


Claude-Session: https://claude.ai/code/session_01SdcgEu4Lr3moCCisdZShKz

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 12:49:40 +00:00
bherbruck ca10e02573 Russian: correct the plural of degrees of freedom and make two notes match English (#11856)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 12:42:56 +00:00
bherbruck 5500681d6a Brand kit: logo files and a short brand guide in assets/branding (#9117)
Adds assets/branding/logo with the static mark (colour, one-colour
black and white), transparent 512/1024/2048 px PNGs, an outlined
wordmark and a horizontal lockup, all drawn from the app icon's
blue cutout layer. assets/branding/README.md covers use, colours,
clear space, minimum size and the name.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 12:36:16 +00:00
bherbruck fabeaa329a Desktop app: closing a design stops its kernel work, and designs build the same on any kernel (#11771)
* Desktop: closing a design stops its kernel work; same result on any kernel

A design's jobs now run under a stop token that closing or replacing the
design fires: an operation under it refuses to start, and one running ends
at solidcore's next check. The kernel it ran on is not used again. Calls
that answer from a body itself always finish, since a stopped call can leave
what it borrows half-changed, and what fills a body's shared cells is not
stopped.

Every kernel call starts clean (the same random rays, no stations from
earlier calls), so a design builds the same on any kernel of the pool, down
to its B-rep records. The pool is bounded: at most 8 kernels wait between
calls, and at 256 running calls a new call fails rather than grow or wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Stop tokens: a copy never stops its design; a stopped job can't decide a refusal

A copy replacing its own design stopped the token it shares with the design
it came from, so that design's later work would be refused. Only the design
itself stops it now. Which face a refusal names no longer depends on whether
the job that found it had been stopped: the refusal is kept with the body,
and a stopped job's probes were all refused, which named the wrong face.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 12:35:39 +00:00
PeppaWutz 8f67c7fb95 Sketch: constraint icons stay while the sketch fills the view (#10518) (#11399)
* Sketch: constraint icons stay while the sketch fills the view (#10518)

Constraint glyphs hid as soon as a millimetre of the sketch plane drew smaller than two pixels
(#8980), whatever the sketch's size, so a 500 mm sketch zoomed to fit lost every glyph although
it still filled the view. Below that scale the glyphs now hide only while their anchors span
less than twenty glyphs (300 px) on screen: a small sketch far away still loses them, a large
one that fills the view keeps them. The preference "Hide constraint glyphs when zoomed out" is
unchanged; off, glyphs stay at every zoom as before.

Test: constraint_glyphs_hide_when_zoomed_out adds a 500 mm sketch that keeps its glyphs zoomed
to fit and loses them far away; glyph_zoom_tests covers the span threshold.

* Sketch: glyph span measures only drawn glyphs and stops at the threshold (#10518)

The span check now walks the same constraints the glyph pass draws (one MidPoint glyph per shared midpoint, a pattern's constraints once) and returns as soon as the bounds reach MIN_GLYPH_SPAN_PX, so a large sketch zoomed out costs no more than before.

* Sketch: filter glyph constraints lazily, midpoints in a set (#10518)

* Sketch: measure the sketch, not its glyph anchors, before hiding glyphs (#10518)

* Sketch: collapse the midpoint check into one if (#10518)
2026-11-04 12:06:26 +00:00
github-actions[bot] 6bca7d2854 Regenerate generated files and fold pending files [skip ci] 2026-11-04 08:13:26 +00:00
Frank eeb686f164 Measure: a circle and a line now show 'Line to centre' instead of 'Center to center' (#11524)
* Measure: a circle and a line show 'Line to centre' instead of 'Centre to centre'

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Measure: US spelling for Line to center, UK in en-GB

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 07:38:21 +00:00
Nathan Dane 9e3e403b3f Browser and History: keep row tools working when either panel is hidden (#11303) (#11416)
* claim: #11303

* Keep Browser and History row interactions independent

* Browser tests: use solidcore_record::Vec3 after the layer split

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 07:15:40 +00:00
dudedagger42 0231eec4c6 Nix flake: zenity on the app's PATH, for file dialogs without a portal (#2177) (#5183)
rfd opens file dialogs through the XDG desktop portal and falls back to zenity
when there is none. The flake's package didn't bring zenity, so on a system
without a portal or zenity, Open and Save showed nothing. The wrapper now adds
nixpkgs' zenity at the end of PATH, after the system's own.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 06:53:37 +00:00
erman 69f202f1c8 Measure: show complete point coordinates (#11069) (#11085)
* Measure: show complete point coordinates (#11069)

Render measurement item details as wrapping text instead of fixed-height cells. Keep the existing values, units and precision. Add a regression test in the existing measurement UI test module.

Local validation: the regression test compiled, but the Windows GNU test binary crashes with 0xc0000005 even for --list, before tests run. Runtime verification and visual evidence remain pending; this contribution is a draft.

* Keep repository LF line endings in the coordinate fix
2026-11-04 06:53:04 +00:00
austin62jake 1cbfb889d5 Agents and scripts: Compare Bodies describes its exact parameters and reply (#10994) (#10995)
* claim: #10994

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Compare Bodies: input and output schemas (#10994)

inspect.compare gets a typed contract and reply types in
schema/compare.rs and leaves unconverted.txt. Each key reads as the
handler reads it, with its message; `color` checks each colour with the
handler's own color_param, now pub(crate) and re-exported from cmd. The
reply is built from Comparison and its parts, with the same JSON.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Compare: drop the json import the typed reply no longer uses

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Compare schema: colour strings carry the hex pattern

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
2026-11-04 06:45:10 +00:00
thocsmith ee3cc32525 Settings profiles: export and import stay inside an agent's folders (#11362) (#11390)
* claim: #11362

* Settings profiles: export and import go through vfs, inside an agent's folders (#11362)

settings.profile.export and settings.profile.import read and wrote their
path with std::fs, so the folder scope an MCP request's allow_paths sets
up never saw it: an agent could write a profile anywhere, or probe any
path. Both now go through vfs (len, read_to_string, write), as file.export
and ui.screenshot do. requests_with_allow_paths_stay_inside_them covers
export and import inside and outside the agent's folders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: thocsmith <193096300+thocsmith@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 06:28:11 +00:00
Colin Faulkingham 954232cef1 AI client setup: preserve configuration files when a write fails (#11363) (#11410)
* claim: #11363

* AI client setup: replace configuration files atomically (#11363)
2026-11-04 06:27:37 +00:00
github-actions[bot] 9092df9b97 Regenerate generated files and fold pending files [skip ci] 2026-11-04 07:25:51 +00:00
semmelrinde c1a23f8f97 Section Analysis: the drag arrow is back when the dialog is reopened (#11423) (#11432)
Edit reopens the dialog from the section's own geometry (Show viewport
section status, on by default): the plane is kept as numbers and nothing
is picked. The arrow was placed from the first pick only, so it was gone.
With nothing picked, it now stands on the kept plane, its tip at the cut.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 06:11:46 +00:00
austin62jake 0fc4cd2747 Agents and scripts: the render stage commands (Ground, Backdrop, Clear) describe their exact parameters and reply (#11455) (#11456)
* claim: #11455

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Render stage: input and output schemas for Ground, Backdrop and Clear (#11455)

The three handlers' strict parameter types move to schema/render_stage.rs as
GroundParams, BackdropParams and ClearParams, with descriptions and
JsonSchema, and become the contracts; the handlers read the same types. The
handlers build the shared StageSaved reply instead of json! literals, and the
saved setup is serialized with an error instead of json!'s panic path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-04 06:11:09 +00:00
leValdemar19 6d83f95fba Isolate a body: other components are hidden as components, in one step (#7896) (#7951)
* claim: #7896

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Isolate a body: other components are hidden as components, in one step (#7896)

Isolating a body hid every other body one by one: browser.visibility with `items` writes only
hidden_bodies, so every other component's Browser row kept an open eye and normal text, and
its eye could not bring it back (the first click hid an already invisible component).

browser.visibility takes `isolate: true` with `items` (bodies), as it does with `paths`. The
picked bodies' own placements stay open, their other bodies (and the root's) are hidden one by
one, and every other placement is hidden as a placement. Isolate in the Browser and the view
runs that one command, so it is also one undo step instead of two.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Isolate a body: a hidden Bodies folder or group it is in shows again (#7896)

Isolating a body inside a hidden Bodies folder or group left that folder or
group hidden, so the picked body stayed hidden. Isolate now shows the
folders and groups (with the groups they are in) that hold the picked
bodies; their other bodies are hidden one by one as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Isolate a body: look for hidden folders only when some are hidden, and find body owners once (#7896)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 06:06:23 +00:00
austin62jake bf625dff05 Box, Sphere and Torus: clicking a point of a sketch places them there (#9403) (#9405)
* Box, Sphere and Torus: a sketch point picks where they go (#9403)

The Point input of the Box, Sphere and Torus windows took a vertex, a point on an edge or face
and the origin, but not a sketch's points, so a sphere could not be centred on a point drawn in a
sketch. It now takes the points of every shown sketch (POINTS | EXTERNAL_POINTS, as Measure
does): a click fills X, Y and Z with where the sketch puts the point in the world, and a point
selected before the window opens places the primitive there, as a vertex does. The input's chip
names the point and its sketch as Select Other does ("Point 2 · Marks").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Box, Sphere and Torus: the sketch point chip label for every complete locale

Main's i18n check wants each message in the complete catalogs (ar, he, ja,
vi, zh); the label has no words, so each carries the same "{point} · {sketch}".
With main's new selection kinds and this one, every Sel variant has its arm,
so the catch-all arm is unreachable (clippy) and goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Primitive at a sketch point: a point picked in the sketch being finished still places it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
2026-11-04 06:03:39 +00:00
semmelrinde ed3510a91f Typed schemas for the design properties commands (part of #2829) (#10920)
document.metadata, document.metadata.set and document.metadata.remove
get input and output schemas: contracts in schema/metadata.rs, checked
in front of the unchanged handlers, and reply types the handlers now
build their replies from. Their lines leave unconverted.txt.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 06:03:21 +00:00
github-actions[bot] 8f0130a61b Regenerate generated files and fold pending files [skip ci] 2026-11-04 06:39:31 +00:00
github-actions[bot] 72df682af7 Regenerate generated files and fold pending files [skip ci] 2026-11-04 06:27:43 +00:00
Davit Matchakhelidze 41a450be7c i18n: add Georgian (ka) interface language (#11501)
A Georgian catalog (assets/locales/ka.json) carrying every English message,
registered in crates/ui-egui/src/i18n.rs, with a row in the new-language test,
a pending attribution file and a terminology note in docs/localization.md.
The catalog is Mkhedruli only; egui's built-in Hack already draws it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 06:00:45 +00:00
HiroKenEz b227924be9 Render: the Cancel button keeps its full label during a render (#11222) (#11241)
* claim: #11222

* Render: the progress row keeps Cancel whole (#11222)

The progress card is an egui area, laid out within last frame's size. When
the status grew (9 % to 10 %, a longer phase or name), the caption and the
Cancel button were truncated, down to "..." with a long shot name.

progress_action now takes the name and the status apart and gives each part
an explicit width from the room the caller offers (the canvas for the
floating card): Cancel and the status always show whole, a long name is cut
with an ellipsis (full name on hover), then the meter narrows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 06:00:31 +00:00
Mateusz Sych 28b47059bb Agent chat: a text selection dragged past the edge scrolls the conversation (#11527) (#11533)
* claim: #11527

* Agent chat: a text selection dragged past the edge scrolls the conversation (#11527)

Holding a text selection near or past the top or bottom of the conversation
scrolls it, faster the further out, so a long answer can be selected in one
drag. egui scrolls a label's selection only for the label under the cursor, and
not at all for a table, whose label sits in its own horizontal scroll area.

egui also leaves a label out of the text selection while it is scrolled out of
view: a selection whose start had scrolled away was dropped, and Copy missed
the hidden text. The conversation's labels now take part out of view too,
clipped to nothing, so they keep their end of the selection and give their
text to Copy without being drawn or moving the selection.

* Agent chat: only a drag towards the edge scrolls the conversation (#11527)

A press on a label creates an empty selection on the press frame, so a click,
a double click or a held press on the line by the edge scrolled the
conversation, and so did the start of a drag from there inwards. Scrolling now
waits until the pointer has moved more than 8 points towards that edge since
the press.

* Agent chat: approval titles and pending messages keep a selection scrolled away

They were plain selectable labels, so a selection that started in one was dropped
once its label scrolled out of view, as in the rest of #11527. They now use the
same off-screen-aware label as the conversation's text.

---------

Co-authored-by: MateuszSychXpl <151755914+MateuszSychXpl@users.noreply.github.com>
2026-11-04 06:00:28 +00:00
Mateusz Sych a19a32ddd7 Interference: Compute checks in the background, so the window no longer freezes (#11483) (#11541)
* claim: #11483

* Interference: intersect and mesh each overlap on a kernel worker (#11483)

Compute in Inspect > Interference intersected each overlapping pair and
meshed the shared volume on the window thread. Its stack is 1 MiB on
Windows, too small for the kernel's recursion, so the app could close
without a crash message. Each pair now runs through
kernel::map_with_local_pools, on a worker with the kernel's 8 MiB stack,
as inspect.interference and inspect.clearance already do.

* Interference: Compute checks off the window thread (#11483)

On 0.30.0 the report's two parts took the window thread 95 s (x64) to
154 s (x86) in the overlap boolean, and the window stopped responding
until the app was closed. Compute now runs inspect.clearance and the
shared volumes on a copy of the session, on a kernel thread, when the
app runs commands off the window thread (as Find Limits does). The
dialog shows the elapsed seconds with Cancel meanwhile, and drops the
reply of a design changed since.

* Interference: Cancel on its own row while Compute checks (#11483)

---------

Co-authored-by: MateuszSychXpl <151755914+MateuszSychXpl@users.noreply.github.com>
2026-11-04 06:00:15 +00:00
Homero Thompson 606e264f6d UI: the Dependents button of the INSPECT HISTORY ribbon no longer fails without a feature (#11642) 2026-11-04 05:59:52 +00:00
semmelrinde d25f8198fa Pieces of a cut keep their names when the design is evaluated again (#11658)
A cut that leaves a body in pieces names them after their faces
(`order_lumps`): the piece whose least face name sorts first takes the
first name, and so on. It moved the names but left the pieces where the
kernel put them. The session then pinned the feature's body names in
that state order, and the next full evaluation (opening the design, or
editing a parameter upstream) handed them out again in a different
order: two pieces swapped names, and a later feature that named one met
the other. Found by a local model fuzzer.

The pieces now also take the family's places in name order, so the
names pinned are the order the next evaluation hands them out in. A
design saved before keeps the names a fresh evaluation gave it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 05:59:42 +00:00
Hainlein4711 464f4ac748 Intel OpenGL: restore the grid and sketch axes (#8053) (#11573)
* claim: #8053

* Intel OpenGL: restore the grid and sketch axes
2026-11-04 05:49:15 +00:00
semmelrinde 03b5248dc1 Sketch: Line and Construction Line refuse a second point next to the first (#11595)
A through-point 0.0000001 mm from the start made an infinite line whose
direction nothing held, and a Line that short had both ends connected to
the origin, a line of length zero. Both now refuse points closer than the
distance at which a new point is connected to an existing one.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 05:49:05 +00:00
Colin Faulkingham f9dd77e383 Configurations: reject invalid suppression values when saving rows (#9088) (#11571)
* claim: #9088

* Configurations: reject invalid suppression values before saving rows (#9088)
2026-11-04 05:39:04 +00:00
semmelrinde 4afd24d29f Design tabs: the tooltip says when a saved design has unsaved changes (#11408) (#11590)
* Design tabs: the tooltip says when a saved design has unsaved changes (#11408)

A tab marks unsaved changes with a bullet after the design's name, and a
long name cut short by the tab hides it. The tab's tooltip, which says
where the design is saved, now adds "Unsaved changes" below for a saved
design with changes not saved yet. A design never saved already says
"Not saved yet". The new string is in a pending locale file, with ten
translations taken from the same words elsewhere in the catalogs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Design tabs: the unsaved line in every complete catalog (#11408)

Arabic, Hebrew and Vietnamese are complete catalogs, which must carry
every English message: they get the words they already use for
"Unsaved changes" elsewhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 05:29:03 +00:00
kaltenbrunnermarkus 8a74336713 Tests: the autosave recovery test no longer fails at random on a busy machine (#11815)
* claim: Recovery: the save test waits for the autosave worker before it checks

* Recovery: the save test waits for the autosave worker before it checks

saving_drops_the_entry_and_a_clean_close_leaves_nothing marked the
session saved right after the tick that started an autosave. Under load
the worker was still writing, so the next tick found the write running,
took nothing up and dropped nothing; the file landed afterwards and the
check that it is gone failed (seen in CI on #9021).

The test now ticks, bounded, until the autosave has caught up
(Autosaver::caught_up), as the app's own frames would, before it marks
the session saved. A small helper in the test module does this. The
app's behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 05:22:20 +00:00
Colin Faulkingham 5e4c52a7cb Sketch Transform: keep the applied rectangle at the previewed rotation and size (#11617) (#11620)
* claim: #11617

* Sketch Transform: preserve dimensioned geometry on apply
2026-11-04 05:21:27 +00:00
github-actions[bot] 77e0e11775 Regenerate generated files and fold pending files [skip ci] 2026-11-04 05:42:40 +00:00
Lars Jansen 7bd66b7c06 Sketch dimensions: enter the value in a small window with step arrows (#7246) (#7251)
* claim: #7246

* feat(sketch): enter a dimension's value in a small window with step arrows (#7246)

* Dimension window: fit the layer split, and keep the wheel off the camera over the window

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 05:12:31 +00:00
Daniel 86db05e538 Sketch: regression test for a Line started on a snap point (#11171) (#11322)
* claim: #11171

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Sketch: test that a line starts on a snap point of an existing shape (#11171)

The Line tool's first click on a line's midpoint, a circle's centre or edge,
a rectangle's edge or a point part-way along a line starts the line there and
ties its start to that shape. In 0.30.0 and 0.30.1 the start was dropped on the
next hover (fixed by #11184); this covers each shape the reports name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 05:11:14 +00:00
ABDULLAH d912f3533b Arabic: better wording for Appearance, Graphics, Assistant, Layout, Sketch and Navigation preferences, thread drill notes and other messages (#11358)
* Arabic: viewport term in the Appearance section heading, desktop app badge, deeper-overlap note in Find Limits

* Arabic: drop the stray direction mark and match the Refresh wording in the old Node.js note

* Arabic: tanween in the thread fit hint, tap drill wording, crease term in continuity, spline label and setback wording in the fillet help

* Arabic: sweep and boolean terms in the body check note

* Arabic: badge term for the status chips note and summary wording for Fold items in Graphics preferences

* Arabic: tanween, catalog terms and clearer labels in the Assistant, Design and Tools preferences

* Arabic: tanween in the shortcut key prompt, Look At wording in the Assistant follow help

* Arabic: complete the Several choice for bodies folders and use a verb form for the dialogs Open row

* Arabic: orbit style term, Select Other and center-point arc names in Sketch preferences, place-from-origin wording, tanween in the radial menu help, tap makers in the tap drill notes

* Arabic: graphics device term in the blur notes, boss and turn wording in the fillet corner option
2026-11-04 05:10:29 +00:00
kaltenbrunnermarkus 9d7bbb7fa9 Tests: two Properties tests no longer fail at random on a busy machine (#11750)
* claim: Properties: hold the measuring worker in tests until the card is checked

* Properties: hold the measuring worker in tests until the card is checked

open_object starts the measurement on a worker and looks for the reply
once without waiting. Under load the window side could be held up
between the two, the reply was already in, and two Properties tests saw
the card filled where it should still be measuring (about 0.3 % and 4 %
of runs with 18 tests at a time).

measure_beside now runs a hold before sending the reply. In tests it
waits on the app's existing apply_gate, which feature evaluation already
uses for the same purpose; outside tests it does nothing. Both tests set
the gate, check the card is measuring, then let the worker go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 05:08:36 +00:00
leValdemar19 6312c2760a MCP list_commands: ask for commands by id prefix or panel, ids and labels only, or a page at a time (#11726) (#11788)
* claim: #11726

* MCP list_commands: ask for commands by id prefix or panel, ids and labels only, or a page at a time (#11726)

list_commands answered with the whole catalog, every key of 575 commands
(about 350 KB), and could only narrow it by a substring. It now also takes
`prefix` (start of the id), `panel` (a whole panel or tab name), `compact`
(id and label), `fields` (the keys to keep) and `limit`/`offset` (pages, as
{commands, total, offset, next_offset}). With none of them the reply is the
same as before. A batch step naming list_commands narrows the same way, and
a bad argument is an error that names it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 05:07:29 +00:00
SilentWolf75 3a23d21795 Lip: clearer guidance when the face is not a shelled rim (#10437) (#10871)
* claim: #10437

Co-authored-by: Cursor <cursoragent@cursor.com>

* Lip: say Shell first when the face is not a rim (#10437)

A solid box top left OK disabled with a vague shelled-body hint. Name Shell and the rim-around-an-opening requirement in the refusal, the dialog tip, and the command help.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Lip: keep the dialog hint as it was, match the new refusal text in the test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 04:42:08 +00:00
austin62jake e199f9aeff Agents and scripts: Match Surface describes its exact parameters and reply (#10981) (#10982)
* claim: #10981

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Match Surface: input and output schemas (#10981)

surface.match gets a typed contract in schema/surface_match.rs and the
shared FeatureResult as its output, and leaves unconverted.txt. Each key
reads as the handler reads it, with its message; like solid.scale it
declares `name` and `participants` itself, since a match makes no body.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Follow main's kernel merge: world_state and the shared continuity reader

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Surface match schema: Vec3 comes from solidcore_record now

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
2026-11-04 04:14:11 +00:00
austin62jake e06d6e36d8 Agents and scripts: the material card checks describe their exact parameters and reply (#11036) (#11037)
* claim: #11036

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Physical material property commands: input and output schemas (#11036)

material.properties.validate and material.properties.directional get
typed contracts and reply types in schema/material_properties.rs and
leave unconverted.txt. The card stays the handler's to check; the
direction has the handler's messages. The replies mirror the document's
Validation and DirectionalModulus, destructured in full.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-04 04:08:15 +00:00
Kai Evans 9d1ad9f0b9 Feature editor: OK accepts the joint placements a roll back re-solves (#11094) (#11095)
* Feature editor: a roll back's re-solved placements are not a changed design

Rolling the marker solves the joints again and stores where that puts each occurrence, so the
editor's pinned original differed from its source there and OK was refused with "the original
editor model does not match its source design". The check now takes the placements as the roll
leaves them.

* Feature editor: also accept the ratio and lift of coupled joints that rolling the marker works out

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 03:56:46 +00:00
austin62jake d39a2d28db Agents and scripts: the clearance check describes its exact parameters and reply (#11051) (#11052)
* claim: #11051

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Clearance: input and output schemas (#11051)

inspect.clearance gets a typed contract and reply types in
schema/clearance.rs and leaves unconverted.txt. Each key reads as the
handler reads it, with its message; MAX_CLEARANCE and MAX_NEAREST move
to the schema module so both read one limit. The reply is built from
Clearance and its item types, with the same JSON as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-04 03:44:59 +00:00
github-actions[bot] 1e649653ef Regenerate generated files and fold pending files [skip ci] 2026-11-04 03:44:17 +00:00
bherbruck 6988eb0043 CodeRabbit: flag changes to existing defaults (#11832)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 03:15:51 +00:00
Tyler Chiriboga 23c2244307 Inspect: center of mass reports the same volume as measure (#6173) (#11262)
* claim: #6173

* Inspect: center of mass reports the same volume as measure (#6173)

inspect.center_of_mass measured each body's display mesh, whose flat
facets cut curved faces short, so its volume and centre differed from
inspect.measure's (a sphere of radius 10: 4183.10 vs 4188.49 mm3). It now
takes both from the same cached kernel measurement Measure uses, and like
Measure it leaves out bodies that enclose no volume, counting them in
open_bodies_skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Centre of mass tests: read the skipped list that main now returns

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Tyler Chiriboga <18270301+Tyler-Chiriboga@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
2026-11-04 03:13:56 +00:00
semmelrinde a52ee850aa 15 languages: translate the 21 messages main gained after batch 4 (batch 5) (#8573)
* 15 languages: translate the 21 messages main gained after batch 4 (batch 5)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Pending locales: drop the strings the catalogs already have

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: bherbruck <brennen.herbruck@gmail.com>
2026-11-04 03:08:32 +00:00
bherbruck 65d23a78a5 Preferences: the 3D mouse speed readout shows × instead of garbled text (#11785)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 02:46:30 +00:00
312 changed files with 29789 additions and 1793 deletions
+20
View File
@@ -0,0 +1,20 @@
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
reviews:
auto_review:
# Dependabot bumps are checked by CI; skip CodeRabbit reviews on them.
ignore_usernames:
- "dependabot[bot]"
path_instructions:
- path: "**"
instructions: |
Project rule: don't change anyone's existing defaults unless the change is purely additive and belongs in the application.
Flag any change to something a user already relies on: a default setting or preference value, what a command or tool does when used the usual way, the UI's default layout or behaviour, a keyboard or mouse shortcut, or the result an existing saved design rebuilds to.
Don't flag purely additive changes: a new command, a new setting whose default keeps today's behaviour, or a new option that appears only when someone chooses it. Don't flag bug fixes that only turn a crash or an error into the result the feature always promised.
When you flag one, start the comment with "Changes a default:", say what a user sees before and after, whether a setting keeps the old behaviour, and whether the PR description's `Changes a default:` line says so.
pre_merge_checks:
custom_checks:
- name: "Existing defaults unchanged"
mode: "warning"
instructions: |
Pass if the pull request changes no default a user already relies on (default setting or preference values, what a command or tool does when used the usual way, the UI's default layout or behaviour, shortcuts, or the result an existing saved design rebuilds to), or if its changes are purely additive.
Fail otherwise, naming each changed default and what a user sees before and after. Also fail if the description says `Changes a default: no` while the code changes one.
+14 -1
View File
@@ -786,6 +786,19 @@ Original SolidCraft drawings, Open for owner review; no runtime assignments.
| tests/kernel-cases/import/4561-convert-box-mesh-with-a-zero-area-triangle/box-degenerate.stl | SolidCraft contributors | synthetic ASCII STL written by hand: a box with one zero-area triangle, for the kernel regression case of tangency-labs/solidcraft#4561 | MIT OR Apache-2.0 |
| assets/locales/pending/theme-blur-ui.json | SolidCraft contributors | Original blur controls, notices and translations | MIT OR Apache-2.0 |
| crates/ui-egui/tests/fixtures/theme-blur.json | SolidCraft contributors | Original theme for blur option scenarios and manager review | MIT OR Apache-2.0 |
| assets/locales/ka.json | David Machakhelidze (devius) | Original Georgian translation of SolidCraft's English catalog, written with Claude Code from the meaning of each English string; terminology and doubtful strings decided by a native Georgian speaker; no commercial CAD text used | MIT OR Apache-2.0 |
| assets/branding/logo/solidcraft-mark.svg | SolidCraft contributors | static SolidCraft mark: the five faces and gradients of assets/icons/app/macos/source/SolidCraft.icon/Assets/03-solid-blue-cutout.svg (the final frame of assets/styles/web/loading-logo.svg), cropped to the mark's bounds; original artwork | MIT OR Apache-2.0 |
| assets/branding/logo/solidcraft-mark-mono-black.svg | SolidCraft contributors | one-colour (black) version of assets/branding/logo/solidcraft-mark.svg, same paths; original artwork | MIT OR Apache-2.0 |
| assets/branding/logo/solidcraft-mark-mono-white.svg | SolidCraft contributors | one-colour (white) version of assets/branding/logo/solidcraft-mark.svg, same paths; original artwork | MIT OR Apache-2.0 |
| assets/branding/logo/solidcraft-mark-512.png | SolidCraft contributors | transparent 512 px render of assets/branding/logo/solidcraft-mark.svg (cairosvg); original artwork | MIT OR Apache-2.0 |
| assets/branding/logo/solidcraft-mark-1024.png | SolidCraft contributors | transparent 1024 px render of assets/branding/logo/solidcraft-mark.svg (cairosvg); original artwork | MIT OR Apache-2.0 |
| assets/branding/logo/solidcraft-mark-2048.png | SolidCraft contributors | transparent 2048 px render of assets/branding/logo/solidcraft-mark.svg (cairosvg); original artwork | MIT OR Apache-2.0 |
| assets/branding/logo/solidcraft-wordmark.svg | SolidCraft contributors | the name SolidCraft set like the loading logo's wordmark (bold, +0.02 em tracking, #15499e) in IBM Plex Sans Bold from assets/fonts/ibm-plex-sans (SIL OFL 1.1, IBM Corp.), outlined to paths; no font file is embedded | MIT OR Apache-2.0 |
| assets/branding/logo/solidcraft-lockup-horizontal.svg | SolidCraft contributors | assets/branding/logo/solidcraft-mark.svg beside assets/branding/logo/solidcraft-wordmark.svg, in the proportions of assets/branding/web/source/og.png; original artwork | MIT OR Apache-2.0 |
| assets/styles/ui/themes/onyx.json | SolidCraft contributors | original Onyx stone-grey palette, option overlays and semantic icon-role mapping; existing SolidCraft artwork is unchanged | MIT OR Apache-2.0 |
| docs/book/src/media/ui-tour/window.png | SolidCraft contributors | screenshot of SolidCraft 0.29.0 itself (`solidcraft --sample`, default dark theme, software renderer, 1280x800) with original numbered callouts (digits set in DejaVu Sans Bold), captured with examples/demo/doc_shots.py | MIT OR Apache-2.0 |
| docs/book/src/media/ui-tour/navigate.mp4 | SolidCraft contributors | original screen recording of the actual SolidCraft 0.29.0 English desktop UI (`--sample`, default dark theme, software renderer) orbiting, panning and zooming, with the original drawn pointer of examples/demo/overlay.py and labels set in DejaVu Sans Bold, captured with examples/demo/doc_shots.py | MIT OR Apache-2.0 |
| assets/locales/pending/sketch-tool-hints.json | carlymx | Original sketch tool hints and engine error translations | MIT OR Apache-2.0 |
## Code adapted from sibling projects
@@ -837,7 +850,7 @@ into THIRD-PARTY-LICENSES.txt when `main` regenerates it.
## FreeCAD and Rhino import library
FreeCAD `.FCStd` and Rhino `.3dm` files are read with [cadmpeg](https://github.com/cadmpeg/cadmpeg)
0.6.3 (Apache-2.0), linked as the crates `cadmpeg-core`, `cadmpeg-ir`, `cadmpeg-registry`,
0.6.7 (Apache-2.0), linked as the crates `cadmpeg-core`, `cadmpeg-ir`, `cadmpeg-registry`,
`cadmpeg-container`, `cadmpeg-codec-freecad`, `cadmpeg-codec-rhino` and `cadmpeg-codec-step`
in native and browser builds (`crates/io/src/native_cad.rs`). Only those open-format codecs are built: no
default features, so cadmpeg's codecs for commercial CAD formats and its ShapeManager/ACIS
+11 -1
View File
@@ -277,7 +277,7 @@ mean something else, it needs a format change. **Add one file, and edit nothing
change's file, or any `v<N>/` folder: those are fixed once released.
That's all. The build counts the files: while any are pending it writes the next format number,
which no release reads, so a release refuses a design that has your change instead of losing it.
which no release reads, so a release warns about a design that has your change and keeps what it can't read of it.
A file also lists the pending changes it has (`format_pending`), so a later development build
runs only the steps that file is missing. Two pull requests that each add a change merge without
a conflict. `crates/doc/src/format/pending/README.md` has an example.
@@ -472,6 +472,16 @@ the same area), first resolve the command registry and source conflicts, then ru
The generator tests cover stable ordering and additions that leave existing lines
unchanged. The initial switch to sorted rows is a one-time larger diff.
## Pictures in the user guide
The user guide's screenshots and short clips (`docs/book/src/media/`) are captured from the real
app by `examples/demo/doc_shots.py`, one function per figure. Each run starts a fresh app with its
own settings, so your preferences never show. When a change makes a figure out of date, run
`python3 examples/demo/doc_shots.py <page or shot>` (it needs Xvfb, ffmpeg, Pillow and a release
build) and commit the new file. A new figure is a new function there, an ATTRIBUTION row in
`attribution/pending/`, and a `<video>` (clips) or image link on the page. Keep a still under
about 250 KB and a clip under about 1 MB.
## Licence
By contributing you agree that your contribution is licensed as MIT OR Apache-2.0, like the rest
Generated
+14 -14
View File
@@ -564,9 +564,9 @@ checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
[[package]]
name = "cadmpeg-codec-freecad"
version = "0.6.3"
version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c4a8fa61748cbb3ce80838b00a8cebfe553460583941f5aba6e2b97c16b4d37"
checksum = "6fe0ed1935ace2c203b87107a064818dec2bb2ec2f250c4ad121767f3da75d1b"
dependencies = [
"cadmpeg-container",
"cadmpeg-core",
@@ -580,9 +580,9 @@ dependencies = [
[[package]]
name = "cadmpeg-codec-rhino"
version = "0.6.3"
version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7af41440d4c1d69e88e612de02cc3c9bad79d03429531e640ac924fef53c6bf"
checksum = "7dd2b76bd1d9301c949fbd731fd22cff9d37d10d1f481c754b557c2187bd0171"
dependencies = [
"cadmpeg-container",
"cadmpeg-core",
@@ -599,9 +599,9 @@ dependencies = [
[[package]]
name = "cadmpeg-codec-step"
version = "0.6.3"
version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35e1b6d17cf26b31f59f2edab8ef5c29d2a33216c581fd913f012ad4869bd559"
checksum = "f3cbce33ed681a28b62d8b01ae64cca2b01f11f31b9a3e5e2455b9ffde915712"
dependencies = [
"base64",
"cadmpeg-container",
@@ -616,9 +616,9 @@ dependencies = [
[[package]]
name = "cadmpeg-container"
version = "0.6.3"
version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ab7bcef48ac7480b4917820272d85cd2c9533e17904e15b0e4d22f19a6045bd"
checksum = "03f0d1c22b875294c5fbf4a4738aec8f8c0a4ad035eb28ece404f1dec21f371a"
dependencies = [
"cadmpeg-core",
"crc32fast",
@@ -628,9 +628,9 @@ dependencies = [
[[package]]
name = "cadmpeg-core"
version = "0.6.3"
version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e86bb7a40521832504bb1f5953a1c706b2c52aad73bf6d84e1b35e5cb0beae3f"
checksum = "795bdc6e2a10ecc0627138874c17e2948a3925cd22c6c6b0c2e4f6621d92f89c"
dependencies = [
"flate2",
"memchr",
@@ -643,9 +643,9 @@ dependencies = [
[[package]]
name = "cadmpeg-ir"
version = "0.6.3"
version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b570a1a8c579e407a9fd7bb10fa1900f8827f1d578b8fcb4ea2a056b5f323c72"
checksum = "5592036516aaf2574b159a86a3d1ae872dc245261de86e4c0ce6773fed00a249"
dependencies = [
"base64",
"cadmpeg-core",
@@ -658,9 +658,9 @@ dependencies = [
[[package]]
name = "cadmpeg-registry"
version = "0.6.3"
version = "0.6.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2be23469a9bca0b684f1811118fffb581ebd32ded08e6cc8b0716a41f8c1377"
checksum = "fc163233d5f664337267192848505854de6aeed4843181adf87f58baddcee9a0"
dependencies = [
"cadmpeg-codec-freecad",
"cadmpeg-codec-rhino",
+3 -3
View File
@@ -81,9 +81,9 @@ gethostname = "1"
# Pinned: its IR and codec APIs change between minor versions. Open formats only: no default
# features, so cadmpeg's codecs for commercial formats (f3d, sldprt, inventor, catia, creo, nx)
# and its ShapeManager/ACIS `sat` codec are not compiled in. `step` is the writer we restate through.
cadmpeg-core = "=0.6.3"
cadmpeg-ir = "=0.6.3"
cadmpeg-registry = { version = "=0.6.3", default-features = false, features = ["fcstd", "rhino", "step"] }
cadmpeg-core = "=0.6.7"
cadmpeg-ir = "=0.6.7"
cadmpeg-registry = { version = "=0.6.7", default-features = false, features = ["fcstd", "rhino", "step"] }
# fonts (sketch text outlines; MIT OR Apache-2.0, pure Rust)
ttf-parser = { version = "0.25", default-features = false, features = ["std", "variable-fonts"] }
+14 -14
View File
@@ -57,13 +57,13 @@ bytemuck_derive 1.12.1 (Zlib OR Apache-2.0 OR MIT)
byteorder 1.5.0 (Unlicense OR MIT)
byteorder-lite 0.1.0 (Unlicense OR MIT)
bytes 1.12.1 (MIT)
cadmpeg-codec-freecad 0.6.3 (Apache-2.0)
cadmpeg-codec-rhino 0.6.3 (Apache-2.0)
cadmpeg-codec-step 0.6.3 (Apache-2.0)
cadmpeg-container 0.6.3 (Apache-2.0)
cadmpeg-core 0.6.3 (Apache-2.0)
cadmpeg-ir 0.6.3 (Apache-2.0)
cadmpeg-registry 0.6.3 (Apache-2.0)
cadmpeg-codec-freecad 0.6.7 (Apache-2.0)
cadmpeg-codec-rhino 0.6.7 (Apache-2.0)
cadmpeg-codec-step 0.6.7 (Apache-2.0)
cadmpeg-container 0.6.7 (Apache-2.0)
cadmpeg-core 0.6.7 (Apache-2.0)
cadmpeg-ir 0.6.7 (Apache-2.0)
cadmpeg-registry 0.6.7 (Apache-2.0)
calloop 0.13.0 (MIT)
calloop 0.14.5 (MIT)
calloop-wayland-source 0.3.0 (MIT)
@@ -15978,13 +15978,13 @@ accesskit_windows 0.32.1: MIT OR Apache-2.0 (https://github.com/AccessKit/access
accesskit_winit 0.32.2: Apache-2.0 (https://github.com/AccessKit/accesskit)
block2 0.5.1: MIT (https://github.com/madsmtm/objc2)
block2 0.6.2: MIT (https://github.com/madsmtm/objc2)
cadmpeg-codec-freecad 0.6.3: Apache-2.0 (https://github.com/cadmpeg/cadmpeg)
cadmpeg-codec-rhino 0.6.3: Apache-2.0 (https://github.com/cadmpeg/cadmpeg)
cadmpeg-codec-step 0.6.3: Apache-2.0 (https://github.com/cadmpeg/cadmpeg)
cadmpeg-container 0.6.3: Apache-2.0 (https://github.com/cadmpeg/cadmpeg)
cadmpeg-core 0.6.3: Apache-2.0 (https://github.com/cadmpeg/cadmpeg)
cadmpeg-ir 0.6.3: Apache-2.0 (https://github.com/cadmpeg/cadmpeg)
cadmpeg-registry 0.6.3: Apache-2.0 (https://github.com/cadmpeg/cadmpeg)
cadmpeg-codec-freecad 0.6.7: Apache-2.0 (https://github.com/cadmpeg/cadmpeg)
cadmpeg-codec-rhino 0.6.7: Apache-2.0 (https://github.com/cadmpeg/cadmpeg)
cadmpeg-codec-step 0.6.7: Apache-2.0 (https://github.com/cadmpeg/cadmpeg)
cadmpeg-container 0.6.7: Apache-2.0 (https://github.com/cadmpeg/cadmpeg)
cadmpeg-core 0.6.7: Apache-2.0 (https://github.com/cadmpeg/cadmpeg)
cadmpeg-ir 0.6.7: Apache-2.0 (https://github.com/cadmpeg/cadmpeg)
cadmpeg-registry 0.6.7: Apache-2.0 (https://github.com/cadmpeg/cadmpeg)
clipboard-win 5.4.1: BSL-1.0 (https://github.com/DoumanAsh/clipboard-win)
dispatch 0.2.0: MIT (http://github.com/SSheldon/rust-dispatch)
dispatch2 0.3.1: Zlib OR Apache-2.0 OR MIT (https://github.com/madsmtm/objc2)
+18 -1
View File
@@ -318,6 +318,19 @@ fn load_checked(path: &str, check: solidcraft_engine::schema::ParamCheck) -> Res
/// `load_checked`, the features computed under `validation` (`diagnostics.validation`), which
/// the session keeps.
fn load_with(path: &str, check: solidcraft_engine::schema::ParamCheck, validation: solidcraft_engine::kernel::Validation) -> Result<Session, String> {
let s = read_session(path, check, validation)?;
// A newer SolidCraft's file opens all the same; stderr says so, stdout stays the caller's.
for warning in s.doc.newer_file.iter().flat_map(|file| file.warnings()) {
eprintln!("{path}: warning: {warning}");
}
Ok(s)
}
fn read_session(
path: &str,
check: solidcraft_engine::schema::ParamCheck,
validation: solidcraft_engine::kernel::Validation,
) -> Result<Session, String> {
let mut s = Session::default();
s.param_check = check;
s.set_validation(validation);
@@ -579,7 +592,7 @@ fn cmd_eval(args: &[String]) -> Result<(), String> {
let mut s = open(flag(args, "--in"), positional(args), solidcraft_engine::schema::ParamCheck::Off)?;
let m = s.execute("inspect.measure", &json!({})).map_err(|e| e.to_string())?;
let d = s.execute("document.inspect", &json!({})).map_err(|e| e.to_string())?;
let out = json!({
let mut out = json!({
"body_count": m["body_count"],
"bodies": m["bodies"],
"total": m["total"],
@@ -587,6 +600,10 @@ fn cmd_eval(args: &[String]) -> Result<(), String> {
"params": d["params"],
"sketches": d["sketches"],
});
if let Some(file) = &s.doc.newer_file {
out["newer_file"] = file.report();
out["warnings"] = json!(file.warnings());
}
print_json(&out, json_out)
}
+51 -19
View File
@@ -159,7 +159,7 @@ fn cli_loads_both_design_encodings_by_contents() {
}
/// #1369: a pending concept that did not land in the numbered release must not be silently
/// dropped on open/resave, in either encoding or before replacing an existing destination.
/// dropped on open/resave, in either encoding: it opens with a warning, and saving keeps it.
#[test]
fn unknown_pending_concepts_preserve_the_open_design_and_output_files() {
use solidcraft_engine::{Session, doc, io};
@@ -173,34 +173,29 @@ fn unknown_pending_concepts_preserve_the_open_design_and_output_files() {
let source = dir.0.join(format!("experimental-{version}.{extension}"));
std::fs::write(&source, &bytes).unwrap();
let mut session = Session::default();
session.execute("solid.box", &json!({"length": 2, "width": 3, "height": 4})).unwrap();
let original = session.doc.clone();
let original_path = session.path.clone();
let undo = session.undo.len();
let dirty = session.is_dirty();
let err = session.execute("doc.open", &json!({"path": source})).unwrap_err().to_string();
assert!(err.contains("experimental-card") && err.contains("update SolidCraft"), "{err}");
assert_eq!(session.doc, original);
assert_eq!(session.path, original_path);
assert_eq!(session.undo.len(), undo);
assert_eq!(session.is_dirty(), dirty);
// It opens, and the reply says what it is.
let reply = session.execute("doc.open", &json!({"path": source})).unwrap();
let notice = reply["newer_file"]["notice"].as_str().unwrap().to_string();
assert!(notice.contains("experimental-card") && notice.starts_with("Saved by a newer SolidCraft"), "{notice}");
assert_eq!(reply["warnings"][0], notice.as_str());
assert_eq!(session.doc.name, "Experimental");
for existing in [false, true] {
let destination = dir.0.join(format!("output-{version}-{extension}-{existing}.{extension}"));
let backup = io::backup_path(&destination);
if existing {
std::fs::write(&destination, b"existing design").unwrap();
std::fs::write(&backup, b"existing backup").unwrap();
}
let output = cli().args(["run", "--in"]).arg(&source).arg("--save").arg(&destination).output().unwrap();
assert_eq!(output.status.code(), Some(1));
let error = String::from_utf8_lossy(&output.stderr);
assert!(error.contains("experimental-card") && error.contains("update SolidCraft"), "{error}");
assert_eq!(output.status.code(), Some(0), "{error}");
assert!(error.contains("warning: Saved by a newer SolidCraft") && error.contains("experimental-card"), "{error}");
// Saved, it still says it has the change, and opens the same way.
let saved = io::read_design(&std::fs::read(&destination).unwrap()).unwrap();
assert!(saved.format_pending.iter().any(|name| name == "experimental-card"));
assert!(saved.newer_file.is_some());
if existing {
assert_eq!(std::fs::read(&destination).unwrap(), b"existing design");
assert_eq!(std::fs::read(&backup).unwrap(), b"existing backup");
} else {
assert!(!destination.exists() && !backup.exists());
assert_eq!(std::fs::read(&backup).unwrap(), b"existing design");
}
assert_eq!(std::fs::read(&source).unwrap(), bytes);
}
@@ -208,6 +203,43 @@ fn unknown_pending_concepts_preserve_the_open_design_and_output_files() {
}
}
/// `eval` and `run` on a design one format newer, with a feature kind this version doesn't have:
/// the rest builds, the reply names it, and the saved file still holds it, under the file's number.
#[test]
fn the_cli_opens_a_newer_design_and_saving_keeps_what_it_cant_read() {
use solidcraft_engine::{Session, doc, io};
let dir = Scratch::new();
let mut session = Session::default();
session.execute("solid.box", &json!({"length": 2, "width": 3, "height": 4})).unwrap();
let mut file: Value = serde_json::from_slice(&io::write_design(&session.doc)).unwrap();
let newer = doc::format::format_string(doc::format::FORMAT + 1);
file["format"] = json!(newer);
let future = json!({"id": 900, "name": "Lattice1", "type": "gyroid_lattice", "cell": 2.5});
file["features"].as_array_mut().unwrap().push(future.clone());
let source = dir.0.join("newer.json");
std::fs::write(&source, file.to_string()).unwrap();
let output = cli().args(["eval"]).arg(&source).output().unwrap();
let error = String::from_utf8_lossy(&output.stderr);
assert_eq!(output.status.code(), Some(0), "{error}");
assert!(error.contains("warning: Saved by a newer SolidCraft") && error.contains("Lattice1"), "{error}");
let reply: Value = serde_json::from_slice(&output.stdout).unwrap();
assert_eq!(reply["body_count"], 1);
assert!(reply["newer_file"]["not_understood"][0].as_str().unwrap().contains("gyroid_lattice"), "{reply}");
assert!(reply["warnings"][0].as_str().unwrap().starts_with("Saved by a newer SolidCraft"), "{reply}");
for extension in ["json", "sc"] {
let destination = dir.0.join(format!("saved.{extension}"));
let output = cli().args(["run", "--in"]).arg(&source).arg("--save").arg(&destination).output().unwrap();
assert_eq!(output.status.code(), Some(0), "{}", String::from_utf8_lossy(&output.stderr));
let saved = io::read_design(&std::fs::read(&destination).unwrap()).unwrap();
assert_eq!(saved.format, newer, "never a lower number");
let again: Value = serde_json::from_slice(&io::write_design(&saved)).unwrap();
assert_eq!(again["features"].as_array().unwrap().last().unwrap(), &future);
}
}
#[test]
fn known_pending_concepts_and_released_files_round_trip_with_inert_metadata() {
use solidcraft_engine::{doc, io};
+100
View File
@@ -0,0 +1,100 @@
//! Is the file chooser that opens the desktop's own? (#10159)
//!
//! `rfd` opens the file chooser through the XDG desktop portal; without the portal it falls
//! back to zenity, a window that does not belong to the app and that the app never mentions.
//! The desktop's own chooser is the portal one, so the app has to know when it is not the one
//! that opens, and say so in the session log.
//!
//! The session bus is asked once, on a thread of its own: a bus that answers late must not
//! hold the window. What it answered is kept, and read when a file is opened.
use std::sync::atomic::{AtomicBool, AtomicU8, Ordering};
/// The portal's bus name: the desktop's own file chooser lives behind it.
const PORTAL: &str = "org.freedesktop.portal.Desktop";
/// The bus has not answered yet.
const UNKNOWN: u8 = 0;
/// There is no session bus to reach the portal on.
const NO_SESSION_BUS: u8 = 1;
/// The bus is there but the portal does not answer on it.
const NO_PORTAL_SERVICE: u8 = 2;
/// The bus is there and the portal answers on it.
const PORTAL_THERE: u8 = 3;
/// What the session bus said about the portal.
static BUS: AtomicU8 = AtomicU8::new(UNKNOWN);
/// A file chooser is opening: whether it is the desktop's own is to be said.
static OPENING: AtomicBool = AtomicBool::new(false);
/// Ask the session bus, on a thread of its own, whether the portal is there.
pub fn start(ctx: &egui::Context) {
let thread_ctx = ctx.clone();
let probe = move || {
let answer = match session_bus() {
None => NO_SESSION_BUS,
Some(connection) => match portal_on(&connection) {
true => PORTAL_THERE,
false => NO_PORTAL_SERVICE,
},
};
BUS.store(answer, Ordering::Relaxed);
// The answer is in: a file chooser waiting for it can be told now.
thread_ctx.request_repaint();
};
if let Err(e) = std::thread::Builder::new().name("desktop-chooser".into()).spawn(probe) {
log::warn!("file chooser: no thread to ask the session bus: {e}");
// Nothing will answer: the desktop's own chooser cannot be told apart from the start.
BUS.store(PORTAL_THERE, Ordering::Relaxed);
}
}
/// The session bus, when there is one to talk to.
fn session_bus() -> Option<zbus::blocking::Connection> {
zbus::blocking::Connection::session().ok()
}
/// Whether the portal answers on the bus: it is either running on it or waiting to be started.
fn portal_on(connection: &zbus::blocking::Connection) -> bool {
let Ok(bus) = zbus::blocking::fdo::DBusProxy::new(connection) else { return false };
let named = |names: Vec<zbus::names::OwnedBusName>| names.iter().any(|name| name.as_str() == PORTAL);
// A portal that is running is on the bus; one that is not running yet is still there when
// the bus can start it, which is what the portal's service file is for.
match (bus.list_names().map(named), bus.list_activatable_names().map(named)) {
(Ok(running), Ok(startable)) => running || startable,
(Ok(running), Err(_)) => running,
(Err(_), Ok(startable)) => startable,
// The bus does not answer: nothing answers on it.
(Err(_), Err(_)) => false,
}
}
/// A file chooser is opening: ask for a frame, so that the reason it is not the desktop's own
/// is said (#10159).
pub fn note_opening(ctx: &egui::Context) {
OPENING.store(true, Ordering::Relaxed);
ctx.request_repaint();
}
/// The reason the file chooser that is opening is not the desktop's own, if it is not.
///
/// The decision is the one the test states: without a session bus there is no bus to reach the
/// portal on; with a bus but no portal on it, `rfd` falls back to zenity; and under XWayland the
/// window is an X11 one while the session is a Wayland one, which the portal refuses to parent
/// its chooser to.
pub fn take_reason() -> Option<&'static str> {
if !OPENING.load(Ordering::Relaxed) {
return None;
}
let (dbus_session, portal_service) = match BUS.load(Ordering::Relaxed) {
NO_SESSION_BUS => (false, false),
NO_PORTAL_SERVICE => (true, false),
PORTAL_THERE => (true, true),
// The bus has not answered yet: wait for it, and say nothing yet.
_ => return None,
};
OPENING.store(false, Ordering::Relaxed);
let wayland_display = std::env::var_os("WAYLAND_DISPLAY").is_some();
let x11_display = super::window_system_now() == Some("x11");
super::desktop_chooser_fallback(dbus_session, portal_service, wayland_display, x11_display)
}
+213 -11
View File
@@ -23,6 +23,8 @@ mod app_icon;
mod come_forward;
mod control_server;
#[cfg(target_os = "linux")]
mod desktop_chooser;
#[cfg(target_os = "linux")]
mod desktop_theme;
#[cfg(any(target_os = "windows", target_os = "macos"))]
mod desktop_transparency;
@@ -242,6 +244,12 @@ impl eframe::App for App {
menu.tick(&mut self.solve, ctx);
}
self.solve.logic(ctx);
// The file chooser that opened is not the desktop's own: the user has to be told (#10159).
#[cfg(target_os = "linux")]
if let Some(reason) = desktop_chooser::take_reason() {
let text = self.solve.tr(reason).to_string();
self.solve.set_status(text, false);
}
self.dialog_folder.design(self.solve.session.path.as_deref());
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
if !self.solve.file_picker_busy() {
@@ -471,12 +479,19 @@ fn fullscreen_content_insets(raw: &mut egui::RawInput, title_height: f32, zoom:
fn services(cc: &eframe::CreationContext<'_>, folder: &DialogFolder) -> Services {
let parent = rfd::AsyncFileDialog::new().set_parent(cc);
// The file chooser that opens may not be the desktop's own: the user is told when it does
// not (#10159).
#[cfg(target_os = "linux")]
let chooser_ctx = cc.egui_ctx.clone();
let open_parent = parent.clone();
let program_parent = parent.clone();
let file_parent = parent.clone();
let (open_folder, file_folder, save_folder) = (folder.clone(), folder.clone(), folder.clone());
Services {
pick_open: Some(Box::new(move |first: &[&str]| {
// The chooser that opens may not be the desktop's own (#10159).
#[cfg(target_os = "linux")]
desktop_chooser::note_opening(&chooser_ctx);
// The file type the command reads comes first, so the picker opens on it (#1801).
let mut dialog = open_folder.start(open_parent.clone());
if !first.is_empty() {
@@ -785,6 +800,28 @@ fn graphics() -> Option<serde_json::Value> {
graphics_path().and_then(|p| std::fs::read_to_string(p).ok()).and_then(|s| serde_json::from_str::<serde_json::Value>(&s).ok())
}
fn restore_preferences(app: &mut SolveApp, stored_ui: Option<&str>, saved_graphics: Option<&serde_json::Value>, safe_mode: bool) {
if let Some(p) = stored_ui.filter(|_| !safe_mode) {
app.load_prefs(p);
}
// Even safe mode edits the real graphics.json. Keep its choices in Preferences so an
// anti-aliasing change cannot erase them; safe mode's renderer still uses its own defaults.
restore_graphics_preferences(app, saved_graphics);
}
/// Restore startup choices after loading the separately saved UI preferences.
fn restore_graphics_preferences(app: &mut SolveApp, saved: Option<&serde_json::Value>) {
app.preferences.graphics_adapter = saved.and_then(|v| v.get("adapter").and_then(serde_json::Value::as_str)).unwrap_or_default().to_string();
// graphics.json chooses the window before app.ron is loaded. Reflect that saved choice,
// not the current session's window system (which an environment override may change).
app.preferences.window_system = saved
.and_then(|v| v.get("window_system").and_then(serde_json::Value::as_str))
.map(str::trim)
.filter(|choice| matches!(*choice, "wayland" | "x11"))
.unwrap_or("auto")
.to_string();
}
/// The graphics backend preference (`graphics.json`'s `backend`: `auto`, `dx12`, `vulkan`, `gl`).
fn backend_preference() -> Option<String> {
graphics().and_then(|v| v.get("backend").and_then(serde_json::Value::as_str).map(str::to_string))
@@ -1003,6 +1040,8 @@ fn main() -> eframe::Result {
solidcraft_engine::crash::install(dir, build)
})
.unwrap_or_default();
// The recovery folder also holds the reopen guard marker (#5064); read once, reused below.
let recovery_dir = solidcraft_engine::recovery::default_dir();
// A crash in native code (a graphics driver) says where it happened: the exception or signal
// and the module on Windows and macOS, and on every system the startup step the app was in.
#[cfg(target_os = "windows")]
@@ -1085,6 +1124,10 @@ fn main() -> eframe::Result {
solidcraft_ui_egui::fonts::load_system_fonts_in_background(&cc.egui_ctx);
mark("fonts");
let dialog_folder = DialogFolder::default();
// The file chooser that opens may not be the desktop's own: the session bus is asked
// now, so the answer is there when a file is opened (#10159).
#[cfg(target_os = "linux")]
desktop_chooser::start(&cc.egui_ctx);
let mut app = SolveApp::new(Session::default(), services(cc, &dialog_folder));
app.apply_off_thread = Some(solidcraft_ui_egui::dialogs::APPLY_AT_ONCE);
app.custom_titlebar = custom_titlebar;
@@ -1105,9 +1148,8 @@ fn main() -> eframe::Result {
app.integrated_titlebar = cfg!(target_os = "macos");
app.cpu_meshing = safe_mode;
app.graphics_fallback = fallback_note.clone();
if let Some(p) = cc.storage.and_then(|s| solidcraft_ui_egui::prefs::stored(|k| s.get_string(k))).filter(|_| !safe_mode) {
app.load_prefs(&p);
}
let stored_ui = cc.storage.and_then(|s| solidcraft_ui_egui::prefs::stored(|k| s.get_string(k)));
restore_preferences(&mut app, stored_ui.as_deref(), graphics().as_ref(), safe_mode);
if let Some(path) = &theme_file
&& let Err(e) = solidcraft_ui_egui::prefs::follow_theme_file_for_run(&mut app, path)
{
@@ -1120,10 +1162,6 @@ fn main() -> eframe::Result {
lost_at: None,
reason: String::new(),
});
if !safe_mode {
app.preferences.graphics_adapter =
graphics().and_then(|v| v.get("adapter").and_then(serde_json::Value::as_str).map(str::to_string)).unwrap_or_default();
}
if let Some(rs) = &cc.wgpu_render_state {
app.services.graphics_adapters = rs
.available_adapters
@@ -1196,8 +1234,25 @@ fn main() -> eframe::Result {
};
// No design given: the designs open at the last quit, when the preference asks (#5542).
// Not when driven over the control channel, whose clients expect a fresh design.
let files =
if files.is_empty() && !sample && control_port.is_none() { solidcraft_ui_egui::documents::designs_to_reopen(&app) } else { files };
// A design that stopped the last session while it was being reopened is skipped this
// time, so one bad file cannot brick every launch (#5064).
app.reopen_guard_dir = recovery_dir.clone();
let files = if files.is_empty() && !sample && control_port.is_none() {
let (reopen, skipped) = solidcraft_ui_egui::documents::reopen_plan(&app, recovery_dir.as_deref());
if !skipped.is_empty() {
let names: Vec<String> = skipped
.iter()
.map(|p| std::path::Path::new(p).file_name().map(|n| n.to_string_lossy().into_owned()).unwrap_or_else(|| p.clone()))
.collect();
notes.push(format!(
"The last session stopped while reopening {}. It was not reopened this time; open it yourself if you need it.",
names.join(", ")
));
}
reopen
} else {
files
};
for f in &files {
app.open_path_async(f);
}
@@ -1213,9 +1268,9 @@ fn main() -> eframe::Result {
app.home.show(rev);
}
// Autosave, and offer what crashed sessions left behind.
if let Some(dir) = solidcraft_engine::recovery::default_dir() {
if let Some(dir) = recovery_dir.as_ref() {
let every = if app.autosave_minutes > 0.0 { app.autosave_minutes * 60.0 } else { f64::MAX / 4.0 };
solidcraft_ui_egui::recovery_ui::start(&mut app, &dir, std::time::Duration::from_secs_f64(every.min(1e9)));
solidcraft_ui_egui::recovery_ui::start(&mut app, dir, std::time::Duration::from_secs_f64(every.min(1e9)));
// Safe mode keeps autosaving but offers nothing: the entries wait for a normal start.
if safe_mode {
app.recoverable.clear();
@@ -1403,6 +1458,47 @@ fn prefer_x11(display: bool, wayland_display: bool, desktop: Option<&str>, wayla
display && !(niri && wayland_display)
}
#[cfg(all(unix, not(target_os = "macos")))]
const CHOOSER_NO_SESSION_BUS: &str = "file.open.portal_fallback.no_session_bus";
#[cfg(all(unix, not(target_os = "macos")))]
const CHOOSER_NO_PORTAL_SERVICE: &str = "file.open.portal_fallback.no_portal_service";
#[cfg(all(unix, not(target_os = "macos")))]
const CHOOSER_XWAYLAND: &str = "file.open.portal_fallback.xwayland";
/// Whether the chooser that opens is NOT the desktop's own, and why.
///
/// `rfd` opens the file chooser through the XDG desktop portal; when the portal is not there it
/// falls back to zenity, which opens a window that does not belong to SolidCraft and that the
/// application never mentions. The application has to know that: this decision is what the warning
/// is built on.
///
/// * `dbus_session`: the session bus is there (`DBUS_SESSION_BUS_ADDRESS`).
/// * `portal_service`: the file chooser portal answers on it.
/// * `wayland_display`: a Wayland session runs (`WAYLAND_DISPLAY`).
/// * `x11_display`: the window is an X11 one (`DISPLAY`, or XWayland).
///
/// `None` means the desktop's own chooser is the one that opens and there is nothing to say;
/// `Some` carries the reason to report.
#[cfg(all(unix, not(target_os = "macos")))]
#[cfg_attr(not(target_os = "linux"), allow(dead_code))]
fn desktop_chooser_fallback(dbus_session: bool, portal_service: bool, wayland_display: bool, x11_display: bool) -> Option<&'static str> {
// Without a session bus there is no bus to reach the portal on, so the chooser is not the
// desktop's own whatever else is there.
if !dbus_session {
return Some(CHOOSER_NO_SESSION_BUS);
}
// The bus is there but the portal does not answer on it: `rfd` falls back to zenity.
if !portal_service {
return Some(CHOOSER_NO_PORTAL_SERVICE);
}
// Under XWayland the window is an X11 one while the session is a Wayland one, and the portal
// refuses to parent its chooser to an X11 window: `rfd` falls back to zenity.
if wayland_display && x11_display {
return Some(CHOOSER_XWAYLAND);
}
None
}
#[cfg(all(test, unix, not(target_os = "macos")))]
mod backend_tests {
use super::prefer_x11;
@@ -1438,6 +1534,30 @@ mod backend_tests {
assert!(prefer_x11(true, true, Some("niri"), over(Some("x11"))));
}
/// The file chooser must say when it is NOT the desktop's own: `rfd` falls back to zenity
/// when the XDG portal is not there, and the user gets a foreign window with no explanation.
#[test]
fn the_file_picker_says_when_it_is_not_the_desktops_own_chooser() {
use super::desktop_chooser_fallback;
// The normal case: the portal is there, the desktop's own chooser opens, nothing to say.
assert_eq!(desktop_chooser_fallback(true, true, true, false), None);
// No session bus: the portal can not be reached at all, so `rfd` falls back to zenity.
assert!(
desktop_chooser_fallback(false, true, true, false).is_some(),
"without a D-Bus session bus the file chooser is not the desktop's own: the user has to be told"
);
// The bus is there but the portal service is not: same fallback, same warning.
assert!(
desktop_chooser_fallback(true, false, true, false).is_some(),
"without the desktop portal service the file chooser is not the desktop's own: the user has to be told"
);
// XWayland: the parent window is an X11 one and the portal refuses it, so `rfd` falls back.
assert!(
desktop_chooser_fallback(true, true, true, true).is_some(),
"under XWayland the portal rejects the parent window: the user has to be told"
);
}
#[test]
fn the_desktops_title_bar_only_when_asked_for() {
use super::titlebar_choice;
@@ -1715,6 +1835,88 @@ mod viewport_tests {
#[cfg(test)]
mod msaa_tests {
/// Safe mode uses default UI settings but edits the real graphics.json for the next start.
#[test]
fn safe_mode_preserves_graphics_choices_when_changing_antialiasing() {
use serde_json::{Value, json};
use solidcraft_ui_egui::scenario::Harness;
for choice in ["wayland", "x11"] {
let mut h = Harness::new();
let path = h.dir.join("graphics.json");
let saved = json!({"window_system": choice, "adapter": "Selected GPU", "backend": "vulkan", "msaa": 8});
std::fs::write(&path, saved.to_string()).unwrap();
h.app.services.graphics_path = Some(path.to_string_lossy().into_owned());
let defaults = h.app.preferences.clone();
let stored_ui = json!({"preferences": {"window_system": "auto", "graphics_adapter": "Stale GPU", "msaa": 2,
"display_quality": "fine"}})
.to_string();
super::restore_preferences(&mut h.app, Some(&stored_ui), Some(&saved), true);
assert_eq!(h.app.preferences.window_system, choice);
assert_eq!(h.app.preferences.graphics_adapter, "Selected GPU");
assert_eq!(h.app.preferences.msaa, defaults.msaa, "safe mode ignores saved anti-aliasing");
assert_eq!(h.app.preferences.display_quality, defaults.display_quality, "safe mode ignores saved UI settings");
assert_eq!(serde_json::from_str::<Value>(&std::fs::read_to_string(&path).unwrap()).unwrap(), saved, "startup does not write settings");
assert_eq!(h.call("ui.prefs", json!({"open": "Graphics"}))["ok"], true);
assert_eq!(h.call("ui.prefs", json!({"msaa": 1}))["ok"], true);
assert_eq!(h.call("ui.prefs", json!({"button": "ok"}))["ok"], true);
let after: Value = serde_json::from_str(&std::fs::read_to_string(&path).unwrap()).unwrap();
assert_eq!(after, json!({"window_system": choice, "adapter": "Selected GPU", "backend": "vulkan", "msaa": 1}));
let mut normal = Harness::new();
super::restore_preferences(&mut normal.app, Some(&stored_ui), Some(&after), false);
assert_eq!(normal.app.preferences.window_system, choice);
assert_eq!(normal.app.preferences.graphics_adapter, "Selected GPU");
assert_eq!(normal.app.preferences.display_quality, "fine", "normal startup still restores UI settings");
}
}
#[test]
fn missing_or_invalid_startup_window_system_uses_automatic() {
use serde_json::json;
for saved in [None, Some(json!(null)), Some(json!({})), Some(json!({"window_system": 7})), Some(json!({"window_system": "unknown"}))] {
let mut app = super::SolveApp::new(super::Session::default(), super::Services::default());
app.preferences.window_system = "wayland".into();
super::restore_graphics_preferences(&mut app, saved.as_ref());
assert_eq!(app.preferences.window_system, "auto", "{saved:?}");
}
}
/// A manual graphics.json choice wins over stale app.ron preferences and survives an
/// unrelated graphics edit (#10116), including on a fresh launch with no saved UI state.
#[test]
fn startup_window_system_survives_changing_antialiasing() {
use serde_json::{Value, json};
use solidcraft_ui_egui::scenario::Harness;
for choice in ["wayland", "x11", "auto", " wayland ", " x11 "] {
for stale in [None, Some("auto"), Some("wayland"), Some("x11")] {
let mut h = Harness::new();
if let Some(stale) = stale {
h.app.load_prefs(&json!({"preferences": {"window_system": stale}}).to_string());
}
let path = h.dir.join("graphics.json");
std::fs::write(&path, json!({"window_system": choice, "backend": "vulkan", "adapter": "Selected GPU", "msaa": 4}).to_string())
.unwrap();
h.app.services.graphics_path = Some(path.to_string_lossy().into_owned());
let saved: Value = serde_json::from_str(&std::fs::read_to_string(&path).unwrap()).unwrap();
super::restore_graphics_preferences(&mut h.app, Some(&saved));
let result = h.call("ui.prefs", json!({"msaa": 2}));
assert_eq!(result["ok"], true, "{result}");
let after: Value = serde_json::from_str(&std::fs::read_to_string(&path).unwrap()).unwrap();
assert_eq!(after["window_system"], choice.trim(), "saved choice {choice:?}, stale UI choice {stale:?}");
assert_eq!(result["result"]["window_system"], choice.trim());
assert_eq!(after["msaa"], 2);
assert_eq!(after["backend"], "vulkan");
assert_eq!(after["adapter"], "Selected GPU");
}
}
}
#[test]
fn first_launch_adopts_the_previous_release_settings() {
let d = std::env::temp_dir().join(format!("solidcraft-adopt-settings-{}", std::process::id()));
+1
View File
@@ -17,6 +17,7 @@ assets/
ui/design/tools/ # authoring bases, checks and included review app
ui/source/ # Rust viewport glyphs, markers and navigation
branding/web/source/og.png # shared social preview card
branding/logo/ # print/web logo files; guide in branding/README.md
styles/ui/palettes.rs # light/dark defaults
styles/web/loading.css # web loading/canvas styles
appearances/library.rs # built-in visual presets
+73
View File
@@ -0,0 +1,73 @@
# SolidCraft brand kit
Logo files for stickers, shirts, the web and social posts. Everything in `logo/` is drawn
from the app icon (`assets/icons/app/macos/source/SolidCraft.icon/Assets/03-solid-blue-cutout.svg`),
which is also the last frame of the loading animation (`assets/styles/web/loading-logo.svg`).
The SVGs are plain paths: no scripts, fonts, animation or external links, so any printer can use them.
## Files
| File | Use it for |
|---|---|
| `logo/solidcraft-mark.svg` | The mark in full colour. First choice for stickers, print and the web. |
| `logo/solidcraft-mark-mono-black.svg` | One-colour print on light material: screen-printed shirts, stamps, engraving, vinyl. |
| `logo/solidcraft-mark-mono-white.svg` | One-colour print on dark material, such as a white print on a dark shirt. |
| `logo/solidcraft-mark-512.png`, `-1024.png`, `-2048.png` | Transparent square PNGs for places that don't take SVG: avatars, social posts, slides, print shops that ask for a bitmap (send the 2048). |
| `logo/solidcraft-wordmark.svg` | The name on its own, outlined to paths. |
| `logo/solidcraft-lockup-horizontal.svg` | Mark and name side by side: headers, banners, shirt fronts, wide stickers. |
| `web/source/og.png` | The existing link preview card for the docs site. |
The gaps between the faces are part of the logo. In the colour and one-colour files they are
transparent, so the material shows through. For a die-cut sticker, cut around the outer shape
and let the backing colour (white is best) fill the gaps.
## Colours
The mark's five faces each use a two-stop gradient from the icon source:
| Face | From | To |
|---|---|---|
| Top | `#51adff` | `#2b83f1` |
| Left | `#258df5` | `#1461da` |
| Right | `#1b66cf` | `#124596` |
| Lower step (top) | `#459fff` | `#2379e7` |
| Upper step (inner side) | `#1d63c6` | `#15499e` |
Other colours, all already used in the project:
| Colour | Hex | Where it comes from |
|---|---|---|
| Wordmark blue | `#15499e` | loading logo `--word` |
| Interface accent | `#2678da` | light theme `accent` token (`assets/styles/ui/palettes.rs`) |
| Light background | `#e8ebf0` | web loading screen (`assets/styles/web/loading.css`) |
| Dark background | `#1f232b` | dark theme `file_background` token |
| Black / white | `#000000` / `#ffffff` | one-colour versions only |
If a printer can't do gradients, use the one-colour files, or fill every face with `#2678da`.
## Clear space and size
- Keep empty space around the mark of at least one fifth of its height on every side. Treat
the lockup the same way, measured from the mark.
- Smallest mark: 16 px tall on screen, 12 mm tall in print. Below that the gaps fill in.
- Smallest lockup: 120 px wide on screen, 40 mm wide in print.
## Don'ts
- Don't recolour it outside the colours above.
- Don't stretch, squash, rotate, skew or crop it. Scale it evenly.
- Don't add shadows, outlines, glows, bevels or other effects.
- Don't fill or close the gaps between the faces, or move the faces apart.
- Don't rearrange the lockup, retype the name in another font, or put the mark on a busy
background where it loses contrast.
## Name and logo
The SolidCraft code and these files are licensed MIT OR Apache-2.0 (see the [README](../../README.md#licence)),
so you may copy and change them. The name SolidCraft and this logo identify the SolidCraft
project. Use them to refer to the project, for example in an article, a talk, or a sticker for a
meetup. If you publish a fork or a modified build, give it its own name and logo so people
don't mistake it for SolidCraft.
The wordmark is set in IBM Plex Sans Bold (SIL Open Font License 1.1, the interface font in
`assets/fonts/ibm-plex-sans/`) and outlined, so you don't need the font to print it.
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="116.406 53.364 2748.71 904.436" width="2749" height="904" role="img"><title>SolidCraft</title><defs><linearGradient id="sc1" x1="619.14" y1="179.734" x2="694.687" y2="396.761" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#1d63c6"/><stop offset="1" stop-color="#15499e"/></linearGradient><linearGradient id="sc2" x1="619.14" y1="413.244" x2="790.839" y2="605.547" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#459fff"/><stop offset="1" stop-color="#2379e7"/></linearGradient><linearGradient id="sc3" x1="632.876" y1="399.508" x2="783.971" y2="968.175" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#1b66cf"/><stop offset="1" stop-color="#124596"/></linearGradient><linearGradient id="sc4" x1="207.063" y1="303.357" x2="426.837" y2="968.175" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#258df5"/><stop offset="1" stop-color="#1461da"/></linearGradient><linearGradient id="sc5" x1="385.63" y1="53.364" x2="522.989" y2="510.769" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#51adff"/><stop offset="1" stop-color="#2b83f1"/></linearGradient></defs><g><path d="M547.883 282.66 L709.797 188.211 L709.797 375.985 Z" fill="url(#sc1)"/><path d="M727.797 593.626 L727.797 407.136 L889.571 500.381 Z" fill="url(#sc2)"/><path d="M530 521.17 L691.797 427.912 L691.797 655.928 L907.594 531.545 L907.594 740.159 L530 957.8 Z" fill="url(#sc3)"/><path d="M116.406 510.769 L116.406 303.529 L494 521.17 L494 957.8 L314.203 854.167 L314.203 624.777 Z" fill="url(#sc4)"/><path d="M134.374 272.334 L512 53.364 L691.828 157.015 L476.117 282.846 L673.752 396.761 L512 489.993 Z" fill="url(#sc5)"/></g><path fill="#15499e" transform="translate(1092.78 632.20) scale(0.36281)" d="M303 12Q212 12 147.5 -20Q83 -52 38 -101L138 -202Q173 -162 217.5 -142Q262 -122 313 -122Q369 -122 396 -145Q423 -168 423 -206Q423 -225 416.5 -240.5Q410 -256 392.5 -266.5Q375 -277 342 -281L273 -290Q200 -300 152.5 -326.5Q105 -353 82 -396.5Q59 -440 59 -498Q59 -561 90.5 -608.5Q122 -656 180.5 -683Q239 -710 321 -710Q400 -710 460 -684.5Q520 -659 563 -612L462 -510Q437 -539 401.5 -557.5Q366 -576 312 -576Q261 -576 236 -558Q211 -540 211 -508Q211 -484 219.5 -469Q228 -454 246.5 -446Q265 -438 294 -433L363 -422Q435 -411 482 -385Q529 -359 552 -317Q575 -275 575 -215Q575 -148 543.5 -97Q512 -46 451 -17Q390 12 303 12ZM926 12Q849 12 794 -21.5Q739 -55 709.5 -117Q680 -179 680 -263Q680 -348 709.5 -409Q739 -470 794 -503.5Q849 -537 926 -537Q1003 -537 1058 -503.5Q1113 -470 1142.5 -409Q1172 -348 1172 -263Q1172 -179 1142.5 -117Q1113 -55 1058 -21.5Q1003 12 926 12ZM926 -105Q970 -105 994 -132.5Q1018 -160 1018 -209V-316Q1018 -366 994 -393Q970 -420 926 -420Q883 -420 858.5 -393Q834 -366 834 -316V-209Q834 -160 858.5 -132.5Q883 -105 926 -105ZM1511 0H1444Q1368 0 1332.5 -37Q1297 -74 1297 -144V-740H1445V-115H1511ZM1694 -581Q1649 -581 1628.5 -602Q1608 -623 1608 -654V-676Q1608 -708 1628.5 -728.5Q1649 -749 1694 -749Q1739 -749 1759.5 -728.5Q1780 -708 1780 -676V-654Q1780 -623 1759.5 -602Q1739 -581 1694 -581ZM1620 0V-525H1768V0ZM2248 0V-88H2243Q2232 -45 2192.5 -16.5Q2153 12 2102 12Q2036 12 1991 -19.5Q1946 -51 1923 -112.5Q1900 -174 1900 -263Q1900 -352 1923 -413Q1946 -474 1991 -505.5Q2036 -537 2102 -537Q2153 -537 2192.5 -509Q2232 -481 2243 -437H2248V-740H2396V0ZM2151 -108Q2179 -108 2201 -117Q2223 -126 2235.5 -143.5Q2248 -161 2248 -185V-340Q2248 -364 2235.5 -381.5Q2223 -399 2201 -408Q2179 -417 2151 -417Q2109 -417 2081.5 -387.5Q2054 -358 2054 -308V-217Q2054 -168 2081.5 -138Q2109 -108 2151 -108ZM2844 12Q2750 12 2680.5 -28Q2611 -68 2573 -147Q2535 -226 2535 -344Q2535 -462 2573 -543.5Q2611 -625 2680.5 -667.5Q2750 -710 2844 -710Q2940 -710 3003.5 -670Q3067 -630 3105 -546L2974 -478Q2961 -522 2930.5 -548.5Q2900 -575 2844 -575Q2777 -575 2736.5 -531.5Q2696 -488 2696 -405V-293Q2696 -211 2736.5 -167Q2777 -123 2844 -123Q2900 -123 2933.5 -153.5Q2967 -184 2983 -227L3107 -155Q3068 -76 3004 -32Q2940 12 2844 12ZM3373 0H3225V-525H3373V-411H3378Q3384 -440 3400 -466Q3416 -492 3443.5 -508.5Q3471 -525 3512 -525H3538V-387H3501Q3458 -387 3429.5 -379.5Q3401 -372 3387 -355Q3373 -338 3373 -307ZM4105 0H4023Q3996 0 3972.5 -13.5Q3949 -27 3935 -53.5Q3921 -80 3921 -117V-130L3953 -92H3917Q3905 -41 3864 -14.5Q3823 12 3763 12Q3684 12 3642 -30.5Q3600 -73 3600 -141Q3600 -197 3627.5 -233Q3655 -269 3705.5 -287Q3756 -305 3825 -305H3908V-338Q3908 -376 3888 -398.5Q3868 -421 3821 -421Q3777 -421 3751 -402Q3725 -383 3708 -359L3620 -437Q3652 -484 3701 -510.5Q3750 -537 3832 -537Q3943 -537 3999.5 -487.5Q4056 -438 4056 -345V-115H4105ZM3908 -221H3836Q3793 -221 3771 -206Q3749 -191 3749 -162V-147Q3749 -119 3767 -105Q3785 -91 3818 -91Q3843 -91 3863 -98Q3883 -105 3895.5 -120Q3908 -135 3908 -159ZM4250 0V-410H4176V-525H4250V-587Q4250 -663 4290.5 -701.5Q4331 -740 4407 -740H4503V-625H4398V-525H4503V-410H4398V0ZM4877 0H4789Q4713 0 4673 -39Q4633 -78 4633 -153V-410H4559V-525H4596Q4626 -525 4637 -539.5Q4648 -554 4648 -581V-667H4781V-525H4885V-410H4781V-115H4877Z"/></svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="116.406 53.364 791.188 904.436" width="791" height="904" role="img"><title>SolidCraft</title><g fill="#000000"><path d="M547.883 282.66 L709.797 188.211 L709.797 375.985 Z"/><path d="M727.797 593.626 L727.797 407.136 L889.571 500.381 Z"/><path d="M530 521.17 L691.797 427.912 L691.797 655.928 L907.594 531.545 L907.594 740.159 L530 957.8 Z"/><path d="M116.406 510.769 L116.406 303.529 L494 521.17 L494 957.8 L314.203 854.167 L314.203 624.777 Z"/><path d="M134.374 272.334 L512 53.364 L691.828 157.015 L476.117 282.846 L673.752 396.761 L512 489.993 Z"/></g></svg>

After

Width:  |  Height:  |  Size: 612 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="116.406 53.364 791.188 904.436" width="791" height="904" role="img"><title>SolidCraft</title><g fill="#ffffff"><path d="M547.883 282.66 L709.797 188.211 L709.797 375.985 Z"/><path d="M727.797 593.626 L727.797 407.136 L889.571 500.381 Z"/><path d="M530 521.17 L691.797 427.912 L691.797 655.928 L907.594 531.545 L907.594 740.159 L530 957.8 Z"/><path d="M116.406 510.769 L116.406 303.529 L494 521.17 L494 957.8 L314.203 854.167 L314.203 624.777 Z"/><path d="M134.374 272.334 L512 53.364 L691.828 157.015 L476.117 282.846 L673.752 396.761 L512 489.993 Z"/></g></svg>

After

Width:  |  Height:  |  Size: 612 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="116.406 53.364 791.188 904.436" width="791" height="904" role="img"><title>SolidCraft</title><defs><linearGradient id="sc1" x1="619.14" y1="179.734" x2="694.687" y2="396.761" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#1d63c6"/><stop offset="1" stop-color="#15499e"/></linearGradient><linearGradient id="sc2" x1="619.14" y1="413.244" x2="790.839" y2="605.547" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#459fff"/><stop offset="1" stop-color="#2379e7"/></linearGradient><linearGradient id="sc3" x1="632.876" y1="399.508" x2="783.971" y2="968.175" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#1b66cf"/><stop offset="1" stop-color="#124596"/></linearGradient><linearGradient id="sc4" x1="207.063" y1="303.357" x2="426.837" y2="968.175" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#258df5"/><stop offset="1" stop-color="#1461da"/></linearGradient><linearGradient id="sc5" x1="385.63" y1="53.364" x2="522.989" y2="510.769" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#51adff"/><stop offset="1" stop-color="#2b83f1"/></linearGradient></defs><g><path d="M547.883 282.66 L709.797 188.211 L709.797 375.985 Z" fill="url(#sc1)"/><path d="M727.797 593.626 L727.797 407.136 L889.571 500.381 Z" fill="url(#sc2)"/><path d="M530 521.17 L691.797 427.912 L691.797 655.928 L907.594 531.545 L907.594 740.159 L530 957.8 Z" fill="url(#sc3)"/><path d="M116.406 510.769 L116.406 303.529 L494 521.17 L494 957.8 L314.203 854.167 L314.203 624.777 Z" fill="url(#sc4)"/><path d="M134.374 272.334 L512 53.364 L691.828 157.015 L476.117 282.846 L673.752 396.761 L512 489.993 Z" fill="url(#sc5)"/></g></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="38.0 -749.0 4847.0 761.0" width="4847" height="761" role="img"><title>SolidCraft</title><path fill="#15499e" d="M303 12Q212 12 147.5 -20Q83 -52 38 -101L138 -202Q173 -162 217.5 -142Q262 -122 313 -122Q369 -122 396 -145Q423 -168 423 -206Q423 -225 416.5 -240.5Q410 -256 392.5 -266.5Q375 -277 342 -281L273 -290Q200 -300 152.5 -326.5Q105 -353 82 -396.5Q59 -440 59 -498Q59 -561 90.5 -608.5Q122 -656 180.5 -683Q239 -710 321 -710Q400 -710 460 -684.5Q520 -659 563 -612L462 -510Q437 -539 401.5 -557.5Q366 -576 312 -576Q261 -576 236 -558Q211 -540 211 -508Q211 -484 219.5 -469Q228 -454 246.5 -446Q265 -438 294 -433L363 -422Q435 -411 482 -385Q529 -359 552 -317Q575 -275 575 -215Q575 -148 543.5 -97Q512 -46 451 -17Q390 12 303 12ZM926 12Q849 12 794 -21.5Q739 -55 709.5 -117Q680 -179 680 -263Q680 -348 709.5 -409Q739 -470 794 -503.5Q849 -537 926 -537Q1003 -537 1058 -503.5Q1113 -470 1142.5 -409Q1172 -348 1172 -263Q1172 -179 1142.5 -117Q1113 -55 1058 -21.5Q1003 12 926 12ZM926 -105Q970 -105 994 -132.5Q1018 -160 1018 -209V-316Q1018 -366 994 -393Q970 -420 926 -420Q883 -420 858.5 -393Q834 -366 834 -316V-209Q834 -160 858.5 -132.5Q883 -105 926 -105ZM1511 0H1444Q1368 0 1332.5 -37Q1297 -74 1297 -144V-740H1445V-115H1511ZM1694 -581Q1649 -581 1628.5 -602Q1608 -623 1608 -654V-676Q1608 -708 1628.5 -728.5Q1649 -749 1694 -749Q1739 -749 1759.5 -728.5Q1780 -708 1780 -676V-654Q1780 -623 1759.5 -602Q1739 -581 1694 -581ZM1620 0V-525H1768V0ZM2248 0V-88H2243Q2232 -45 2192.5 -16.5Q2153 12 2102 12Q2036 12 1991 -19.5Q1946 -51 1923 -112.5Q1900 -174 1900 -263Q1900 -352 1923 -413Q1946 -474 1991 -505.5Q2036 -537 2102 -537Q2153 -537 2192.5 -509Q2232 -481 2243 -437H2248V-740H2396V0ZM2151 -108Q2179 -108 2201 -117Q2223 -126 2235.5 -143.5Q2248 -161 2248 -185V-340Q2248 -364 2235.5 -381.5Q2223 -399 2201 -408Q2179 -417 2151 -417Q2109 -417 2081.5 -387.5Q2054 -358 2054 -308V-217Q2054 -168 2081.5 -138Q2109 -108 2151 -108ZM2844 12Q2750 12 2680.5 -28Q2611 -68 2573 -147Q2535 -226 2535 -344Q2535 -462 2573 -543.5Q2611 -625 2680.5 -667.5Q2750 -710 2844 -710Q2940 -710 3003.5 -670Q3067 -630 3105 -546L2974 -478Q2961 -522 2930.5 -548.5Q2900 -575 2844 -575Q2777 -575 2736.5 -531.5Q2696 -488 2696 -405V-293Q2696 -211 2736.5 -167Q2777 -123 2844 -123Q2900 -123 2933.5 -153.5Q2967 -184 2983 -227L3107 -155Q3068 -76 3004 -32Q2940 12 2844 12ZM3373 0H3225V-525H3373V-411H3378Q3384 -440 3400 -466Q3416 -492 3443.5 -508.5Q3471 -525 3512 -525H3538V-387H3501Q3458 -387 3429.5 -379.5Q3401 -372 3387 -355Q3373 -338 3373 -307ZM4105 0H4023Q3996 0 3972.5 -13.5Q3949 -27 3935 -53.5Q3921 -80 3921 -117V-130L3953 -92H3917Q3905 -41 3864 -14.5Q3823 12 3763 12Q3684 12 3642 -30.5Q3600 -73 3600 -141Q3600 -197 3627.5 -233Q3655 -269 3705.5 -287Q3756 -305 3825 -305H3908V-338Q3908 -376 3888 -398.5Q3868 -421 3821 -421Q3777 -421 3751 -402Q3725 -383 3708 -359L3620 -437Q3652 -484 3701 -510.5Q3750 -537 3832 -537Q3943 -537 3999.5 -487.5Q4056 -438 4056 -345V-115H4105ZM3908 -221H3836Q3793 -221 3771 -206Q3749 -191 3749 -162V-147Q3749 -119 3767 -105Q3785 -91 3818 -91Q3843 -91 3863 -98Q3883 -105 3895.5 -120Q3908 -135 3908 -159ZM4250 0V-410H4176V-525H4250V-587Q4250 -663 4290.5 -701.5Q4331 -740 4407 -740H4503V-625H4398V-525H4503V-410H4398V0ZM4877 0H4789Q4713 0 4673 -39Q4633 -78 4633 -153V-410H4559V-525H4596Q4626 -525 4637 -539.5Q4648 -554 4648 -581V-667H4781V-525H4885V-410H4781V-115H4877Z"/></svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

@@ -161,6 +161,7 @@ min_radius false
mirror false
motion_link false
move false
nav_settings false
new false
normal false
offset false
+104 -46
View File
@@ -85,6 +85,7 @@
"Bottom Right": "أسفل اليمين",
"Boundary": "الحد",
"Bounding box": "الصندوق المحيط",
"Bridge": "جسر",
"CHECK": "تحقق",
"COMPONENTS": "المكوّنات",
"CONFIGURATIONS": "التكوينات",
@@ -744,22 +745,22 @@
"ai.prefs.availability": "التوفر",
"ai.prefs.background_commands": "تشغيل الأوامر البطيئة في الخلفية",
"ai.prefs.connect_apps": "إضافة SolidCraft إلى تطبيقات الذكاء الاصطناعي",
"ai.prefs.connect_apps_note": "إيقافه يزيل الإدخالات مجدداً.\n\nعند بدء تشغيل SolidCraft، يُضاف كخادم MCP إلى تطبيقات الذكاء الاصطناعي الموجودة على هذا الحاسوب (OpenCode وClaude Desktop وClaude Code وCursor وCodex وGemini CLI وCopilot CLI وWindsurf وZed وVS Code)، ليتمكن الوكيل من استخدامه دون أي إعداد. لا يُضاف إلا مُدخل solidcraft أو يُحدَّث مساره؛ ويُترك المُدخل الذي غيّرته كما هو، ويُنسخ الملف احتياطيًا أولًا. عند الإيقاف تُزال المُدخلات التي أضافها. الأمر «المساعدة > ربط مساعدي الذكاء الاصطناعي…» يفعل ذلك يدويًا.",
"ai.prefs.connect_apps_note": "إيقافه يزيل الإدخالات مجددًا.\n\nعند بدء تشغيل SolidCraft، يُضاف كخادم MCP إلى تطبيقات الذكاء الاصطناعي الموجودة على هذا الحاسوب (OpenCode وClaude Desktop وClaude Code وCursor وCodex وGemini CLI وCopilot CLI وWindsurf وZed وVS Code)، ليتمكن الوكيل من استخدامه دون أي إعداد. لا يُضاف إلا مُدخل solidcraft أو يُحدَّث مساره؛ ويُترك المُدخل الذي غيّرته كما هو، ويُنسخ الملف احتياطيًا أولًا. عند الإيقاف تُزال المُدخلات التي أضافها. الأمر «المساعدة > ربط مساعدي الذكاء الاصطناعي…» يفعل ذلك يدويًا.",
"ai.prefs.connect_at_start": "توصيل آخر وكيل عند البدء",
"ai.prefs.connect_at_start_note": "يبدأ في الخلفية الوكيل الذي اتصلت به آخر مرة (أو الوكيل الافتراضي) في كل مرة يبدأ فيها SolidCraft، ليكون جاهزًا للمحادثة. لا يحدث ذلك عند بدء SolidCraft مع --control. إذا تعذّر الاتصال، يعرض المساعد «فشل الاتصال» وزر «إعادة المحاولة».",
"ai.prefs.follow_camera": "اتباع الكاميرا",
"ai.prefs.follow_camera": "تتبّع الكاميرا",
"ai.prefs.follow_camera_off": "تتبّع الكاميرا التلقائي متوقف.",
"ai.prefs.follow_camera_on": "تتجه الكاميرا نحو الرسومات التي ينشئها الوكيل.",
"ai.prefs.intro": "وكلاء الذكاء الاصطناعي في SolidCraft.",
"ai.prefs.make_default": "تعيين كافتراضي",
"ai.prefs.make_default": "تعيين افتراضيًا",
"ai.prefs.no_agents": "لا يوجد وكلاء بعد. أضف وكيلًا أو حدّث القائمة للعثور على الوكلاء المثبّتين.",
"ai.prefs.no_saved_approvals": "لا توجد موافقات محفوظة.",
"ai.prefs.open_at_start": "فتح المحادثة عند البدء",
"ai.prefs.open_at_start_note": "يعرض لوحة المساعد (أو نافذتها المستقلة) في كل مرة يبدأ فيها SolidCraft. لا يحدث ذلك عند بدء SolidCraft مع --control.",
"ai.prefs.override_all_warning": "قد يحفظ هذا الوكيل التصميم أو يكتب فوقه أو يصدّره أو يستبدله دون أن يسأل.",
"ai.prefs.permission_all": "فعل كل شيء",
"ai.prefs.permission_all_summary": "لا يسأل أبداً",
"ai.prefs.permission_ask": "السؤال أولاً",
"ai.prefs.permission_all": "تنفيذ كل شيء",
"ai.prefs.permission_all_summary": "لا يسأل أبدًا",
"ai.prefs.permission_ask": "السؤال أولًا",
"ai.prefs.permission_ask_summary": "يسأل عن كل تغيير",
"ai.prefs.permission_edits": "إجراء تعديلات",
"ai.prefs.permission_edits_summary": "يعدّل بحرية ويسأل عن الباقي",
@@ -1296,6 +1297,7 @@
"cmd.timeline_stop": "إيقاف السجل",
"cmd.timeline_suppress": "تعطيل الميزة",
"cmd.ui.assistant": "إظهار المساعد أو إخفاؤه",
"cmd.view.navigator": "متصفح العرض المخصص",
"cmd.view.render_browser": "متصفح التصيير",
"cmd.view.render_dock": "نقل لوحة التصيير",
"cmd.view.render_focus": "عرض تركيز التصيير",
@@ -1396,6 +1398,9 @@
"dialog.custom_axis": "↖ محور مخصص",
"dialog.dimension_insert_hint": "انقر على بُعد قائد آخر لإدراج اسمه",
"dialog.dimension_name": "البُعد: {name}",
"dialog.dimension_step_down": "إنقاص بمقدار {step}",
"dialog.dimension_step_expression": "يتغير الرقم فقط بالخطوات؛ يبقى التعبير كما كُتب",
"dialog.dimension_step_up": "زيادة بمقدار {step}",
"dialog.edit_title": "تعديل {title}",
"dialog.no_shown_body": "لا يوجد جسم ظاهر لتغييره: أظهر جسمًا، أو اختر «جسم جديد»",
"dialog.pattern_sketch_not_object": "اختر أجسامًا أو ميزات: الرسم ليس أيًّا منهما. كرّر منحنياته بأداة النمط أو المرآة داخل الرسم، أو ابثقه أولًا.",
@@ -1403,6 +1408,7 @@
"dialog.selected_count": "↖ {count} محدد",
"dialog.selection_constraint": "قيد {id}",
"dialog.selection_external_curve": "{sketch} · منحنى {id}",
"dialog.selection_external_point": "{point} · {sketch}",
"dialog.selection_guidance": "حدد مُدخلًا لتغييره. انقر على العناصر المحددة لإزالتها؛ Ctrl/Cmd مع النقر يبدّل تحديدها أيضًا. راجع المعاينة ثم اضغط موافق.",
"dialog.selection_midpoint": "نقطة المنتصف · {id}",
"dialog.selection_profile": "{sketch} · مقطع {number}",
@@ -1420,6 +1426,7 @@
"document.read_only_save": "فُتح هذا التصميم للقراءة فقط: احفظه كملف جديد",
"document.save_changes": "حفظ التغييرات على {name}؟",
"document.save_copy": "حفظ نسخة…",
"document.tab_unsaved_changes": "تغييرات غير محفوظة",
"document.unsaved_changes": "في {name} تغييرات غير محفوظة. إن لم تحفظها فستضيع.",
"drive.rigid": "{joint} مفصل صلب: يثبّت أجزاءه في مكانها، لذا لا يوجد ما يمكن تحريكه. لتتحرك الأجزاء، غيّر نوعه في «تعديل المفصل»: «دوراني» للدوران، «منزلق» للانزلاق، «أسطواني» لكليهما.",
"drive.stopped_by_contact": "توقف عند {value}: سيخترق {a} الجسم {b}",
@@ -1440,6 +1447,9 @@
"each rail's curves must be in one sketch": "يجب أن تكون منحنيات كل دليل في رسم واحد",
"feature computation ended without a result": "انتهى حساب الميزة دون نتيجة",
"file.open.drawing_filter": "التصاميم وملفات CAD والشبكات والرسومات",
"file.open.portal_fallback.no_portal_service": "منتقي الملفات الذي فُتح ليس تابعًا لسطح المكتب: خدمة منتقي الملفات في سطح المكتب غير متاحة.",
"file.open.portal_fallback.no_session_bus": "منتقي الملفات الذي فُتح ليس تابعًا لسطح المكتب: لا يوجد ناقل جلسات D-Bus.",
"file.open.portal_fallback.xwayland": "منتقي الملفات الذي فُتح ليس تابعًا لسطح المكتب: في XWayland ترفض البوابة النافذة الأصلية.",
"file_load.built": "بُني حتى الآن: {built} من {total} ميزة.",
"file_load.converting": "تحويل الجسم الصلب {done} من {total}",
"file_load.inserting": "إدراج الهندسة",
@@ -1600,7 +1610,7 @@
"help.parts.resize": "يغيّر مقاس قطعة قياسية مدرجة أو طولها ويعيد بناءها، وتبقيها مفاصلها مثبتة في مكانها. استخدمه عندما يتبين أن برغيًا أطول من اللازم أو أن ثقبًا يحتاج إلى مقاس آخر.",
"help.plastic.assign_rule": "يعيّن قاعدة بلاستيك لأجسام، فتأخذ ميزاتها البلاستيكية ميلها وخلوصها منها كقيم افتراضية. استخدمه لإعداد قطعة مقولبة مرة واحدة لكل ميزاتها.",
"help.plastic.boss": "يضيف نتوءًا لمسمار على وجه: عمودًا مع ثقب اختياري وميل وتقويس عند الجذر وأضلاع تقوية. استخدمه لنقاط البراغي في الهياكل المقولبة أو المطبوعة.",
"help.plastic.lip": "يضيف شفة أو أخدودًا مطابقًا على طول حافة جسم مفرَّغ. استخدمه ليتمركز نصفا الهيكل أحدهما على الآخر ويُغلقا بإحكام.",
"help.plastic.lip": "يضيف شفة أو أخدودًا مطابقًا على طول إطار جسم مفرَّغ (فرّغ الجسم بفتح أحد وجوهه أولًا، ثم اختر الإطار المحيط بتلك الفتحة). استخدمه ليتمركز نصفا الهيكل أحدهما على الآخر ويُغلقا بإحكام.",
"help.plastic.manage_rules": "ينشئ قواعد البلاستيك ويعدّلها: المادة وسماكة الجدار وأنصاف الأقطار والخلوص والميل. استخدمها للحفاظ على اتساق ميزات القطعة المقولبة.",
"help.plastic.rest": "يضيف مسندًا على وجه: وسادة مستديرة أو مستطيلة، مصمتة أو مجوفة، مع ميل. استخدمه كدعامة أو مُباعِد في هيكل مقولب.",
"help.plastic.snap_fit": "يضيف خطاف وصلة كبس على وجه، بطوله وسماكته ونتوء التثبيت. استخدمه لتثبيت القطع معًا بلا براغي.",
@@ -1918,7 +1928,7 @@
"joint.limit_loop": "{side} {value}: لا يمكن لحلقة مغلقة أن تنغلق بعده",
"joint.limit_range": "{side}: لا تلامس ضمن {range}، تُرك كما كان",
"joint.limit_turn": "{side} {value}: لا تلامس ضمن دورة واحدة",
"joint.limits_overlapping": "متداخلة بالفعل هنا: {pairs}. لا توقف البحث إلا إذا تداخلت أعمق.",
"joint.limits_overlapping": "متداخلة بالفعل هنا: {pairs}. لا توقف البحث إلا إذا ازداد تداخلها.",
"joint.one_body": "كلا الاختيارين على {body}. اختر الثاني على قطعة أخرى.",
"joint.one_component": "هذه القطع أجسام لمكوّن واحد: {bodies}. المفصل يحرّك مكوّنًا مقابل آخر، لذا تحتاج كل قطعة إلى مكوّن خاص بها.",
"joint.rigid_group_one_component": "هذه الأجسام وعددها {count} كلها في مكوّن واحد (أو في التصميم نفسه): استخدم {command} أولًا.",
@@ -1933,7 +1943,7 @@
"joint_move.fine": "الخطوة بعيدًا عن المحور",
"joint_move.fixed": "لا يملك هذا الجزء محور مفصل قابلًا للحركة.",
"joint_move.help": "تحريك — اسحب سهمًا أو قوسًا. يلغى السحب الحالي بمفتاح Esc.",
"joint_move.legacy_hint": "إيقاف: لوحة التحريك السابقة.",
"joint_move.legacy_hint": "عند الإيقاف: لوحة التحريك السابقة.",
"joint_move.precision": "اسحب خارج الدليل المتقطع للخطوة الدقيقة.",
"joint_move.rotation": "الدوران من نقطة البداية",
"joint_move.select": "اختر وجهًا أو جزءًا واحدًا من التجميع، ثم اختر تحريك.",
@@ -1999,6 +2009,7 @@
"material.selection.mixed": "مواد مختلفة",
"measure.at": "عند",
"measure.item": "العنصر {number}",
"measure.line_to_centre": "من الخط إلى المركز",
"measure.quick_copied": "تم نسخ القياس",
"measure.quick_copy": "انقر لنسخ القياس",
"measure.quick_edges": "{count} حواف",
@@ -2240,7 +2251,7 @@
"prefs.anti_aliasing_amd_dx12": "يستخدم تنعيم الحواف 1× لأن فحص بدء التشغيل لم يرسم شيئًا مع أخذ العينات المتعددة ونجح عند 1×. يمكنك اختيار إعداد آخر أعلاه؛ أعد التشغيل لتطبيقه إن نجح الفحص.",
"prefs.anti_aliasing_note": "ينعّم الحواف المسننة.",
"prefs.appearance.colour_vision_help": "يغيّر الألوان ذات الدلالة: حالات الرسم والمحاور والثنيات والتحليلات والأيقونات.",
"prefs.appearance.desktop_only": "لسطح المكتب فقط",
"prefs.appearance.desktop_only": "لتطبيق سطح المكتب فقط",
"prefs.appearance.follow_help": "يعيد التحميل عندما تعيد أداة أخرى كتابة الملف.",
"prefs.appearance.interface_scale": "مقياس الواجهة",
"prefs.appearance.next_themes": "السمات التالية",
@@ -2250,11 +2261,11 @@
"prefs.appearance.theme_count": "{count} سمات",
"prefs.appearance.theme_own": "ألوان السمة",
"prefs.appearance.viewport_colours": "ألوان العرض ثلاثي الأبعاد",
"prefs.appearance.viewport_logo": "منفذ العرض والشعار",
"prefs.appearance.viewport_logo": "منطقة العرض والشعار",
"prefs.applies_on_restart": "يُطبَّق عند إعادة التشغيل",
"prefs.assistant": "المساعد",
"prefs.assistant_connecting": "الاتصال",
"prefs.assistant_follow_help": "تحرّك عروض Look At للرسم المنظور مع المؤشر.",
"prefs.assistant_follow_help": "النظر إلى الرسومات يحرّك العرض مع المؤشر.",
"prefs.assistant_limit": "الحد",
"prefs.assistant_limited": "محدود",
"prefs.assistant_pointer_speed": "سرعة المؤشر",
@@ -2262,21 +2273,21 @@
"prefs.assistant_seconds_aria": "الثواني",
"prefs.assistant_use_care": "استخدم بحذر",
"prefs.auto_operation": "اختيار العملية تلقائيًا",
"prefs.auto_operation_note": "ضم أو جسم جديد أو قطع، حسب ما تلامسه المادة.",
"prefs.auto_operation_note": "ضم أو جسم جديد أو قص، حسب ما تلامسه المادة.",
"prefs.axes": "المحاور",
"prefs.axis": "المحور",
"prefs.blur_cost": "تكلفة العرض النسبية. زيادة الأشرطة تعني عادةً مزيدًا من العمل.",
"prefs.blur_device": "غير متاح على جهاز الرسومات أو مسار العرض هذا",
"prefs.blur_device": "غير متاح على جهاز الرسوميات أو مسار العرض هذا",
"prefs.blur_guard": "خُفّضت جودة التمويه للحفاظ على استجابة الإطارات. لم يتغير نصف القطر.",
"prefs.blur_off": "إيقاف",
"prefs.blur_reduce_transparency": "معطّل بسبب إعداد تقليل الشفافية في النظام",
"prefs.blur_software": "غير متاح مع الرسومات البرمجية (gpu-software)",
"prefs.blur_software": "غير متاح مع الرسوميات البرمجية (gpu-software)",
"prefs.blur_source": "غير متاح في عرض مساحة العمل هذا",
"prefs.blur_web": "غير متاح في مسار عرض الويب هذا",
"prefs.bodies_folders": "مجلدات الأجسام",
"prefs.bodies_folders_always": "دائمًا",
"prefs.bodies_folders_never": "أبدًا",
"prefs.bodies_folders_several": "عدة",
"prefs.bodies_folders_several": "عند التعدد",
"prefs.bottom": "أسفل",
"prefs.bottom_centre": "أسفل الوسط",
"prefs.bottom_right": "أسفل اليمين",
@@ -2331,6 +2342,13 @@
"prefs.dialogs_edge": "عند حافة العرض",
"prefs.dialogs_left_column": "في العمود الأيسر",
"prefs.dialogs_note": "مكان فتح حوارات الأوامر: مثبتة عند حافة العرض، أو في العمود الأيسر مكان المستعرض والسجل، اللذين يعودان كما كانا عند إغلاق الحوار.",
"prefs.dimension_step_angle": "ما تضيفه أسهم النافذة والسهمان لأعلى ولأسفل والعجلة إلى الزاوية",
"prefs.dimension_step_length": "ما تضيفه أسهم النافذة والسهمان لأعلى ولأسفل والعجلة إلى الطول",
"prefs.dimension_steps": "خطوات النافذة",
"prefs.dimension_values": "قيم الأبعاد",
"prefs.dimension_values_note": "مكان كتابة قيمة البعد. للنافذة أسهم تغيّرها بخطوات؛ تضع أداة البعد النص أولًا.",
"prefs.dimension_values_view": "في العرض",
"prefs.dimension_values_window": "في نافذة",
"prefs.display": "العرض",
"prefs.edges": "الحواف والتظليل",
"prefs.extend": "توسيع",
@@ -2368,7 +2386,7 @@
"prefs.graphics_note": "وازن بين السرعة والنعومة. كل خيار يعرض أثره على عيّنة.",
"prefs.graphics_page.current_view": "العرض الحالي",
"prefs.graphics_page.fastest": "الأسرع",
"prefs.graphics_page.fold_items": "طي العناصر",
"prefs.graphics_page.fold_items": "تلخيص العناصر",
"prefs.graphics_page.in_view": "داخل العرض",
"prefs.graphics_page.live_details": "تفاصيل مباشرة",
"prefs.graphics_page.own_mix": "مزيجك الخاص",
@@ -2377,7 +2395,7 @@
"prefs.graphics_page.restart": "تلزم إعادة التشغيل",
"prefs.graphics_page.sharpest": "الأكثر وضوحًا",
"prefs.graphics_page.single_surface_analysis": "تحليل سطح واحد",
"prefs.graphics_page.status_chips": "شرائح الحالة",
"prefs.graphics_page.status_chips": "شارات الحالة",
"prefs.graphics_page.subtitle": "وازن بين السرعة والنعومة.",
"prefs.graphics_page.supersampling": "التنعيم الفائق",
"prefs.graphics_page.supersampling_adaptive": "فقط أثناء سكون العرض",
@@ -2424,7 +2442,7 @@
"prefs.layout_page.icons_labels": "الأيقونات + التسميات",
"prefs.layout_page.ok_cancel": "موافق وإلغاء",
"prefs.layout_page.on_hover": "عند مرور المؤشر",
"prefs.layout_page.open": "فتح",
"prefs.layout_page.open": "تُفتح",
"prefs.layout_page.origin_bodies": "الأصل والأجسام في الأعلى",
"prefs.layout_page.panels": "اللوحات",
"prefs.layout_page.pinned_menus": "استبعاد الأوامر المثبتة من القوائم",
@@ -2464,8 +2482,8 @@
"prefs.navigation.cube_compact": "المكعب",
"prefs.navigation.device": "الجهاز",
"prefs.navigation.free": "حر",
"prefs.navigation.orbit_style": "نمط الدوران",
"prefs.navigation.radial_help": "اضغط مطولاً أو انقر سريعاً بالزر الأيمن لعرض حلقة من الأدوات.",
"prefs.navigation.orbit_style": "نمط التدوير",
"prefs.navigation.radial_help": "اضغط مطولًا أو انقر سريعًا بالزر الأيمن لعرض حلقة من الأدوات.",
"prefs.navigation.turntable": "طاولة دوارة",
"prefs.navigation_note": "كيف تحرك الفأرة ولوحة اللمس والفأرة ثلاثية الأبعاد العرض.",
"prefs.navigator_fit": "ملاءمة النموذج بعد تغيير العرض من متصفح العرض",
@@ -2483,7 +2501,7 @@
"prefs.origin_plane_names_note": "الأسماء المعروضة في المستعرض والحوارات والقوائم. {top} هو XY و{front} هو XZ و{right} هو YZ، والمحور Z للأعلى. تحتفظ الأوامر والسكربتات والتصاميم المحفوظة بـ XY وXZ وYZ.",
"prefs.overall_speed": "السرعة العامة",
"prefs.parameter_list_rows": "صفوف قائمة المعاملات",
"prefs.parameter_list_rows_tip": "الحد الأقصى للمعلمات التي يسردها السهم لأسفل في مربع تعبير فارغ.",
"prefs.parameter_list_rows_tip": "الحد الأقصى للمعاملات التي يسردها السهم لأسفل في مربع تعبير فارغ.",
"prefs.persistent_ribbon_pressed": "تمييز أوامر الشريط النشطة",
"prefs.persistent_ribbon_pressed_help": "تمييز أوامر الشريط أثناء تفعيل تأثيراتها. أوقف هذا الخيار للاحتفاظ بالمظهر المحايد السابق ومساعدة الأوامر.",
"prefs.perspective_fov": "مجال الرؤية",
@@ -2541,6 +2559,8 @@
"prefs.section_hatch_by_part": "حسب الجزء",
"prefs.section_hatch_one": "نمط واحد",
"prefs.select": "تحديد",
"prefs.select_hidden_edges": "تحديد الحواف المخفية في العرض المظلل مع الحواف المخفية",
"prefs.select_hidden_edges_help": "يتيح تحديد الحواف عبر الأسطح عند تفعيل العرض المظلل مع الحواف المخفية، بما في ذلك استخدام أداة Fillet. يحافظ إيقافه على سلوك التحديد في v0.30.1. تظل الأجسام المخفية غير قابلة للتحديد.",
"prefs.select_one_item": "تحديد عنصر واحد",
"prefs.select_other_hidden": "تحديد العناصر الهندسية المخفية باستخدام «تحديد عنصر آخر»",
"prefs.select_other_hidden_help": "عند التفعيل: تضمين الأجسام والمخططات المخفية والحواف المحجوبة قرب المؤشر. عند التعطيل: استخدام القائمة الأصلية للعناصر الهندسية المرئية أسفل المؤشر.",
@@ -2552,19 +2572,21 @@
"prefs.shortcuts_import": "استيراد",
"prefs.shortcuts_intro": "مفاتيح كل أمر.",
"prefs.shortcuts_not_assigned": "غير معيّن",
"prefs.shortcuts_press": "اضغط مفتاحاً...",
"prefs.shortcuts_press": "اضغط مفتاحًا...",
"prefs.single_surface_analysis": "استخدام تحليل سطح واحد",
"prefs.single_surface_analysis_help": "عند إيقاف هذا الخيار، يمكن إبقاء تظليل السطح وتحليل الاستمرارية مفعّلين معًا. عند تشغيله، يبقى آخر تحليل تم بدؤه أو تغييره فقط.",
"prefs.sketch.align_points": "المحاذاة مع نقاط الرسم الأخرى",
"prefs.sketch.align_points_note": "تتحاذى الخطوط أثناء الرسم مع النقاط على المحورين معًا.",
"prefs.sketch.auto_dimensions": "إضافة كل الأبعاد للأشكال الجديدة",
"prefs.sketch.auto_dimensions_note": "القيم المدخلة وكل بُعد يثبّت الشكل.",
"prefs.sketch.auto_locate": "التحديد انطلاقًا من أصل الرسم",
"prefs.sketch.auto_locate": "تحديد الموضع من أصل الرسم",
"prefs.sketch.auto_locate_note": "مع إضافة كل الأبعاد.",
"prefs.sketch.center_arc": "قوس المركز يتبع المؤشر",
"prefs.sketch.center_arc": "القوس بنقطة مركز يتبع المؤشر",
"prefs.sketch.click_selects": "النقر يحدد",
"prefs.sketch.conflict_colour": "لون التعارض",
"prefs.sketch.drawing": "الرسم",
"prefs.sketch.ellipse_axes": "رسم القطوع الناقصة مع محاورها",
"prefs.sketch.ellipse_axes_note": "المحوران الأكبر والأصغر كخطوط مساعدة، لتحديد أبعاد أنصاف المحاور والمحاور. عند الإيقاف: القطع الناقص وحده، ويعطي D عليه نصف قطره الأصغر أينما سُحبت القيمة، مرسومًا ومُعلَّمًا بـ R كما في السابق.",
"prefs.sketch.exit_keep": "إبقاء",
"prefs.sketch.exit_previous": "العودة إلى العرض السابق",
"prefs.sketch.exit_unless_rotated": "إلا إذا تم التدوير",
@@ -2576,7 +2598,7 @@
"prefs.sketch.prefer_free_points": "تفضيل النقاط القابلة للتحريك عند تداخلها",
"prefs.sketch.project_options": "السؤال عن خيارات الإسقاط أولًا",
"prefs.sketch.recent_snap": "الالتقاط عند تقاطع دليلين",
"prefs.sketch.select_other_hidden": "اختيار آخر يشمل الهندسة المخفية",
"prefs.sketch.select_other_hidden": "تحديد آخر يشمل الهندسة المخفية",
"prefs.sketch.shortcut_cycles_modes": "الاختصار مجددًا يبدّل الوضع",
"prefs.sketch.shortcut_cycles_modes_tip": "عند الإيقاف: تبدأ الأداة مجددًا.",
"prefs.sketch.snapping_guides": "الالتقاط والأدلة",
@@ -2699,7 +2721,7 @@
"prefs.validation.each_step": "بعد كل خطوة",
"prefs.validation.label": "فحص النواة الكامل",
"prefs.validation.off": "متوقف (تجريبي)",
"prefs.validation_note": "بعد كل خطوة: يفحص كل عملية سحب ودمج وتقويس.\nمرة لكل ميزة: يفحص ناتج كل ميزة مرة واحدة.\nمتوقف (تجريبي): لا فحص.",
"prefs.validation_note": "بعد كل خطوة: يفحص كل عملية كنس وعملية منطقية وتقويس.\nمرة لكل ميزة: يفحص ناتج كل ميزة مرة واحدة.\nمتوقف (تجريبي): لا فحص.",
"prefs.value_boxes_in_view": "إظهار القيم بجانب مقابضها",
"prefs.value_boxes_in_view_tip": "مسافة البثق ونصف قطر التدوير... في مربع داخل العرض.",
"prefs.view": "سلوك العرض",
@@ -4104,7 +4126,7 @@
"settings.display_quality_note": "المستويات الأدق ترسم الأوجه والحواف المنحنية بنعومة أكبر وتستغرق وقتًا أطول لإنشاء الشبكة. يتغير العرض فقط، لا التصميم ولا الملفات المصدّرة.",
"settings.double_click_components": "النقر المزدوج على مكوّن لتنشيطه",
"settings.frame_rate_details_note": "يضيف رسمًا لأزمنة الإطارات الأخيرة مع المثلثات المرسومة فوقه، ومدرّجًا تكراريًا لأزمنة الإطارات، وما رسمته وحدة GPU. انقر معدل الإطارات في العرض لإظهارها أو إخفائها.",
"settings.frame_rate_note": "يعرض الإطارات في الثانية في الزاوية اليمنى السفلية من العرض. أثناء تفعيله يُعاد رسم العرض باستمرار.",
"settings.frame_rate_note": "يعرض الإطارات في الثانية في الزاوية اليمنى السفلية من العرض.",
"settings.insert_lists_open_designs": "إدراج تصميم يسرد التصاميم المفتوحة أولًا",
"settings.measure_axis_distances": "مسافات المحاور في القياس",
"settings.measure_axis_distances_help": "إظهار مركّبات الأبعاد على محاور العالم بجانب المسافة الكلية أثناء فتح أداة القياس.",
@@ -4155,6 +4177,32 @@
"sketch.dof_left": "تبقّت {count} درجات حرية",
"sketch.dof_left_one": "تبقّت {count} درجة حرية",
"sketch.draw_curves": "الرسم كـ {linetype}",
"sketch.error.closed_curve_two_crossings": "a closed curve needs two crossings to trim",
"sketch.error.nothing_to_break": "nothing to break here",
"sketch.error.offset_fillet_chamfer": "`{id}` is an offset, and its corners follow its source curves: round or cut the source corners before offsetting, or break the offset association first",
"sketch.error.offset_trim": "`{id}` is an offset, and its ends follow its source curves: edit the source curves instead, or break the offset association first",
"sketch.hint.arc.center_point": "Arc: click center and start, go round either way and click the end, or type a signed sweep",
"sketch.hint.arc.three_point": "Arc: click start, end, then a point on the arc",
"sketch.hint.arc3d": "3D Arc: click start, end, then a point on the arc (points may leave the sketch plane)",
"sketch.hint.break": "Break: click a curve where it should split",
"sketch.hint.circle.center": "Circle: click the center, then a point on the circle",
"sketch.hint.constraint.generic": "Constraint: pick the sketch entities",
"sketch.hint.constraint.horizontal_vertical": "Horizontal/Vertical: pick a line, two points, or a point and a line; hold Shift to pick a line midpoint",
"sketch.hint.constraint.midpoint": "MidPoint: pick a point and a line, or two lines to center the second on the first",
"sketch.hint.dimension": "Dimension: pick one or two entities and type the value (or click to place it first); click a dimension to edit it; Enter applies",
"sketch.hint.extend": "Extend: click a curve near the end to extend (Shift: click two curves to extend both to where they meet)",
"sketch.hint.fallback": "Click in the sketch",
"sketch.hint.line": "Line: click points; right-click or Esc to finish",
"sketch.hint.line3d": "3D Line: click world points; right-click or Esc to finish (points may leave the sketch plane)",
"sketch.hint.open_done": "Open done",
"sketch.hint.point3d": "3D Point: click where a 3D point goes",
"sketch.hint.rectangle.center": "Center rectangle: click the center, then a corner",
"sketch.hint.rectangle.rounded": "Rounded rectangle: click two opposite corners (Tab to the radius box to type the corner radius)",
"sketch.hint.rectangle.three_point": "3-point rectangle: click two points of one edge, then the width",
"sketch.hint.rectangle.two_point": "Rectangle: click two opposite corners",
"sketch.hint.slot": "Slot: click both ends, then the width",
"sketch.hint.spline3d": "3D Spline: click fit points in 3D; right-click or Esc to finish",
"sketch.hint.trim": "Trim: click the piece of a curve to remove, or drag across the pieces to remove",
"sketch.make_selection": "تحويل التحديد إلى {linetype}",
"sketch.open_ends": "مفتوحة {count}",
"sketch.status_conflict": "تعارض القيود",
@@ -4214,13 +4262,13 @@
"thread.automatic_size": "حجم تلقائي",
"thread.chamfer_depth_needed": "مطلوب لهذا الشكل",
"thread.designation": "التسمية",
"thread.drill_range": "مثقاب صانع اللقمة {drill} مم. القطر الأصغر القياسي للسن الداخلي {minor} مم. يُقبل مثقاب من {low} إلى {high} مم.",
"thread.drill_range": "مثقاب التسنين الذي يوصي به صانعو ذكور التسنين {drill} مم. القطر الأصغر القياسي للسن الداخلي {minor} مم. يُقبل مثقاب من {low} إلى {high} مم.",
"thread.drill_range_custom": "المثقاب هو القطر الأكبر ناقص الخطوة، {drill} مم. القطر الأصغر القياسي للسن الداخلي {minor} مم. يُقبل مثقاب من {low} إلى {high} مم.",
"thread.drill_range_taper": "مثقاب صانع اللقمة {drill} مم. القطر الأصغر القياسي عند نهاية السن {minor} مم. يُقبل مثقاب من {low} إلى {high} مم.",
"thread.drill_range_taper": "مثقاب التسنين الذي يوصي به صانعو ذكور التسنين {drill} مم. القطر الأصغر القياسي عند نهاية السن {minor} مم. يُقبل مثقاب من {low} إلى {high} مم.",
"thread.end_square": "قائمة",
"thread.fade_short": "1.25 P (ISO 3508)",
"thread.fade_standard": "2.5 P (ISO 3508)",
"thread.fits_the_face": "يناسب الوجه، مثلاً {example}",
"thread.fits_the_face": "يناسب الوجه، مثلًا {example}",
"thread.form_bspp": "سن أنابيب G (ISO 228-1)",
"thread.form_bspt": "سن أنابيب مخروطي R، Rc (ISO 7-1)",
"thread.form_npt": "سن أنابيب مخروطي NPT (ASME B1.20.1)",
@@ -4477,7 +4525,7 @@
"ui.agent_chat_no_images": "هذا الوكيل لا يقبل الصور",
"ui.agent_chat_no_picture": "لا توجد صورة في الحافظة",
"ui.agent_chat_no_tool_call": "لم يستخدم النموذج أدوات SolidCraft، لذا لم يتغيّر التصميم. اختر نموذجًا يدعم استدعاء الأدوات؛ راجع «النماذج المحلية» في دليل محادثة الوكيل.",
"ui.agent_chat_node_too_old": "إصدار Node.js ‏{version} قديم جدًا لهذا الوكيل. ثبّت Node.js 20.10 أو أحدث، ثم اضغط على تحديث.",
"ui.agent_chat_node_too_old": "إصدار Node.js {version} قديم جدًا لهذا الوكيل. ثبّت Node.js 20.10 أو أحدث، ثم اضغط تحديث.",
"ui.agent_chat_none_found": "لم يُعثر على وكيل برمجي. ثبّت أحد هذه ثم اضغط تحديث:",
"ui.agent_chat_none_found_short": "لم يُعثر على وكيل",
"ui.agent_chat_not_installed": "غير مثبت",
@@ -4518,7 +4566,7 @@
"ui.agent_chat_send_now_tip": "إيقاف خطوة الوكيل الحالية وإرسال هذه بعدها (Ctrl+Enter)",
"ui.agent_chat_setup_body": "يتواصل SolidCraft مع وكيل برمجة مثبّت على هذا الحاسوب. اختر واحدًا من التفضيلات › الوكيل.",
"ui.agent_chat_setup_title": "إعداد مساعد",
"ui.agent_chat_side": "إرساء المحادثة",
"ui.agent_chat_side": "تثبيت المحادثة",
"ui.agent_chat_signed_in": "سجّل الدخول",
"ui.agent_chat_state_auth": "يلزم تسجيل الدخول",
"ui.agent_chat_state_busy": "جارٍ العمل…",
@@ -4583,10 +4631,10 @@
"ui.ai_key_note": "يُخزّن في سلسلة مفاتيح النظام، وليس في إعدادات SolidCraft أبدًا. اتركه فارغًا لخادم محلي.",
"ui.ai_keychain_error": "رفضت سلسلة مفاتيح النظام: {error}",
"ui.ai_kind": "النوع",
"ui.ai_mode_all": "فعل كل شيء",
"ui.ai_mode_all": "تنفيذ كل شيء",
"ui.ai_mode_all_note": "لا شيء يسأل أولًا. تبقى تقارير الأعطال محظورة وتظل حدود المجلدات سارية.",
"ui.ai_mode_all_warning": "يمكن للوكيل حفظ تصميمك والكتابة فوقه وتصديره واستبداله دون سؤال. استخدم هذا فقط مع وكيل تثق به، وعلى تصاميم حفظتها.",
"ui.ai_mode_ask": "السؤال أولاً",
"ui.ai_mode_ask": "السؤال أولًا",
"ui.ai_mode_ask_note": "كل تغيير في التصميم وكل إجراء على الملفات ينتظر سماحك.",
"ui.ai_mode_edits": "إجراء تعديلات",
"ui.ai_mode_edits_note": "أوامر النمذجة تعمل دون سؤال؛ أما الحفظ والفتح والتصدير وإجراءات الملفات أو الإجراءات الهدّامة الأخرى فتسأل.",
@@ -4757,21 +4805,21 @@
"ui.construction.ribbon_label": "خطوط مساعدة",
"ui.construction.side_hint": "خط إنشائي: انقر الجهة التي يمتد نحوها الخط؛ انقر بزر الفأرة الأيمن للبدء من جديد",
"ui.context_menu": "القائمة السياقية",
"ui.continuity_crease": "تجعّد",
"ui.continuity_crease": "ثنية",
"ui.continuity_curvature": "الانحناء",
"ui.continuity_curvature_change": "تغيّر الانحناء",
"ui.continuity_curvature_change_tip": "تغيّر الانحناء (G3): يتغير الانحناء أيضًا بسلاسة عبر خط الالتقاء.",
"ui.continuity_curvature_tip": "متصل الانحناء (G2): تمر الانعكاسات دون انكسار.",
"ui.continuity_g0": "G0 تجعّد",
"ui.continuity_g0": "G0 ثنية",
"ui.continuity_g1": "G1 مماس",
"ui.continuity_g2": "G2 انحناء",
"ui.continuity_gap": "فجوة",
"ui.continuity_position": "الموضع",
"ui.continuity_position_tip": "الموضع (G0): تلتقي الأسطح، مع تجعّد عند التقائها.",
"ui.continuity_position_tip": "الموضع (G0): تلتقي الأسطح، مع ثنية عند التقائها.",
"ui.continuity_smooth_curvature_change": "تغيّر انحناء سلس",
"ui.continuity_smooth_curvature_change_tip": "تغيّر انحناء سلس (G4): حتى طريقة تغيّر الانحناء تستمر بسلاسة عبر خط الالتقاء.",
"ui.continuity_tangent": "مماس",
"ui.continuity_tangent_tip": "مماس (G1): لا تجعّد، لكن الانحناء يقفز عبر خط الالتقاء.",
"ui.continuity_tangent_tip": "مماس (G1): لا ثنية، لكن الانحناء يقفز عبر خط الالتقاء.",
"ui.copy": "نسخ",
"ui.copy_details": "نسخ التفاصيل",
"ui.copy_details_tip": "انسخ الرسالة كاملة للبحث عنها أو للإبلاغ عنها.",
@@ -4797,6 +4845,7 @@
"ui.default_modelling_orientation": "اتجاه النمذجة الافتراضي",
"ui.delete": "حذف",
"ui.delete_select_first": "حدّد أولًا ما تريد حذفه: الميزات أو الأجسام أو المكوّنات أو هندسة الرسم",
"ui.dependents_select_first": "حدّد أولًا ما تريد سرد معتمداته",
"ui.depth": "العمق",
"ui.design": "التصميم",
"ui.design_properties.author": "المؤلف",
@@ -4922,7 +4971,7 @@
"ui.extract_done": "أصبح المكوّن تصميمًا مستقلًا، مرتبطًا هنا.",
"ui.extrude": "بثق",
"ui.extrude_auto_to_object": "البثق إلى هدف مختار",
"ui.extrude_auto_to_object_tip": "وجه أو رأس أو مستوى موازٍ يغيّر المدى إلى «إلى كائن».",
"ui.extrude_auto_to_object_tip": "وجه أو رأس أو مستوى موازٍ يغيّر الامتداد إلى «إلى كائن».",
"ui.factor": "المعامل",
"ui.fade": "تلاشٍ",
"ui.fade_length": "طول التلاشي",
@@ -4952,13 +5001,13 @@
"ui.fillet_setback": "مسافة الإرجاع",
"ui.fillet_setback_hint": "{factor} × نصف القطر",
"ui.fillet_setback_least": "أكثر من {least}",
"ui.fillet_setback_tip": "حيث تبدأ رقعة الزاوية الناعمة: المسافة على طول كل حافة من الزاوية. الافتراضي {factor} ضعف نصف القطر. يجب أن تكون أكبر من أقل مسافة إرجاع، حيث تلتقي الاستدارات بدونها: نصف القطر حيث تكون الأوجه متعامدة.",
"ui.fillet_setback_tip": "حيث تبدأ رقعة الزاوية الناعمة: المسافة على طول كل حافة من الزاوية. الافتراضي {factor} ضعف نصف القطر. يجب أن تكون أكبر من أقل مسافة إرجاع، وهي التي تلتقي عندها التقويسات دون إرجاع: نصف القطر حين تكون الأوجه متعامدة.",
"ui.fillet_smooth_radius": "تغيّر ناعم لنصف القطر",
"ui.fillet_turn": "المنعطفات",
"ui.fillet_turn": "الالتفاف",
"ui.fillet_turn_mitre": "وصلة مائلة",
"ui.fillet_turn_swept": "مُدار",
"ui.fillet_turn_tip": "حيث يلتف تقويسان حول حافة ركن حادة بينهما، مثل التقويسات على قاعدة بروز عند حوافه القائمة.\nوصلة مائلة: يمتد التقويسان حتى يلتقيا في وصلة مائلة.\nمُدار: يتوقف التقويسان عند حافة الركن ويلتفان حولها، والركن طارة مماسة لكليهما. فقط لتقويسين بنصف قطر واحد حول حافة ركن مستقيمة ومحدبة.",
"ui.fillet_type_choices_tip": "نصف قطر ثابت: نصف قطر واحد على طول الحافة.\nطول الوتر: يبقى عرض التقويس نفسه مهما كانت الزاوية بين الوجوه.\nنصف قطر متغيّر: نصف قطر عند كل طرف، ومزيد على طول الحافة إن أضفته.\nمتصل الانحناء: مقطع بلا انكسار في الانعكاسات حيث يلتقي بالوجوه المستوية (G2).\nمنحنى: يتبع نصف القطر على طول الحافة أنصاف أقطار تحكّم تحدّدها.",
"ui.fillet_turn_swept": "ملتف",
"ui.fillet_turn_tip": "حيث يلتف تقويسان حول حافة ركن حادة بينهما، مثل التقويسات على قاعدة نتوء عند حوافه القائمة.\nوصلة مائلة: يمتد التقويسان حتى يلتقيا في وصلة مائلة.\nملتف: يتوقف التقويسان عند حافة الركن ويلتفان حولها، والركن طارة مماسة لكليهما. فقط لتقويسين بنصف قطر واحد حول حافة ركن مستقيمة ومحدبة.",
"ui.fillet_type_choices_tip": "نصف قطر ثابت: نصف قطر واحد على طول الحافة.\nطول الوتر: يبقى عرض التقويس نفسه مهما كانت الزاوية بين الوجوه.\nنصف قطر متغيّر: نصف قطر عند كل طرف، ومزيد على طول الحافة إن أضفته.\nمتصل الانحناء: مقطع بلا انكسار في الانعكاسات حيث يلتقي بالوجوه المستوية (G2).\nمنحنى شريحي: يتبع نصف القطر على طول الحافة أنصاف أقطار تحكّم تحدّدها.",
"ui.fillet_type_curvature": "متصل الانحناء",
"ui.fillet_type_tip": "المقطع عبر الحافة. متصل الانحناء: مقطع متصل الانحناء (G2) بين وجوه مستوية، فتمر الانعكاسات من الوجوه إلى التقويس دون انكسار.",
"ui.filter_commands_or_keys": "تصفية الأوامر أو المفاتيح",
@@ -5003,6 +5052,7 @@
"ui.heading_construct": "إنشاء مرجعي",
"ui.heading_create": "إنشاء",
"ui.heading_create_sketch": "إنشاء رسم",
"ui.heading_custom_view_navigator": "متصفح العرض المخصص",
"ui.heading_cylinder": "أسطوانة",
"ui.heading_design": "التصميم",
"ui.heading_draft": "ميل السحب",
@@ -5070,7 +5120,7 @@
"ui.hidePlanes": "إخفاء المستويات",
"ui.hideProfile": "إخفاء المقطع",
"ui.hide_component_history": "إخفاء سجله",
"ui.hide_origin_by_default": "إخفاء مجلد الأصل في التصاميم الجديدة",
"ui.hide_origin_by_default": "إخفاء مجلد نقطة الأصل في التصاميم الجديدة",
"ui.hide_origin_note": "تبدأ التصاميم الجديدة ومجلد نقطة الأصل مخفي. يحتفظ كل تصميم بإعداد نقطة الأصل الخاص به بمجرد إظهارها أو إخفائها.",
"ui.history_back": "الرجوع خطوة",
"ui.history_below_browser": "أسفل المستعرض",
@@ -5598,6 +5648,14 @@
"values must be numbers or expressions": "يجب أن تكون القيم أعدادًا أو تعابير",
"view.auto_ortho_faces": "منظوري أثناء التدوير، ومتعامد على الأوجه",
"view.render_inspector": "مفتش التصيير",
"view_gizmo.arrows": "أسهم التدوير",
"view_gizmo.home": "زر العرض الرئيسي",
"view_gizmo.no_such_body": "لا يوجد في هذا التصميم جسم بهذا الاسم.",
"view_gizmo.note": "اختر جسمًا في العرض. يُحفظ مع تفضيلاتك وملفات تعريف الإعدادات، ويظهر في كل تصميم. انقر أحد أوجهه للنظر إليه مباشرة.",
"view_gizmo.texture": "الخامة",
"view_gizmo.themed": "حسب السمة",
"view_gizmo.too_detailed": "مفصّل أكثر مما يناسب متصفح العرض (أكثر من 10,000 مثلث)",
"view_gizmo.too_thin": "طويل ورفيع أكثر مما يناسب متصفح العرض: يجب ألا يقل أرفع جانب عن خُمس أطول جانب",
"web.files.insert_drawings_hint": "ملفات CAD أو شبكات أو DXF أو SVG إلى التصميم المفتوح",
"web.files.insert_stored_drawings_hint": "إلى التصميم المفتوح (ملفات CAD، شبكات، DXF، SVG)",
"web.open_full": "فتح في SolidCraft",
+30
View File
@@ -1291,6 +1291,7 @@
"cmd.timeline_stop": "Verlauf anhalten",
"cmd.timeline_suppress": "Merkmal unterdrücken",
"cmd.ui.assistant": "Assistenten ein-/ausblenden",
"cmd.view.navigator": "Eigener Ansichtsnavigator",
"cmd.view.render_browser": "Render-Browser",
"cmd.view.render_dock": "Render-Panel verschieben",
"cmd.view.render_focus": "Render-Fokusansicht",
@@ -1391,6 +1392,9 @@
"dialog.custom_axis": "↖ Eigene Achse",
"dialog.dimension_insert_hint": "Doppelklicken Sie auf eine andere steuernde Bemaßung, um ihren Namen einzufügen",
"dialog.dimension_name": "Bemaßung: {name}",
"dialog.dimension_step_down": "Um {step} verringern",
"dialog.dimension_step_expression": "Nur eine Zahl lässt sich schrittweise ändern; ein Ausdruck bleibt, wie er eingegeben ist",
"dialog.dimension_step_up": "Um {step} erhöhen",
"dialog.edit_title": "{title} bearbeiten",
"dialog.no_shown_body": "Kein sichtbarer Körper zum Ändern vorhanden. Blenden Sie einen Körper ein oder wählen Sie „Neuer Körper“.",
"dialog.pattern_sketch_not_object": "Körper oder Funktionen wählen: Eine Skizze ist keines von beiden. Ihre Kurven mit Muster oder Spiegeln in der Skizze wiederholen oder sie zuerst extrudieren.",
@@ -1415,6 +1419,7 @@
"document.read_only_save": "Dieses Design wurde schreibgeschützt geöffnet: Speichern Sie es als neue Datei",
"document.save_changes": "Änderungen in {name} speichern?",
"document.save_copy": "Kopie speichern…",
"document.tab_unsaved_changes": "Ungespeicherte Änderungen",
"document.unsaved_changes": "{name} enthält ungespeicherte Änderungen. Wenn Sie nicht speichern, gehen sie verloren.",
"drive.rigid": "{joint} ist ein starres Gelenk. Es hält die verbundenen Teile fest zusammen und ermöglicht daher keine Bewegung. Um die Teile beweglich zu machen, ändern Sie den Gelenktyp unter „Gelenk bearbeiten“: Drehgelenk für Drehbewegungen, Schubgelenk für lineare Bewegungen oder Zylindergelenk für beides.",
"drive.stopped_by_contact": "Angehalten bei {value}: {a} würde {b} durchdringen",
@@ -1435,6 +1440,9 @@
"each rail's curves must be in one sketch": "die Kurven jeder Führungskurve müssen in derselben Skizze liegen",
"feature computation ended without a result": "die Berechnung des Merkmals wurde ohne Ergebnis beendet",
"file.open.drawing_filter": "Designs, CAD-Dateien, Netze und Zeichnungen",
"file.open.portal_fallback.no_portal_service": "Die geöffnete Dateiauswahl ist nicht die des Desktops: Der Dateiauswahl-Dienst des Desktops ist nicht verfügbar.",
"file.open.portal_fallback.no_session_bus": "Die geöffnete Dateiauswahl ist nicht die des Desktops: Es gibt keinen D-Bus-Sitzungsbus.",
"file.open.portal_fallback.xwayland": "Die geöffnete Dateiauswahl ist nicht die des Desktops: Unter XWayland lehnt das Portal das Elternfenster ab.",
"file_load.built": "Bisher erstellt: {built} von {total} Merkmalen.",
"file_load.converting": "Volumenkörper {done} von {total} wird konvertiert",
"file_load.inserting": "Geometrie wird eingefügt",
@@ -1982,6 +1990,7 @@
"material.selection.mixed": "Unterschiedliche Materialien",
"measure.at": "Bei",
"measure.item": "Element {number}",
"measure.line_to_centre": "Linie zum Mittelpunkt",
"measure.quick_copied": "Messwert kopiert",
"measure.quick_copy": "Klicken, um den Messwert zu kopieren",
"measure.quick_edges": "{count} Kanten",
@@ -2314,6 +2323,13 @@
"prefs.dialogs_edge": "Am Rand der Ansicht",
"prefs.dialogs_left_column": "In der linken Spalte",
"prefs.dialogs_note": "Wo Befehlsdialoge öffnen: am Rand der Ansicht angedockt oder in der linken Spalte anstelle von Browser und Verlauf, die beim Schließen des Dialogs wie zuvor zurückkehren.",
"prefs.dimension_step_angle": "Was die Pfeile des Fensters, Auf/Ab und das Mausrad zu einem Winkel addieren",
"prefs.dimension_step_length": "Was die Pfeile des Fensters, Auf/Ab und das Mausrad zu einer Länge addieren",
"prefs.dimension_steps": "Schritte im Fenster",
"prefs.dimension_values": "Bemaßungswerte",
"prefs.dimension_values_note": "Wo der Wert einer Bemaßung eingegeben wird. Ein Fenster hat Pfeile, die ihn schrittweise ändern; das Bemaßungswerkzeug platziert zuerst den Text.",
"prefs.dimension_values_view": "In der Ansicht",
"prefs.dimension_values_window": "In einem Fenster",
"prefs.display": "Anzeige",
"prefs.edges": "Kanten und Schattierung",
"prefs.extend": "Erweitern",
@@ -2519,6 +2535,8 @@
"prefs.search": "Einstellungen suchen",
"prefs.search_empty": "Keine passenden Einstellungen",
"prefs.select": "Auswählen",
"prefs.select_hidden_edges": "Verdeckte Kanten in der schattierten Ansicht mit verdeckten Kanten auswählen",
"prefs.select_hidden_edges_help": "Kanten durch Flächen auswählen, wenn die schattierte Ansicht mit verdeckten Kanten aktiv ist, auch zum Verrunden. Aus behält das Auswahlverhalten von v0.30.1 bei. Ausgeblendete Körper bleiben ausgeschlossen.",
"prefs.select_one_item": "Ein Element auswählen",
"prefs.select_other_hidden": "Verborgene Geometrie mit „Andere auswählen“ auswählen",
"prefs.select_other_hidden_help": "Ein: Verborgene Körper, Skizzen und verdeckte Kanten nahe dem Zeiger einbeziehen. Aus: Die ursprüngliche Liste sichtbarer Geometrie direkt unter dem Zeiger verwenden.",
@@ -2543,6 +2561,8 @@
"prefs.sketch.click_selects": "Klick wählt",
"prefs.sketch.conflict_colour": "Konfliktfarbe",
"prefs.sketch.drawing": "Zeichnen",
"prefs.sketch.ellipse_axes": "Ellipsen mit ihren Achsen zeichnen",
"prefs.sketch.ellipse_axes_note": "Haupt- und Nebenachse als Konstruktionslinien, damit Halbachsen und Achsen bemaßt werden können. Aus: nur die Ellipse, und D darauf ergibt ihren Nebenradius, wohin der Wert auch gezogen wird, gezeichnet und mit R beschriftet wie bisher.",
"prefs.sketch.exit_keep": "Beibehalten",
"prefs.sketch.exit_previous": "Zur Ansicht davor zurückkehren",
"prefs.sketch.exit_unless_rotated": "Außer bei Drehung",
@@ -4772,6 +4792,7 @@
"ui.default_modelling_orientation": "Standard-Modellierungsorientierung",
"ui.delete": "Löschen",
"ui.delete_select_first": "Wählen Sie zuerst aus, was gelöscht werden soll: Features, Körper, Komponenten oder Skizzengeometrie",
"ui.dependents_select_first": "Wählen Sie zuerst aus, wessen Abhängige aufgelistet werden sollen",
"ui.depth": "Tiefe",
"ui.design": "Design",
"ui.design_properties.author": "Autor",
@@ -4976,6 +4997,7 @@
"ui.heading_construct": "KONSTRUKTION",
"ui.heading_create": "ERSTELLEN",
"ui.heading_create_sketch": "SKIZZE ERSTELLEN",
"ui.heading_custom_view_navigator": "EIGENER ANSICHTSNAVIGATOR",
"ui.heading_cylinder": "ZYLINDER",
"ui.heading_design": "DESIGN",
"ui.heading_draft": "ABZIEHEN",
@@ -5564,6 +5586,14 @@
"values must be numbers or expressions": "Werte müssen Zahlen oder Ausdrücke sein",
"view.auto_ortho_faces": "Perspektivisch beim Drehen, orthografisch auf Flächen",
"view.render_inspector": "Render-Inspektor",
"view_gizmo.arrows": "Drehpfeile",
"view_gizmo.home": "Schaltfläche „Ausgangsansicht“",
"view_gizmo.no_such_body": "Diese Konstruktion hat keinen Körper mit diesem Namen.",
"view_gizmo.note": "Wählen Sie einen Körper in der Ansicht. Er wird mit Ihren Einstellungen und Einstellungsprofilen gespeichert und in jeder Konstruktion angezeigt. Klicken Sie auf eine seiner Flächen, um direkt darauf zu blicken.",
"view_gizmo.texture": "Textur",
"view_gizmo.themed": "Design",
"view_gizmo.too_detailed": "Zu detailliert für den Ansichtsnavigator (über 10.000 Dreiecke)",
"view_gizmo.too_thin": "Zu lang und dünn für den Ansichtsnavigator: Die dünnste Seite muss mindestens ein Fünftel der längsten sein",
"web.files.insert_drawings_hint": "CAD-Dateien, Netze, DXF oder SVG in das geöffnete Design",
"web.files.insert_stored_drawings_hint": "In das geöffnete Design (CAD-Dateien, Netze, DXF, SVG)",
"web.open_full": "In SolidCraft öffnen",
+6
View File
@@ -69,6 +69,7 @@
"help.solid.split_face": "Divides the selected faces along a plane, the face of another body or sketch curves, without cutting the body. Use it to give part of a face its own draft, colour or offset.",
"help.third_party": "Third-party licences",
"home.new_mm_hint": "Millimetres · opens in Design",
"measure.line_to_centre": "Line to centre",
"navbar.custom.anchor.bottom_centre": "Bottom centre",
"navbar.custom.anchor.top_centre": "Top centre",
"navbar.custom.customise": "Customise navigation bar…",
@@ -86,6 +87,7 @@
"prefs.max_file_size_web": "The web app opens STEP and import files up to 512 MB and designs up to 256 MB: a browser tab can't hold larger files. The desktop app can raise these limits.",
"prefs.megabytes": "MB",
"prefs.network_locations_note": "For organisations that keep designs on file servers. Off: only servers you allow.",
"prefs.select_hidden_edges_help": "Select edges through faces when Shaded with hidden edges is active, including for Fillet. Off keeps v0.30.1 selection behaviour. Hidden bodies stay unselectable.",
"prefs.sketch.center_arc": "Centre-point arc follows the cursor",
"prefs.sketch.conflict_colour": "Conflict colour",
"prefs.sketch.tracking_guides": "Centre and midpoint guides",
@@ -234,6 +236,10 @@
"render.studio_area_help": "Up to four one-sided rectangles. Orthogonal half-edges U and V define size; U × V faces the lit side. Coordinates are world-space millimetres.",
"render.studio_center": "Centre X, Y, Z (mm)",
"render.studio_hdr_help": "Radiance .hdr, 2:1 panorama, up to 2048 × 1024. EXR is unavailable. The colour assumption applies only when primaries are unspecified.",
"sketch.hint.arc.center_point": "Arc: click centre and start, go round either way and click the end, or type a signed sweep",
"sketch.hint.circle.center": "Circle: click the centre, then a point on the circle",
"sketch.hint.constraint.midpoint": "MidPoint: pick a point and a line, or two lines to centre the second on the first",
"sketch.hint.rectangle.center": "Centre rectangle: click the centre, then a corner",
"sketch_text.align_center": "Centre",
"ui.3d_mouse_kind_cap": "Return to Centre",
"ui.3d_mouse_looks_like_cap": "The reading stays put while you hold it, the way a Return to Centre device does.",
+67 -9
View File
@@ -85,6 +85,7 @@
"Bottom Right": "Bottom Right",
"Boundary": "Boundary",
"Bounding box": "Bounding box",
"Bridge": "Bridge",
"CHECK": "CHECK",
"COMPONENTS": "COMPONENTS",
"CONFIGURATIONS": "CONFIGURATIONS",
@@ -1172,7 +1173,7 @@
"cmd.sketch_arc_tangent": "Tangent Arc",
"cmd.sketch_arc_three_point": "3-Point Arc",
"cmd.sketch_auto_constrain": "AutoConstrain",
"cmd.sketch_auto_constrain_from_datum": "AutoConstrain from datum",
"cmd.sketch_auto_constrain_from_datum": "AutoConstrain from Datum",
"cmd.sketch_auto_project": "Auto-Project Edges on Reference",
"cmd.sketch_blend_curve": "Blend Curve",
"cmd.sketch_cancel": "Cancel Sketch",
@@ -1186,7 +1187,7 @@
"cmd.sketch_circle_two_point": "2-Point Circle",
"cmd.sketch_circle_two_tangent": "2-Tangent Circle",
"cmd.sketch_constrainer": "Sketch Constrainer",
"cmd.sketch_constraint_fix": "Fix/UnFix",
"cmd.sketch_constraint_fix": "Fix/Unfix",
"cmd.sketch_constraint_midpoint": "MidPoint",
"cmd.sketch_construction": "Normal/Construction",
"cmd.sketch_copy": "Copy Sketch Entities",
@@ -1296,6 +1297,7 @@
"cmd.timeline_stop": "Stop History",
"cmd.timeline_suppress": "Suppress Feature",
"cmd.ui.assistant": "Toggle Assistant",
"cmd.view.navigator": "Custom View Navigator",
"cmd.view.render_browser": "Render Browser",
"cmd.view.render_dock": "Move Render Dock",
"cmd.view.render_focus": "Render Focus View",
@@ -1311,13 +1313,13 @@
"cmd.view_front": "Front View",
"cmd.view_graphics_preset": "Graphics Preset",
"cmd.view_grid": "Grid",
"cmd.view_ground_shadow": "Ground shadow",
"cmd.view_home": "Home view",
"cmd.view_ground_shadow": "Ground Shadow",
"cmd.view_home": "Home View",
"cmd.view_isometric": "Isometric View",
"cmd.view_left": "Left View",
"cmd.view_list": "List Named Views",
"cmd.view_navigate": "Navigate View",
"cmd.view_navigation_bar": "Navigation bar",
"cmd.view_navigation_bar": "Navigation Bar",
"cmd.view_next_tab": "Next Tab",
"cmd.view_normal_to": "Normal to Selection",
"cmd.view_previous_tab": "Previous Tab",
@@ -1326,10 +1328,10 @@
"cmd.view_right": "Right View",
"cmd.view_save": "New Named View",
"cmd.view_shots_strip": "Shots Strip",
"cmd.view_spin": "Continuous orbit",
"cmd.view_tool": "Navigation tool",
"cmd.view_spin": "Continuous Orbit",
"cmd.view_tool": "Navigation Tool",
"cmd.view_top": "Top View",
"cmd.view_visual_style": "Visual style",
"cmd.view_visual_style": "Visual Style",
"color.blue": "Blue",
"color.copy": "Click to copy color values",
"color.edit": "Click to edit color",
@@ -1396,6 +1398,9 @@
"dialog.custom_axis": "↖ Custom Axis",
"dialog.dimension_insert_hint": "Click another driving dimension to insert its name",
"dialog.dimension_name": "Dimension: {name}",
"dialog.dimension_step_down": "Down by {step}",
"dialog.dimension_step_expression": "Only a number steps; an expression stays as typed",
"dialog.dimension_step_up": "Up by {step}",
"dialog.edit_title": "EDIT {title}",
"dialog.no_shown_body": "No shown body to change: show one, or choose New Body",
"dialog.pattern_sketch_not_object": "Pick bodies or features: a sketch is neither. Repeat its curves with the sketch's own Pattern or Mirror, or extrude it first.",
@@ -1403,6 +1408,7 @@
"dialog.selected_count": "↖ {count} selected",
"dialog.selection_constraint": "Constraint {id}",
"dialog.selection_external_curve": "{sketch} · curve {id}",
"dialog.selection_external_point": "{point} · {sketch}",
"dialog.selection_guidance": "Select an input to change it. Click selected objects to remove them; Ctrl/Cmd-click also toggles them. Review the preview, then press OK.",
"dialog.selection_midpoint": "Midpoint · {id}",
"dialog.selection_profile": "{sketch} · profile {number}",
@@ -1420,6 +1426,7 @@
"document.read_only_save": "This design was opened read-only: save it as a new file",
"document.save_changes": "Save changes to {name}?",
"document.save_copy": "Save a Copy…",
"document.tab_unsaved_changes": "Unsaved changes",
"document.unsaved_changes": "{name} has unsaved changes. If you don't save, they are lost.",
"drive.rigid": "{joint} is a rigid joint: it holds its parts still, so it has nothing to drive. To let them move, change its type in Edit Joint: Revolute to rotate, Slider to slide, Cylindrical for both.",
"drive.stopped_by_contact": "Stopped at {value}: {a} would pass through {b}",
@@ -1440,6 +1447,9 @@
"each rail's curves must be in one sketch": "each rail's curves must be in one sketch",
"feature computation ended without a result": "feature computation ended without a result",
"file.open.drawing_filter": "Designs, CAD files, meshes and drawings",
"file.open.portal_fallback.no_portal_service": "The file chooser that opened is not the desktop's own: the desktop portal service is not available.",
"file.open.portal_fallback.no_session_bus": "The file chooser that opened is not the desktop's own: there is no D-Bus session bus.",
"file.open.portal_fallback.xwayland": "The file chooser that opened is not the desktop's own: under XWayland the portal refuses the parent window.",
"file_load.built": "Built so far: {built} of {total} features.",
"file_load.converting": "Converting solid {done} of {total}",
"file_load.inserting": "Inserting geometry",
@@ -1600,7 +1610,7 @@
"help.parts.resize": "Changes the size or length of an inserted standard part and rebuilds it; its joints keep it seated. Use it when a screw turns out too long or a hole needs another size.",
"help.plastic.assign_rule": "Assigns a plastic rule to bodies, so their plastic features take its draft and clearance as defaults. Use it to set up a moulded part once for all its features.",
"help.plastic.boss": "Adds a screw boss on a face: a post with an optional hole, draft, root fillet and supporting ribs. Use it for screw points in moulded or printed housings.",
"help.plastic.lip": "Adds a lip or a matching groove along the rim of a shelled body. Use it so that two housing halves locate on each other and close tightly.",
"help.plastic.lip": "Adds a lip or a matching groove along the rim of a shelled body (Shell a face open first, then pick the rim around that opening). Use it so that two housing halves locate on each other and close tightly.",
"help.plastic.manage_rules": "Creates and edits plastic rules: material, wall thickness, radii, clearance and draft. Use them to keep the features of a moulded part consistent.",
"help.plastic.rest": "Adds a rest on a face: a round or rectangular pad, solid or hollow, with draft. Use it as a support or standoff in a moulded housing.",
"help.plastic.snap_fit": "Adds a snap-fit hook on a face, with its length, thickness and catch. Use it to clip parts together without screws.",
@@ -1999,6 +2009,7 @@
"material.selection.mixed": "Different materials",
"measure.at": "At",
"measure.item": "Item {number}",
"measure.line_to_centre": "Line to center",
"measure.quick_copied": "Measurement copied",
"measure.quick_copy": "Click to copy the measurement",
"measure.quick_edges": "{count} edges",
@@ -2331,6 +2342,13 @@
"prefs.dialogs_edge": "At the view's edge",
"prefs.dialogs_left_column": "In the left column",
"prefs.dialogs_note": "Where command dialogs open: docked at the view's edge, or in the left column in place of the browser and the History, which come back as they were when the dialog closes.",
"prefs.dimension_step_angle": "What the window's arrows, Up/Down and the wheel add to an angle",
"prefs.dimension_step_length": "What the window's arrows, Up/Down and the wheel add to a length",
"prefs.dimension_steps": "Window steps",
"prefs.dimension_values": "Dimension values",
"prefs.dimension_values_note": "Where you type a dimension's value. A window has arrows that step it; the Dimension tool places the text first.",
"prefs.dimension_values_view": "In the view",
"prefs.dimension_values_window": "In a window",
"prefs.display": "Display",
"prefs.edges": "Edges and shading",
"prefs.extend": "Extend",
@@ -2541,6 +2559,8 @@
"prefs.section_hatch_by_part": "By part",
"prefs.section_hatch_one": "One style",
"prefs.select": "Select",
"prefs.select_hidden_edges": "Select hidden edges in Shaded with hidden edges",
"prefs.select_hidden_edges_help": "Select edges through faces when Shaded with hidden edges is active, including for Fillet. Off keeps v0.30.1 selection behavior. Hidden bodies stay unselectable.",
"prefs.select_one_item": "Select one item",
"prefs.select_other_hidden": "Select hidden geometry with Select Other",
"prefs.select_other_hidden_help": "On: include hidden bodies, sketches and occluded edges near the pointer. Off: use the original list of visible geometry under the pointer.",
@@ -2565,6 +2585,8 @@
"prefs.sketch.click_selects": "Click selects",
"prefs.sketch.conflict_colour": "Conflict color",
"prefs.sketch.drawing": "Drawing",
"prefs.sketch.ellipse_axes": "Draw ellipses with their axes",
"prefs.sketch.ellipse_axes_note": "The major and minor axes as construction lines, so the half-axes and axes can be dimensioned. Off: the ellipse alone, and D on it gives its minor radius wherever the value is pulled, drawn and labelled R as before.",
"prefs.sketch.exit_keep": "Keep",
"prefs.sketch.exit_previous": "Return to the view before",
"prefs.sketch.exit_unless_rotated": "Unless turned",
@@ -4155,6 +4177,32 @@
"sketch.dof_left": "{count} degrees of freedom left",
"sketch.dof_left_one": "{count} degree of freedom left",
"sketch.draw_curves": "Draw as {linetype}",
"sketch.error.closed_curve_two_crossings": "a closed curve needs two crossings to trim",
"sketch.error.nothing_to_break": "nothing to break here",
"sketch.error.offset_fillet_chamfer": "`{id}` is an offset, and its corners follow its source curves: round or cut the source corners before offsetting, or break the offset association first",
"sketch.error.offset_trim": "`{id}` is an offset, and its ends follow its source curves: edit the source curves instead, or break the offset association first",
"sketch.hint.arc.center_point": "Arc: click center and start, go round either way and click the end, or type a signed sweep",
"sketch.hint.arc.three_point": "Arc: click start, end, then a point on the arc",
"sketch.hint.arc3d": "3D Arc: click start, end, then a point on the arc (points may leave the sketch plane)",
"sketch.hint.break": "Break: click a curve where it should split",
"sketch.hint.circle.center": "Circle: click the center, then a point on the circle",
"sketch.hint.constraint.generic": "Constraint: pick the sketch entities",
"sketch.hint.constraint.horizontal_vertical": "Horizontal/Vertical: pick a line, two points, or a point and a line; hold Shift to pick a line midpoint",
"sketch.hint.constraint.midpoint": "MidPoint: pick a point and a line, or two lines to center the second on the first",
"sketch.hint.dimension": "Dimension: pick one or two entities and type the value (or click to place it first); click a dimension to edit it; Enter applies",
"sketch.hint.extend": "Extend: click a curve near the end to extend (Shift: click two curves to extend both to where they meet)",
"sketch.hint.fallback": "Click in the sketch",
"sketch.hint.line": "Line: click points; right-click or Esc to finish",
"sketch.hint.line3d": "3D Line: click world points; right-click or Esc to finish (points may leave the sketch plane)",
"sketch.hint.open_done": "Open done",
"sketch.hint.point3d": "3D Point: click where a 3D point goes",
"sketch.hint.rectangle.center": "Center rectangle: click the center, then a corner",
"sketch.hint.rectangle.rounded": "Rounded rectangle: click two opposite corners (Tab to the radius box to type the corner radius)",
"sketch.hint.rectangle.three_point": "3-point rectangle: click two points of one edge, then the width",
"sketch.hint.rectangle.two_point": "Rectangle: click two opposite corners",
"sketch.hint.slot": "Slot: click both ends, then the width",
"sketch.hint.spline3d": "3D Spline: click fit points in 3D; right-click or Esc to finish",
"sketch.hint.trim": "Trim: click the piece of a curve to remove, or drag across the pieces to remove",
"sketch.make_selection": "Convert the selection to {linetype}",
"sketch.open_ends": "Open {count}",
"sketch.status_conflict": "constraints conflict",
@@ -4797,6 +4845,7 @@
"ui.default_modelling_orientation": "Default modeling orientation",
"ui.delete": "Delete",
"ui.delete_select_first": "Select what to delete first: features, bodies, components or sketch geometry",
"ui.dependents_select_first": "Select what to list the dependents of first",
"ui.depth": "Depth",
"ui.design": "Design",
"ui.design_properties.author": "Author",
@@ -5003,6 +5052,7 @@
"ui.heading_construct": "CONSTRUCT",
"ui.heading_create": "CREATE",
"ui.heading_create_sketch": "CREATE SKETCH",
"ui.heading_custom_view_navigator": "CUSTOM VIEW NAVIGATOR",
"ui.heading_cylinder": "CYLINDER",
"ui.heading_design": "DESIGN",
"ui.heading_draft": "DRAFT",
@@ -5598,6 +5648,14 @@
"values must be numbers or expressions": "values must be numbers or expressions",
"view.auto_ortho_faces": "Perspective while orbiting, ortho on faces",
"view.render_inspector": "Render Inspector",
"view_gizmo.arrows": "Rotation arrows",
"view_gizmo.home": "Home button",
"view_gizmo.no_such_body": "This design has no body of that name.",
"view_gizmo.note": "Pick a body in the view. It is kept with your preferences and settings profiles, and shown in every design. Click one of its faces to look straight at it.",
"view_gizmo.texture": "Texture",
"view_gizmo.themed": "Themed",
"view_gizmo.too_detailed": "Too detailed for the view navigator (over 10,000 triangles)",
"view_gizmo.too_thin": "Too long and thin for the view navigator: its thinnest side must be at least a fifth of its longest",
"web.files.insert_drawings_hint": "CAD files, meshes, DXF or SVG into the open design",
"web.files.insert_stored_drawings_hint": "Into the open design (CAD files, meshes, DXF, SVG)",
"web.open_full": "Open in SolidCraft",
+792 -1
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1
View File
@@ -1391,6 +1391,7 @@
"document.read_only_save": "Cette conception a été ouverte en lecture seule : enregistrez-la dans un nouveau fichier",
"document.save_changes": "Enregistrer les modifications de {name} ?",
"document.save_copy": "Enregistrer une copie…",
"document.tab_unsaved_changes": "Modifications non enregistrées",
"document.unsaved_changes": "{name} contient des modifications non enregistrées. Si vous n'enregistrez pas, elles seront perdues.",
"drive.rigid": "{joint} est une liaison rigide : elle maintient ses pièces immobiles, il n'y a donc rien à piloter. Pour les laisser bouger, changer son type dans Modifier la liaison : Revolute pour tourner, Slider pour coulisser, Cylindrical pour les deux.",
"drive.stopped_by_contact": "Arrêté à {value} : {a} traverserait {b}",
+58
View File
@@ -85,6 +85,7 @@
"Bottom Right": "למטה מימין",
"Boundary": "גבול",
"Bounding box": "תיבה תוחמת",
"Bridge": "גשר",
"CHECK": "בדיקה",
"COMPONENTS": "רכיבים",
"CONFIGURATIONS": "תצורות",
@@ -1296,6 +1297,7 @@
"cmd.timeline_stop": "עצירת ציר הזמן",
"cmd.timeline_suppress": "השבתת פיצ'ר",
"cmd.ui.assistant": "הצגה או הסתרה של העוזר",
"cmd.view.navigator": "ניווט תצוגה מותאם אישית",
"cmd.view.render_browser": "דפדפן רינדור",
"cmd.view.render_dock": "הזז את עגינת הרינדור",
"cmd.view.render_focus": "תצוגת מיקוד רינדור",
@@ -1396,6 +1398,9 @@
"dialog.custom_axis": "↖ ציר מותאם",
"dialog.dimension_insert_hint": "יש ללחוץ על מידה מניעה אחרת כדי להוסיף את שמה",
"dialog.dimension_name": "מידה: {name}",
"dialog.dimension_step_down": "הפחתה ב־{step}",
"dialog.dimension_step_expression": "רק מספר משתנה בצעדים; ביטוי נשאר כפי שנכתב",
"dialog.dimension_step_up": "הוספה של {step}",
"dialog.edit_title": "עריכת {title}",
"dialog.no_shown_body": "אין גוף מוצג לשינוי: הציגו גוף, או בחרו „גוף חדש”",
"dialog.pattern_sketch_not_object": "בחרו גופים או פיצ'רים: סקיצה אינה אף אחד מהם. חזרו על העקומות שלה בעזרת המערך או השיקוף של הסקיצה עצמה, או בצעו לה שליפה קודם.",
@@ -1403,6 +1408,7 @@
"dialog.selected_count": "↖ {count} נבחרו",
"dialog.selection_constraint": "אילוץ {id}",
"dialog.selection_external_curve": "{sketch} · עקומה {id}",
"dialog.selection_external_point": "{point} · {sketch}",
"dialog.selection_guidance": "יש לבחור קלט כדי לשנות אותו. לחיצה על אובייקט שנבחר מסירה אותו; גם Ctrl/Cmd+לחיצה מחליפה את מצבו. לאחר בדיקת התצוגה המקדימה יש ללחוץ על אישור.",
"dialog.selection_midpoint": "נקודת אמצע · {id}",
"dialog.selection_profile": "{sketch} · פרופיל {number}",
@@ -1420,6 +1426,7 @@
"document.read_only_save": "התכן הזה נפתח לקריאה בלבד: יש לשמור אותו כקובץ חדש",
"document.save_changes": "לשמור את השינויים ב־{name}?",
"document.save_copy": "שמירת עותק…",
"document.tab_unsaved_changes": "שינויים שלא נשמרו",
"document.unsaved_changes": "ב־{name} יש שינויים שלא נשמרו. ללא שמירה, הם יאבדו.",
"drive.rigid": "{joint} הוא מפרק קשיח: הוא מחזיק את החלקים שלו במקומם, ולכן אין מה להניע. כדי שהחלקים יזוזו, שנו את הסוג שלו ב״עריכת מפרק״: Revolute לסיבוב, Slider להחלקה, Cylindrical לשניהם.",
"drive.stopped_by_contact": "נעצר ב־{value}: {a} היה עובר דרך {b}",
@@ -1440,6 +1447,9 @@
"each rail's curves must be in one sketch": "עקומות כל מסילה חייבות להיות בסקיצה אחת",
"feature computation ended without a result": "חישוב הפיצ'ר הסתיים ללא תוצאה",
"file.open.drawing_filter": "תכנים, קובצי CAD, רשתות משולשים ושרטוטים",
"file.open.portal_fallback.no_portal_service": "בורר הקבצים שנפתח אינו של שולחן העבודה: שירות בחירת הקבצים של שולחן העבודה אינו זמין.",
"file.open.portal_fallback.no_session_bus": "בורר הקבצים שנפתח אינו של שולחן העבודה: אין אוטובוס הפעלה של D-Bus.",
"file.open.portal_fallback.xwayland": "בורר הקבצים שנפתח אינו של שולחן העבודה: תחת XWayland הפורטל דוחה את חלון האב.",
"file_load.built": "נבנו עד כה: {built} מתוך {total} פיצ'רים.",
"file_load.converting": "המרת גוף מוצק {done} מתוך {total}",
"file_load.inserting": "הוספת גאומטריה",
@@ -1999,6 +2009,7 @@
"material.selection.mixed": "חומרים שונים",
"measure.at": "מיקום",
"measure.item": "פריט {number}",
"measure.line_to_centre": "מהקו למרכז",
"measure.quick_copied": "המדידה הועתקה",
"measure.quick_copy": "לחיצה מעתיקה את המדידה",
"measure.quick_edges": "{count} מקצועות",
@@ -2331,6 +2342,13 @@
"prefs.dialogs_edge": "בקצה התצוגה",
"prefs.dialogs_left_column": "בעמודה השמאלית",
"prefs.dialogs_note": "היכן נפתחות תיבות הדו־שיח של הפקודות: מעוגנות בקצה התצוגה, או בעמודה השמאלית במקום הדפדפן וההיסטוריה, שחוזרים כפי שהיו כשהתיבה נסגרת.",
"prefs.dimension_step_angle": "מה שהחצים בחלון, למעלה/למטה והגלגלת מוסיפים לזווית",
"prefs.dimension_step_length": "מה שהחצים בחלון, למעלה/למטה והגלגלת מוסיפים לאורך",
"prefs.dimension_steps": "צעדי החלון",
"prefs.dimension_values": "ערכי מידות",
"prefs.dimension_values_note": "היכן מקלידים את ערך המידה. לחלון יש חצים שמשנים אותו בצעדים; כלי המידה מציב קודם את הטקסט.",
"prefs.dimension_values_view": "בתצוגה",
"prefs.dimension_values_window": "בחלון",
"prefs.display": "תצוגה",
"prefs.edges": "מקצועות והצללה",
"prefs.extend": "הרחבה",
@@ -2541,6 +2559,8 @@
"prefs.section_hatch_by_part": "לפי חלק",
"prefs.section_hatch_one": "סגנון אחד",
"prefs.select": "בחירה",
"prefs.select_hidden_edges": "בחירת קצוות מוסתרים בתצוגה מוצללת עם קצוות מוסתרים",
"prefs.select_hidden_edges_help": "מאפשר לבחור קצוות דרך פאות בתצוגה מוצללת עם קצוות מוסתרים, גם עבור Fillet. כיבוי שומר על אופן הבחירה של v0.30.1. גופים שהוסתרו עדיין אינם ניתנים לבחירה.",
"prefs.select_one_item": "בחירת פריט אחד",
"prefs.select_other_hidden": "בחירת גאומטריה מוסתרת באמצעות בחירה אחרת",
"prefs.select_other_hidden_help": "מופעל: כולל גופים, סקיצות וקצוות מוסתרים בקרבת הסמן. כבוי: שימוש ברשימה המקורית של גאומטריה גלויה מתחת לסמן.",
@@ -2565,6 +2585,8 @@
"prefs.sketch.click_selects": "לחיצה בוחרת",
"prefs.sketch.conflict_colour": "צבע התנגשות",
"prefs.sketch.drawing": "שרטוט",
"prefs.sketch.ellipse_axes": "שרטוט אליפסות עם הצירים שלהן",
"prefs.sketch.ellipse_axes_note": "הציר הראשי והציר המשני כקווי עזר, כדי שאפשר יהיה לתת מידות לחצאי הצירים ולצירים. כבוי: האליפסה בלבד, ו-D עליה נותן את הרדיוס המשני שלה בכל מקום שאליו נגרר הערך, משורטט ומסומן R כמו קודם.",
"prefs.sketch.exit_keep": "שמירה",
"prefs.sketch.exit_previous": "חזרה לתצוגה הקודמת",
"prefs.sketch.exit_unless_rotated": "אלא אם סובבה",
@@ -4155,6 +4177,32 @@
"sketch.dof_left": "נותרו {count} דרגות חופש",
"sketch.dof_left_one": "נותרה {count} דרגת חופש",
"sketch.draw_curves": "שרטוט כ־{linetype}",
"sketch.error.closed_curve_two_crossings": "a closed curve needs two crossings to trim",
"sketch.error.nothing_to_break": "nothing to break here",
"sketch.error.offset_fillet_chamfer": "`{id}` is an offset, and its corners follow its source curves: round or cut the source corners before offsetting, or break the offset association first",
"sketch.error.offset_trim": "`{id}` is an offset, and its ends follow its source curves: edit the source curves instead, or break the offset association first",
"sketch.hint.arc.center_point": "Arc: click center and start, go round either way and click the end, or type a signed sweep",
"sketch.hint.arc.three_point": "Arc: click start, end, then a point on the arc",
"sketch.hint.arc3d": "3D Arc: click start, end, then a point on the arc (points may leave the sketch plane)",
"sketch.hint.break": "Break: click a curve where it should split",
"sketch.hint.circle.center": "Circle: click the center, then a point on the circle",
"sketch.hint.constraint.generic": "Constraint: pick the sketch entities",
"sketch.hint.constraint.horizontal_vertical": "Horizontal/Vertical: pick a line, two points, or a point and a line; hold Shift to pick a line midpoint",
"sketch.hint.constraint.midpoint": "MidPoint: pick a point and a line, or two lines to center the second on the first",
"sketch.hint.dimension": "Dimension: pick one or two entities and type the value (or click to place it first); click a dimension to edit it; Enter applies",
"sketch.hint.extend": "Extend: click a curve near the end to extend (Shift: click two curves to extend both to where they meet)",
"sketch.hint.fallback": "Click in the sketch",
"sketch.hint.line": "Line: click points; right-click or Esc to finish",
"sketch.hint.line3d": "3D Line: click world points; right-click or Esc to finish (points may leave the sketch plane)",
"sketch.hint.open_done": "Open done",
"sketch.hint.point3d": "3D Point: click where a 3D point goes",
"sketch.hint.rectangle.center": "Center rectangle: click the center, then a corner",
"sketch.hint.rectangle.rounded": "Rounded rectangle: click two opposite corners (Tab to the radius box to type the corner radius)",
"sketch.hint.rectangle.three_point": "3-point rectangle: click two points of one edge, then the width",
"sketch.hint.rectangle.two_point": "Rectangle: click two opposite corners",
"sketch.hint.slot": "Slot: click both ends, then the width",
"sketch.hint.spline3d": "3D Spline: click fit points in 3D; right-click or Esc to finish",
"sketch.hint.trim": "Trim: click the piece of a curve to remove, or drag across the pieces to remove",
"sketch.make_selection": "המרת הבחירה ל־{linetype}",
"sketch.open_ends": "קצוות פתוחים: {count}",
"sketch.status_conflict": "אילוצים סותרים",
@@ -4797,6 +4845,7 @@
"ui.default_modelling_orientation": "כיוון מידול ברירת מחדל",
"ui.delete": "מחיקה",
"ui.delete_select_first": "בחרו קודם מה למחוק: תכונות, גופים, רכיבים או גאומטריית סקיצה",
"ui.dependents_select_first": "בחרו קודם מה להציג את התלויים שלו",
"ui.depth": "עומק",
"ui.design": "תכן",
"ui.design_properties.author": "מחבר",
@@ -5003,6 +5052,7 @@
"ui.heading_construct": "עזר",
"ui.heading_create": "יצירה",
"ui.heading_create_sketch": "יצירת סקיצה",
"ui.heading_custom_view_navigator": "ניווט תצוגה מותאם אישית",
"ui.heading_cylinder": "גליל",
"ui.heading_design": "תכן",
"ui.heading_draft": "שיפוע יציקה",
@@ -5598,6 +5648,14 @@
"values must be numbers or expressions": "הערכים חייבים להיות מספרים או ביטויים",
"view.auto_ortho_faces": "פרספקטיבה בזמן סיבוב, אורתוגרפי על פאות",
"view.render_inspector": "מפקח רינדור",
"view_gizmo.arrows": "חיצי סיבוב",
"view_gizmo.home": "לחצן תצוגת בית",
"view_gizmo.no_such_body": "אין בעיצוב הזה גוף בשם הזה.",
"view_gizmo.note": "בחרו גוף בתצוגה. הוא נשמר עם ההעדפות ופרופילי ההגדרות שלכם ומוצג בכל עיצוב. לחצו על אחת מפאותיו כדי להביט בה ישירות.",
"view_gizmo.texture": "מרקם",
"view_gizmo.themed": "לפי ערכת הנושא",
"view_gizmo.too_detailed": "מפורט מדי לניווט התצוגה (יותר מ-10,000 משולשים)",
"view_gizmo.too_thin": "ארוך ודק מדי לניווט התצוגה: הצד הדק ביותר חייב להיות לפחות חמישית מהצד הארוך ביותר",
"web.files.insert_drawings_hint": "קובצי CAD, רשתות משולשים, DXF או SVG אל התכן הפתוח",
"web.files.insert_stored_drawings_hint": "אל התכן הפתוח (קובצי CAD, רשתות משולשים, DXF, SVG)",
"web.open_full": "פתיחה ב־SolidCraft",
+1
View File
@@ -1392,6 +1392,7 @@
"document.read_only_save": "Questa progettazione è stata aperta in sola lettura: salvala come nuovo file",
"document.save_changes": "Salvare le modifiche a {name}?",
"document.save_copy": "Salva una copia…",
"document.tab_unsaved_changes": "Modifiche non salvate",
"document.unsaved_changes": "{name} contiene modifiche non salvate. Se non salvi, andranno perse.",
"drive.rigid": "{joint} è un giunto rigido: tiene ferme le sue parti, quindi non c'è nulla da azionare. Per farle muovere, cambia il suo tipo in Modifica giunto: Rotante per ruotare, Scorrevole per scorrere, Cilindrico per entrambi.",
"drive.stopped_by_contact": "Arrestato a {value}: {a} attraverserebbe {b}",
+58
View File
@@ -85,6 +85,7 @@
"Bottom Right": "右下",
"Boundary": "境界",
"Bounding box": "境界ボックス",
"Bridge": "ブリッジ",
"CHECK": "チェック",
"COMPONENTS": "コンポーネント",
"CONFIGURATIONS": "構成",
@@ -1296,6 +1297,7 @@
"cmd.timeline_stop": "履歴を停止",
"cmd.timeline_suppress": "フィーチャーを抑制",
"cmd.ui.assistant": "アシスタントの表示切り替え",
"cmd.view.navigator": "カスタム ビューナビゲーター",
"cmd.view.render_browser": "Renderブラウザー",
"cmd.view.render_dock": "レンダードックを移動",
"cmd.view.render_focus": "Renderフォーカス表示",
@@ -1396,6 +1398,9 @@
"dialog.custom_axis": "↖ カスタム軸",
"dialog.dimension_insert_hint": "別の駆動寸法をクリックして名前を挿入",
"dialog.dimension_name": "寸法: {name}",
"dialog.dimension_step_down": "{step} 減らす",
"dialog.dimension_step_expression": "増減できるのは数値だけです。式はそのまま残ります",
"dialog.dimension_step_up": "{step} 増やす",
"dialog.edit_title": "{title}を編集",
"dialog.no_shown_body": "変更できる表示中のボディがありません。ボディを表示するか、新規ボディを選択してください",
"dialog.pattern_sketch_not_object": "ボディかフィーチャーを選んでください。スケッチはどちらでもありません。曲線はスケッチ内のパターンかミラーで繰り返すか、先に押し出してください。",
@@ -1403,6 +1408,7 @@
"dialog.selected_count": "↖ {count} 個選択中",
"dialog.selection_constraint": "拘束 {id}",
"dialog.selection_external_curve": "{sketch} · 曲線 {id}",
"dialog.selection_external_point": "{point} · {sketch}",
"dialog.selection_guidance": "入力欄を選んで変更します。選択済みのオブジェクトをクリックすると解除できます。Ctrl/Cmd を押しながらクリックしても切り替えられます。プレビューを確認してから OK を押してください。",
"dialog.selection_midpoint": "中点 · {id}",
"dialog.selection_profile": "{sketch} · プロファイル {number}",
@@ -1420,6 +1426,7 @@
"document.read_only_save": "このデザインは読み取り専用で開かれています:新しいファイルとして保存してください",
"document.save_changes": "{name} への変更を保存しますか?",
"document.save_copy": "コピーを保存…",
"document.tab_unsaved_changes": "未保存の変更",
"document.unsaved_changes": "{name} には保存されていない変更があります。保存しない場合、変更内容は失われます。",
"drive.rigid": "{joint} は剛体ジョイントです。部品をその場に固定するため、駆動するものがありません。動かすには「ジョイントを編集」で種類を変更してください: 回転させるなら Revolute、スライドさせるなら Slider、両方なら Cylindrical。",
"drive.stopped_by_contact": "{value} で停止: {a} が {b} を通り抜けてしまいます",
@@ -1440,6 +1447,9 @@
"each rail's curves must be in one sketch": "各レールの曲線は1つのスケッチ内にある必要があります",
"feature computation ended without a result": "フィーチャーの計算が結果なしで終了しました",
"file.open.drawing_filter": "デザイン、CADファイル、メッシュ、図面",
"file.open.portal_fallback.no_portal_service": "開いたファイル選択はデスクトップのものではありません。デスクトップのファイル選択サービスが利用できません。",
"file.open.portal_fallback.no_session_bus": "開いたファイル選択はデスクトップのものではありません。D-Bus セッションがありません。",
"file.open.portal_fallback.xwayland": "開いたファイル選択はデスクトップのものではありません。XWayland ではポータルが親ウィンドウを拒否します。",
"file_load.built": "構築済み: 全{total}フィーチャー中{built}件。",
"file_load.converting": "ソリッドを変換中: {done}/{total}",
"file_load.inserting": "ジオメトリを挿入中",
@@ -1999,6 +2009,7 @@
"material.selection.mixed": "異なる材料",
"measure.at": "位置",
"measure.item": "項目 {number}",
"measure.line_to_centre": "線から中心まで",
"measure.quick_copied": "測定値をコピーしました",
"measure.quick_copy": "クリックで測定値をコピー",
"measure.quick_edges": "エッジ {count} 本",
@@ -2331,6 +2342,13 @@
"prefs.dialogs_edge": "ビューの端",
"prefs.dialogs_left_column": "左の列",
"prefs.dialogs_note": "コマンドダイアログを開く場所:ビューの端にドッキングするか、左の列でブラウザーと履歴の代わりに表示します。ダイアログを閉じるとブラウザーと履歴は元どおりに戻ります。",
"prefs.dimension_step_angle": "ウィンドウの矢印、上下キー、ホイールで角度に加える量",
"prefs.dimension_step_length": "ウィンドウの矢印、上下キー、ホイールで長さに加える量",
"prefs.dimension_steps": "ウィンドウの増減量",
"prefs.dimension_values": "寸法値の入力",
"prefs.dimension_values_note": "寸法値を入力する場所です。ウィンドウでは矢印で値を増減でき、寸法ツールは先に文字を配置します。",
"prefs.dimension_values_view": "ビュー内",
"prefs.dimension_values_window": "ウィンドウ",
"prefs.display": "表示",
"prefs.edges": "エッジと陰影",
"prefs.extend": "拡張",
@@ -2541,6 +2559,8 @@
"prefs.section_hatch_by_part": "部品ごと",
"prefs.section_hatch_one": "単一スタイル",
"prefs.select": "選択",
"prefs.select_hidden_edges": "隠線表示で隠れた辺を選択する",
"prefs.select_hidden_edges_help": "「Shaded with hidden edges」で面の向こうの辺を選択し、Filletにも使用できます。オフではv0.30.1相当の選択動作になります。非表示のボディは選択対象になりません。",
"prefs.select_one_item": "項目を 1 つ選択",
"prefs.select_other_hidden": "「他を選択」で非表示のジオメトリを選択",
"prefs.select_other_hidden_help": "オン: ポインター付近の非表示のボディやスケッチ、遮られたエッジを含めます。オフ: ポインター直下の表示中のジオメトリだけを元のリストに表示します。",
@@ -2565,6 +2585,8 @@
"prefs.sketch.click_selects": "クリックで選択",
"prefs.sketch.conflict_colour": "競合色",
"prefs.sketch.drawing": "作図",
"prefs.sketch.ellipse_axes": "楕円を軸と一緒に描く",
"prefs.sketch.ellipse_axes_note": "長軸と短軸をコンストラクション線として描き、半軸と軸に寸法を付けられるようにします。オフ: 楕円のみを描き、D で短半径を寸法にします。値をどこへ引いても、これまでどおり R 付きで描かれます。",
"prefs.sketch.exit_keep": "維持",
"prefs.sketch.exit_previous": "開始前のビューに戻る",
"prefs.sketch.exit_unless_rotated": "回転した場合を除く",
@@ -4155,6 +4177,32 @@
"sketch.dof_left": "残り自由度 {count}",
"sketch.dof_left_one": "残り自由度 {count}",
"sketch.draw_curves": "{linetype}として描く",
"sketch.error.closed_curve_two_crossings": "a closed curve needs two crossings to trim",
"sketch.error.nothing_to_break": "nothing to break here",
"sketch.error.offset_fillet_chamfer": "`{id}` is an offset, and its corners follow its source curves: round or cut the source corners before offsetting, or break the offset association first",
"sketch.error.offset_trim": "`{id}` is an offset, and its ends follow its source curves: edit the source curves instead, or break the offset association first",
"sketch.hint.arc.center_point": "Arc: click center and start, go round either way and click the end, or type a signed sweep",
"sketch.hint.arc.three_point": "Arc: click start, end, then a point on the arc",
"sketch.hint.arc3d": "3D Arc: click start, end, then a point on the arc (points may leave the sketch plane)",
"sketch.hint.break": "Break: click a curve where it should split",
"sketch.hint.circle.center": "Circle: click the center, then a point on the circle",
"sketch.hint.constraint.generic": "Constraint: pick the sketch entities",
"sketch.hint.constraint.horizontal_vertical": "Horizontal/Vertical: pick a line, two points, or a point and a line; hold Shift to pick a line midpoint",
"sketch.hint.constraint.midpoint": "MidPoint: pick a point and a line, or two lines to center the second on the first",
"sketch.hint.dimension": "Dimension: pick one or two entities and type the value (or click to place it first); click a dimension to edit it; Enter applies",
"sketch.hint.extend": "Extend: click a curve near the end to extend (Shift: click two curves to extend both to where they meet)",
"sketch.hint.fallback": "Click in the sketch",
"sketch.hint.line": "Line: click points; right-click or Esc to finish",
"sketch.hint.line3d": "3D Line: click world points; right-click or Esc to finish (points may leave the sketch plane)",
"sketch.hint.open_done": "Open done",
"sketch.hint.point3d": "3D Point: click where a 3D point goes",
"sketch.hint.rectangle.center": "Center rectangle: click the center, then a corner",
"sketch.hint.rectangle.rounded": "Rounded rectangle: click two opposite corners (Tab to the radius box to type the corner radius)",
"sketch.hint.rectangle.three_point": "3-point rectangle: click two points of one edge, then the width",
"sketch.hint.rectangle.two_point": "Rectangle: click two opposite corners",
"sketch.hint.slot": "Slot: click both ends, then the width",
"sketch.hint.spline3d": "3D Spline: click fit points in 3D; right-click or Esc to finish",
"sketch.hint.trim": "Trim: click the piece of a curve to remove, or drag across the pieces to remove",
"sketch.make_selection": "選択を{linetype}にする",
"sketch.open_ends": "開放 {count}",
"sketch.status_conflict": "拘束が競合しています",
@@ -4797,6 +4845,7 @@
"ui.default_modelling_orientation": "モデリングのデフォルト方向",
"ui.delete": "削除",
"ui.delete_select_first": "先に削除するものを選択してください: フィーチャ、ボディ、コンポーネント、スケッチ ジオメトリ",
"ui.dependents_select_first": "先に、依存先を表示する対象を選択してください",
"ui.depth": "深さ",
"ui.design": "デザイン",
"ui.design_properties.author": "作成者",
@@ -5003,6 +5052,7 @@
"ui.heading_construct": "構築",
"ui.heading_create": "作成",
"ui.heading_create_sketch": "スケッチを作成",
"ui.heading_custom_view_navigator": "カスタム ビューナビゲーター",
"ui.heading_cylinder": "円柱",
"ui.heading_design": "デザイン",
"ui.heading_draft": "勾配",
@@ -5598,6 +5648,14 @@
"values must be numbers or expressions": "値は数値または式にしてください",
"view.auto_ortho_faces": "回転中は透視投影、面を正面に見ると平行投影",
"view.render_inspector": "レンダーインスペクター",
"view_gizmo.arrows": "回転矢印",
"view_gizmo.home": "ホーム ボタン",
"view_gizmo.no_such_body": "このデザインにその名前のボディはありません。",
"view_gizmo.note": "ビューでボディを選択してください。ボディは環境設定と設定プロファイルに保存され、すべてのデザインで表示されます。面をクリックすると、その面を正面から見ます。",
"view_gizmo.texture": "テクスチャ",
"view_gizmo.themed": "テーマ",
"view_gizmo.too_detailed": "ビューナビゲーターには細かすぎます (10,000 三角形を超えています)",
"view_gizmo.too_thin": "ビューナビゲーターには細長すぎます: 最も薄い辺が最も長い辺の 5 分の 1 以上である必要があります",
"web.files.insert_drawings_hint": "CADファイル、メッシュ、DXF、SVGを開いているデザインに挿入",
"web.files.insert_stored_drawings_hint": "開いているデザインに挿入(CADファイル、メッシュ、DXF、SVG)",
"web.open_full": "SolidCraft で開く",
File diff suppressed because it is too large Load Diff
+29
View File
@@ -1133,6 +1133,7 @@
"cmd.timeline_stop": "기록 재생 중지",
"cmd.timeline_suppress": "특성 비활성화",
"cmd.ui.assistant": "도우미 표시 전환",
"cmd.view.navigator": "사용자 지정 뷰 탐색기",
"cmd.view.render_browser": "렌더 브라우저",
"cmd.view.render_dock": "렌더 도크 이동",
"cmd.view.render_focus": "렌더 집중 보기",
@@ -1207,6 +1208,9 @@
"dialog.custom_axis": "↖ 사용자 정의 축",
"dialog.dimension_insert_hint": "다른 구동 치수를 두 번 클릭하여 이름 삽입",
"dialog.dimension_name": "치수: {name}",
"dialog.dimension_step_down": "{step} 줄이기",
"dialog.dimension_step_expression": "숫자만 증감할 수 있으며 수식은 입력한 그대로 유지됩니다",
"dialog.dimension_step_up": "{step} 늘리기",
"dialog.edit_title": "{title} 편집",
"dialog.pattern_sketch_not_object": "바디나 피처를 선택하세요. 스케치는 둘 다 아닙니다. 곡선은 스케치 안의 패턴이나 대칭 복사로 반복하거나, 먼저 돌출하세요.",
"dialog.select": "↖ 선택",
@@ -1237,6 +1241,9 @@
"dxf.tolerance_help": "표시된 바디와 스케치만 내보내며 곡선은 직선 구간으로 근사합니다. 허용 오차가 작을수록 곡선이 매끄러워지지만 처리 시간과 메모리 사용량이 늘어납니다.",
"each rail's curves must be in one sketch": "각 레일의 곡선은 하나의 스케치 안에 있어야 합니다",
"feature computation ended without a result": "특성 계산이 결과 없이 끝났습니다",
"file.open.portal_fallback.no_portal_service": "열린 파일 선택은 데스크톱의 것이 아닙니다: 데스크톱의 파일 선택 서비스를 사용할 수 없습니다.",
"file.open.portal_fallback.no_session_bus": "열린 파일 선택은 데스크톱의 것이 아닙니다: D-Bus 세션 버스가 없습니다.",
"file.open.portal_fallback.xwayland": "열린 파일 선택은 데스크톱의 것이 아닙니다: XWayland에서는 포털이 부모 창을 거부합니다.",
"file_load.built": "지금까지 빌드됨: 피처 {total}개 중 {built}개.",
"file_load.converting": "솔리드 변환 중 {done}/{total}",
"file_load.inserting": "기하 삽입 중",
@@ -1431,6 +1438,7 @@
"material.selection.mixed": "서로 다른 재질",
"measure.at": "위치",
"measure.item": "항목 {number}",
"measure.line_to_centre": "선에서 중심까지",
"messages.ago_h": "{n}시간 전",
"messages.ago_min": "{n}분 전",
"messages.ago_s": "{n}초 전",
@@ -1720,6 +1728,13 @@
"prefs.dialogs_edge": "뷰 가장자리",
"prefs.dialogs_left_column": "왼쪽 열",
"prefs.dialogs_note": "명령 대화 상자가 열리는 위치: 뷰 가장자리에 고정하거나, 왼쪽 열에서 브라우저와 이력 대신 표시합니다. 대화 상자를 닫으면 브라우저와 이력이 그대로 돌아옵니다.",
"prefs.dimension_step_angle": "창의 화살표, 위/아래 키와 휠이 각도에 더하는 값",
"prefs.dimension_step_length": "창의 화살표, 위/아래 키와 휠이 길이에 더하는 값",
"prefs.dimension_steps": "창의 증감 단위",
"prefs.dimension_values": "치수 값",
"prefs.dimension_values_note": "치수 값을 입력하는 위치입니다. 창에는 값을 증감하는 화살표가 있으며, 치수 도구는 텍스트를 먼저 배치합니다.",
"prefs.dimension_values_view": "뷰에서",
"prefs.dimension_values_window": "창에서",
"prefs.display": "표시",
"prefs.edges": "모서리 및 음영",
"prefs.extend": "확장",
@@ -1878,6 +1893,8 @@
"prefs.search": "설정 검색",
"prefs.search_empty": "일치하는 설정이 없습니다",
"prefs.select": "선택",
"prefs.select_hidden_edges": "숨은 모서리가 표시된 음영 뷰에서 숨은 모서리 선택",
"prefs.select_hidden_edges_help": "숨은 모서리가 표시된 음영 뷰에서 면 뒤의 모서리를 선택하여 필렛에 사용할 수 있습니다. 끄면 v0.30.1의 선택 동작을 유지합니다. 숨긴 바디는 선택되지 않습니다.",
"prefs.select_one_item": "항목 하나 선택",
"prefs.select_other_hidden": "다른 항목 선택으로 숨겨진 형상 선택",
"prefs.select_other_hidden_help": "켜짐: 포인터 근처의 숨겨진 바디, 스케치 및 가려진 모서리를 포함합니다. 꺼짐: 포인터 바로 아래에 보이는 형상만 포함하는 기존 목록을 사용합니다.",
@@ -1902,6 +1919,8 @@
"prefs.sketch.click_selects": "클릭으로 선택",
"prefs.sketch.conflict_colour": "충돌 색상",
"prefs.sketch.drawing": "그리기",
"prefs.sketch.ellipse_axes": "타원을 축과 함께 그리기",
"prefs.sketch.ellipse_axes_note": "장축과 단축을 구성선으로 그려 반축과 축에 치수를 지정할 수 있습니다. 끄면: 타원만 그리며, D는 값을 어디로 끌든 단반경을 주며, 이전처럼 R로 표시되어 그려집니다.",
"prefs.sketch.exit_keep": "유지",
"prefs.sketch.exit_previous": "이전 뷰로 돌아가기",
"prefs.sketch.exit_unless_rotated": "회전하지 않았다면",
@@ -3575,6 +3594,7 @@
"ui.default_modelling_orientation": "기본 모델링 방향",
"ui.delete": "삭제",
"ui.delete_select_first": "먼저 삭제할 항목을 선택하세요: 피처, 바디, 컴포넌트 또는 스케치 형상",
"ui.dependents_select_first": "먼저 종속 항목을 표시할 대상을 선택하세요",
"ui.depth": "깊이",
"ui.design": "디자인",
"ui.design_properties.author": "작성자",
@@ -3772,6 +3792,7 @@
"ui.heading_construct": "구성",
"ui.heading_create": "만들기",
"ui.heading_create_sketch": "스케치 만들기",
"ui.heading_custom_view_navigator": "사용자 지정 뷰 탐색기",
"ui.heading_cylinder": "원통",
"ui.heading_design": "디자인",
"ui.heading_draft": "구배",
@@ -4299,5 +4320,13 @@
"values must be finite numbers": "값은 유한한 숫자여야 합니다",
"values must be numbers or expressions": "값은 숫자 또는 식이어야 합니다",
"view.render_inspector": "렌더 검사기",
"view_gizmo.arrows": "회전 화살표",
"view_gizmo.home": "홈 버튼",
"view_gizmo.no_such_body": "이 디자인에 그런 이름의 바디가 없습니다.",
"view_gizmo.note": "뷰에서 바디를 선택하십시오. 바디는 환경설정과 설정 프로필에 저장되어 모든 디자인에 표시됩니다. 면을 클릭하면 그 면을 정면으로 봅니다.",
"view_gizmo.texture": "텍스처",
"view_gizmo.themed": "테마",
"view_gizmo.too_detailed": "뷰 탐색기에 너무 세밀합니다 (삼각형 10,000개 초과)",
"view_gizmo.too_thin": "뷰 탐색기에 너무 가늘고 깁니다: 가장 얇은 변이 가장 긴 변의 5분의 1 이상이어야 합니다",
"↑ ↓ choose · Enter / Tab complete · Esc dismiss": "↑ ↓ 선택 · Enter / Tab 완성 · Esc 닫기"
}
+11
View File
@@ -1368,6 +1368,9 @@
"dialog.custom_axis": "↖ Aangepaste as",
"dialog.dimension_insert_hint": "Klik op een andere aandrijvende maat om de naam ervan in te voegen",
"dialog.dimension_name": "Maat: {name}",
"dialog.dimension_step_down": "{step} omlaag",
"dialog.dimension_step_expression": "Alleen een getal verspringt; een uitdrukking blijft zoals ingevoerd",
"dialog.dimension_step_up": "{step} omhoog",
"dialog.edit_title": "{title} BEWERKEN",
"dialog.no_shown_body": "Geen zichtbaar lichaam om te wijzigen: toon er een of kies Nieuw lichaam",
"dialog.pattern_sketch_not_object": "Kies lichamen of kenmerken: een schets is geen van beide. Herhaal de curven ervan met het eigen Patroon of Spiegelen van de schets, of extrudeer de schets eerst.",
@@ -1392,6 +1395,7 @@
"document.read_only_save": "Dit ontwerp is alleen-lezen geopend: sla het op als nieuw bestand",
"document.save_changes": "Wijzigingen in {name} opslaan?",
"document.save_copy": "Kopie opslaan…",
"document.tab_unsaved_changes": "Niet-opgeslagen wijzigingen",
"document.unsaved_changes": "{name} heeft niet-opgeslagen wijzigingen. Als u niet opslaat, gaan ze verloren.",
"drive.rigid": "{joint} is een starre verbinding: die houdt zijn onderdelen vast en heeft dus niets om aan te sturen. Wijzig het type in Verbinding bewerken om ze te laten bewegen: Draaiend om te draaien, Schuivend om te schuiven, Cilindrisch voor beide.",
"drive.stopped_by_contact": "Gestopt bij {value}: {a} zou door {b} heen gaan",
@@ -2194,6 +2198,13 @@
"prefs.dialogs_edge": "Aan de rand van de weergave",
"prefs.dialogs_left_column": "In de linkerkolom",
"prefs.dialogs_note": "Waar opdrachtdialogen openen: vastgezet aan de rand van de weergave, of in de linkerkolom in plaats van de browser en de geschiedenis, die terugkomen zoals ze waren wanneer de dialoog sluit.",
"prefs.dimension_step_angle": "Wat de pijlen van het venster, Omhoog/Omlaag en het wieltje bij een hoek optellen",
"prefs.dimension_step_length": "Wat de pijlen van het venster, Omhoog/Omlaag en het wieltje bij een lengte optellen",
"prefs.dimension_steps": "Stappen in het venster",
"prefs.dimension_values": "Maatwaarden",
"prefs.dimension_values_note": "Waar de waarde van een maat wordt ingevoerd. Een venster heeft pijlen die de waarde laten verspringen; het maatgereedschap plaatst eerst de tekst.",
"prefs.dimension_values_view": "In de weergave",
"prefs.dimension_values_window": "In een venster",
"prefs.display": "Weergave",
"prefs.edges": "Randen en schaduwing",
"prefs.extend": "Verlengen",
@@ -0,0 +1,7 @@
{
"en": {
"document.newer_file": "Saved by a newer SolidCraft (format {format}, this version reads up to {reads}). If something's missing, update.",
"document.newer_file_change": "Saved by a newer SolidCraft (format {format} with `{change}`, which this version doesn't know). If something's missing, update.",
"document.newer_file_not_read": "Not read: {what}. Saving keeps it."
}
}
+3
View File
@@ -1347,6 +1347,7 @@
"document.read_only_save": "Ten projekt otwarto tylko do odczytu: zapisz go jako nowy plik",
"document.save_changes": "Zapisać zmiany w {name}?",
"document.save_copy": "Zapisz kopię…",
"document.tab_unsaved_changes": "Niezapisane zmiany",
"document.unsaved_changes": "{name} ma niezapisane zmiany. Jeśli ich nie zapiszesz, zostaną utracone.",
"drive.rigid": "{joint} to złącze sztywne: utrzymuje swoje części nieruchomo, więc nie ma czym sterować. Aby mogły się poruszać, zmień jego typ w Edytuj złącze: Obrotowe do obrotu, Przesuwne do przesuwu, Walcowe do obu.",
"drive.stopped_by_contact": "Zatrzymano przy {value}: {a} przeszedłby przez {b}",
@@ -1985,6 +1986,8 @@
"prefs.shortcuts": "Skróty",
"prefs.single_surface_analysis": "Używaj jednej analizy powierzchni",
"prefs.single_surface_analysis_help": "Gdy wyłączone, cieniowanie powierzchni i Ciągłość mogą być włączone jednocześnie. Włączenie zachowuje ostatnio uruchomioną lub zmienioną analizę.",
"prefs.sketch.ellipse_axes": "Rysuj elipsy z osiami",
"prefs.sketch.ellipse_axes_note": "Oś wielka i mała jako linie konstrukcyjne, aby można było wymiarować półosie i osie. Wyłączone: sama elipsa, a D na niej daje promień małej półosi, gdziekolwiek przeciągnąć wartość, rysowany i oznaczony R jak dotąd.",
"prefs.sketch_align_points": "Wyrównuj do innych punktów szkicu podczas rysowania",
"prefs.sketch_align_points_note": "Podczas rysowania punkt wyrównuje się jednocześnie poziomo z jednym punktem szkicu i pionowo z innym, z kropkowaną linią pomocniczą, a kliknięcie zachowuje oba wyrównania. Wyłączone: tylko z poprzednim punktem, po jednej osi.",
"prefs.sketch_conflict_colour": "Geometria w konflikcie w kolorze konfliktu",
+22 -1
View File
@@ -182,6 +182,8 @@
"Designs you open or save appear here.": "Здесь появляются открытые и сохранённые дизайны.",
"Determined by To Object. Choose Angle to edit the angular extent.": "Определяется параметром «До объекта». Выберите «Угол», чтобы задать угловой предел.",
"Diameter": "Диаметр",
"Did this assembly open the wrong way up?": "Эта сборка открылась не той стороной вверх?",
"Did this part open the wrong way up?": "Эта деталь открылась не той стороной вверх?",
"Dimension new shapes": "Проставлять размеры новых фигур",
"Direction": "Направление",
"Discard": "Отменить",
@@ -606,6 +608,7 @@
"Square": "Квадрат",
"Stand it up": "Поставить вертикально",
"Stand it up: a quarter turn about X, as one Move feature you can undo.": "Поставить вертикально: четверть оборота вокруг X одной операцией «Переместить», которую можно отменить.",
"Stand this assembly up?": "Поставить эту сборку вертикально?",
"Stand this part up?": "Поставить эту деталь вертикально?",
"Start angle": "Начальный угол",
"Start bulge": "Выпуклость в начале",
@@ -1356,6 +1359,7 @@
"dialog.dimension_insert_hint": "Дважды щёлкните другой управляющий размер, чтобы вставить его имя",
"dialog.dimension_name": "Размер: {name}",
"dialog.edit_title": "ИЗМЕНИТЬ: {title}",
"dialog.no_shown_body": "Нет отображаемого тела для изменения: покажите тело или выберите «Новое тело»",
"dialog.pattern_sketch_not_object": "Выберите тела или операции: эскиз — ни то, ни другое. Повторите его кривые собственным инструментом «Массив» или «Зеркало» в эскизе либо сначала выдавите его.",
"dialog.select": "↖ Выбрать",
"dialog.selected_count": "↖ Выбрано: {count}",
@@ -1717,6 +1721,8 @@
"help.view.spin": "Непрерывно вращает вид вокруг модели до следующего щелчка или нажатия клавиши. Используйте, чтобы показать модель со всех сторон.",
"help.view.tool": "Закрепляет инструмент камеры (орбиту, панорамирование или масштаб), так что перетаскивание левой кнопкой мыши двигает вид, пока вы его не отключите. Используйте на трекпаде или без средней кнопки мыши.",
"help.view.visual_style": "Переключает способ отрисовки модели: тонированная с рёбрами или без них, каркас или со скрытыми рёбрами. Используйте каркас, чтобы заглянуть внутрь, а тонированный вид — для чистого вида.",
"history.sketch_under_constrained": "Недоопределён (степеней свободы: {count})",
"history.sketch_under_constrained_one": "Недоопределён ({count} степень свободы)",
"hole_presets.confirm_delete": "Подтвердить удаление",
"hole_presets.delete": "Удалить",
"hole_presets.delete_prompt": "Удалить этот личный пресет? Существующие отверстия не изменятся.",
@@ -2128,6 +2134,8 @@
"prefs.anti_aliasing_note": "Сглаживает неровные края.",
"prefs.applies_on_restart": "Применяется после перезапуска",
"prefs.assistant": "Ассистент",
"prefs.auto_operation": "Выбирать операцию автоматически",
"prefs.auto_operation_note": "Выбор «Объединить», «Новое тело» или «Вырезать» по тому, чего касается материал.",
"prefs.axes": "Оси",
"prefs.axis": "Ось",
"prefs.bodies_folders": "Папки тел",
@@ -2349,6 +2357,8 @@
"prefs.sketch_selection": "Эскиз и выделение",
"prefs.sketch_selection_heading": "Эскиз и выделение",
"prefs.sketch_selection_note": "Как работает привязка в эскизах и как щелчки выделяют объекты.",
"prefs.sketch_state_icons": "Значки эскизов в цвете их состояния",
"prefs.sketch_state_icons_note": "В истории и браузере значок эскиза принимает цвет его состояния (недоопределён, полностью определён или с конфликтом), а подсказка называет это состояние. Выкл.: у всех эскизов одинаковый значок.",
"prefs.sketch_tab_always": "Всегда показывать вкладку «Эскиз»",
"prefs.sketch_tab_always_note": "Вкладка «Эскиз» остаётся на ленте сразу после «Модель», пока не открыт ни один эскиз. Её инструменты рисования создают эскиз на выбранной плоскости или грани либо на плоскости, которую вы выберете следом, и сразу включают нужный инструмент.",
"prefs.sketch_tracking_guides": "Направляющие выравнивания по центру и середине",
@@ -2360,6 +2370,11 @@
"prefs.source": "Источник",
"prefs.speed": "Скорость",
"prefs.stand_up_note": "После открытия файла STEP или IGES с осью Z вверх предлагать повернуть его на четверть оборота вокруг X.",
"prefs.stand_up_unknown": "Для файлов из неизвестных программ",
"prefs.stand_up_unknown.ask": "Спрашивать в диалоговом окне",
"prefs.stand_up_unknown.note": "Показывать уведомление",
"prefs.stand_up_unknown.off": "Не предлагать",
"prefs.stand_up_unknown_note": "Как делается предложение, когда в файле не указана известная программа.",
"prefs.status_bar": "Строка состояния",
"prefs.status_bar_note": "Тонкая полоса вдоль нижнего края окна показывает, что изменяется, состояние открытого эскиза его цветом и единицы дизайна; щелчок по единицам изменяет их. Состояние эскиза при этом больше не показывается в углу вида.",
"prefs.status_done": "Готово",
@@ -3863,7 +3878,7 @@
"status.navigation": "Назначение кнопок мыши: {mapping}",
"status.navigation_tip": "Как мышь двигает вид. Щёлкните, чтобы выбрать другое назначение",
"status.under_constrained": "Недоопределён (степеней свободы: {count})",
"status.under_constrained_one": "Недоопределён (степеней свободы: {count})",
"status.under_constrained_one": "Недоопределён ({count} степень свободы)",
"status.units_tip": "Единицы дизайна. Щёлкните, чтобы изменить",
"the angle must be a number": "угол должен быть числом",
"the curves must be in one sketch": "кривые должны быть в одном эскизе",
@@ -3902,8 +3917,10 @@
"timeline.move_to_group": "Переместить операции в папку",
"timeline.rename_group": "Переименовать папку операций",
"timeline.reorder_many": "Изменить порядок операций",
"timeline.suppress_features": "Подавить операции",
"timeline.suppress_folders_tip": "Подавить или снять подавление со всех операций в папках и вложенных папках",
"timeline.ungroup": "Убрать папки операций",
"timeline.unsuppress_features": "Снять подавление с операций",
"to the face": "до грани",
"to the next face": "до следующей грани",
"toolbar.customize_note": "Вкладка {tab}. Отметьте команду, чтобы добавить её кнопку на панель инструментов. Можно также перетащить строку из выпадающего меню панели на панель инструментов, перетащить кнопку за пределы панели для удаления или использовать значок закрепления в строке выпадающего меню.",
@@ -4349,6 +4366,8 @@
"ui.cancel": "Отмена",
"ui.canvases": "Подложки",
"ui.center": "Центр",
"ui.center_arc_follows_cursor": "Дуга из центра следует направлению курсора",
"ui.center_arc_follows_cursor_tip": "Дуга из центра идёт по часовой стрелке или против неё — в ту сторону, в которую курсор обходит её центр. Выкл.: всегда против часовой стрелки от начальной точки.",
"ui.centerline": "Осевая линия",
"ui.chain": "Цепочка",
"ui.chamfer": "Фаска",
@@ -5160,11 +5179,13 @@
"update.installed": "SolidCraft {version} установлен. Перезапустите, чтобы использовать его.",
"update.installer_started": "Установщик запустится после закрытия SolidCraft.",
"update.later": "Напомнить позже",
"update.managed": "Доступно обновление: обновите SolidCraft в {manager}",
"update.no_notes": "У этого выпуска нет примечаний.",
"update.package_hint": "Эта копия установлена из {kind}. Скачайте новый пакет, затем установите его командой:",
"update.prefs_dev": "Это сборка для разработки ({version}): она не проверяет обновления.",
"update.prefs_flatpak": "Эту копию ({version}) обновляет Flatpak: выполните {command} или воспользуйтесь центром приложений. SolidCraft не проверяет обновления.",
"update.prefs_label": "Обновления",
"update.prefs_managed": "Это SolidCraft {version}, которым управляет {manager}. Проверка запрашивает у GitHub последний релиз и больше ничего не отправляет; обновляйте SolidCraft в {manager}.",
"update.prefs_note": "Это SolidCraft {version} ({kind}). При проверке у GitHub запрашивается последний выпуск, больше ничего не отправляется.",
"update.prefs_web": "Перезагрузите страницу, чтобы получить последнюю версию веб-приложения. Если сеть недоступна или обновление не успевает загрузиться, открывается сохранённая версия; незавершённая загрузка продолжится до следующей перезагрузки.",
"update.refresh_checking": "Проверка наличия новейшего выпуска…",
+1
View File
@@ -1392,6 +1392,7 @@
"document.read_only_save": "Den här konstruktionen öppnades skrivskyddad: spara den som en ny fil",
"document.save_changes": "Spara ändringar i {name}?",
"document.save_copy": "Spara en kopia…",
"document.tab_unsaved_changes": "Osparade ändringar",
"document.unsaved_changes": "{name} har osparade ändringar. Om du inte sparar går de förlorade.",
"drive.rigid": "{joint} är ett stelt led: det håller sina delar stilla och har därför inget att driva. Om delarna ska kunna röra sig, ändra ledets typ i Redigera led: Roterande för att rotera, Glidande för att glida, Cylindrisk för båda.",
"drive.stopped_by_contact": "Stoppade vid {value}: {a} skulle gå igenom {b}",
+490 -78
View File
File diff suppressed because it is too large Load Diff
+58
View File
@@ -85,6 +85,7 @@
"Bottom Right": "Dưới cùng bên phải",
"Boundary": "Biên dạng bao",
"Bounding box": "Hộp bao ngoài",
"Bridge": "Cầu nối",
"CHECK": "KIỂM TRA",
"COMPONENTS": "CHI TIẾT",
"CONFIGURATIONS": "CẤU HÌNH",
@@ -1296,6 +1297,7 @@
"cmd.timeline_stop": "Dừng lịch sử",
"cmd.timeline_suppress": "Tạm nén tính năng",
"cmd.ui.assistant": "Bật/tắt trợ lý",
"cmd.view.navigator": "Khối điều hướng góc nhìn tùy chỉnh",
"cmd.view.render_browser": "Trình duyệt kết xuất",
"cmd.view.render_dock": "Di chuyển neo kết xuất",
"cmd.view.render_focus": "Chế độ xem tập trung kết xuất",
@@ -1396,6 +1398,9 @@
"dialog.custom_axis": "↖ Trục tùy chỉnh",
"dialog.dimension_insert_hint": "Nhấp vào một kích thước điều khiển khác để chèn tên của nó",
"dialog.dimension_name": "Kích thước: {name}",
"dialog.dimension_step_down": "Giảm {step}",
"dialog.dimension_step_expression": "Chỉ số mới thay đổi theo bước; biểu thức giữ nguyên như đã nhập",
"dialog.dimension_step_up": "Tăng {step}",
"dialog.edit_title": "CHỈNH SỬA {title}",
"dialog.no_shown_body": "Không có thân khối đang hiển thị để thay đổi: hãy hiển thị một thân khối, hoặc chọn “Tạo mới Thân khối”",
"dialog.pattern_sketch_not_object": "Hãy chọn thân khối hoặc tính năng: bản phác thảo không phải là cả hai. Lặp lại các đường cong của nó bằng Mảng hoặc Lấy đối xứng trong chính bản phác thảo, hoặc đùn khối nó trước.",
@@ -1403,6 +1408,7 @@
"dialog.selected_count": "↖ {count} đã chọn",
"dialog.selection_constraint": "Ràng buộc {id}",
"dialog.selection_external_curve": "{sketch} · đường cong {id}",
"dialog.selection_external_point": "{point} · {sketch}",
"dialog.selection_guidance": "Chọn một mục đầu vào để thay đổi. Nhấp vào đối tượng đã chọn để bỏ chọn; Ctrl/Cmd-nhấp để bật/tắt chọn. Xem trước kết quả, sau đó nhấn OK.",
"dialog.selection_midpoint": "Trung điểm · {id}",
"dialog.selection_profile": "{sketch} · biên dạng {number}",
@@ -1420,6 +1426,7 @@
"document.read_only_save": "Thiết kế này được mở ở chế độ chỉ đọc: hãy lưu thành tệp mới",
"document.save_changes": "Lưu các thay đổi đối với {name}?",
"document.save_copy": "Lưu bản sao…",
"document.tab_unsaved_changes": "Thay đổi chưa lưu",
"document.unsaved_changes": "{name} có các thay đổi chưa lưu. Nếu không lưu, các thay đổi sẽ bị mất.",
"drive.rigid": "{joint} là khớp nối cứng: nó giữ cố định các chi tiết, nên không có gì để dẫn động. Để các chi tiết chuyển động, hãy đổi loại khớp nối trong “Chỉnh sửa khớp nối”: Revolute để xoay, Slider để trượt, Cylindrical cho cả hai.",
"drive.stopped_by_contact": "Đã dừng tại {value}: {a} sẽ xuyên qua {b}",
@@ -1440,6 +1447,9 @@
"each rail's curves must be in one sketch": "các đường cong của mỗi đường dẫn hướng phải nằm trong cùng một phác thảo",
"feature computation ended without a result": "việc tính toán đặc trưng kết thúc mà không có kết quả",
"file.open.drawing_filter": "Thiết kế, tệp CAD, lưới đa giác và bản vẽ",
"file.open.portal_fallback.no_portal_service": "Bộ chọn tệp đã mở không phải của riêng desktop: dịch vụ chọn tệp của desktop không khả dụng.",
"file.open.portal_fallback.no_session_bus": "Bộ chọn tệp đã mở không phải của riêng desktop: không có bus phiên D-Bus.",
"file.open.portal_fallback.xwayland": "Bộ chọn tệp đã mở không phải của riêng desktop: dưới XWayland, portal từ chối cửa sổ cha.",
"file_load.built": "Đã dựng được: {built} trên {total} tính năng.",
"file_load.converting": "Đang chuyển đổi khối đặc {done} trên {total}",
"file_load.inserting": "Đang chèn hình học",
@@ -1999,6 +2009,7 @@
"material.selection.mixed": "Các vật liệu khác nhau",
"measure.at": "Tại",
"measure.item": "Mục {number}",
"measure.line_to_centre": "Từ đường đến tâm",
"measure.quick_copied": "Đã sao chép số đo",
"measure.quick_copy": "Nhấp để sao chép số đo",
"measure.quick_edges": "{count} cạnh",
@@ -2331,6 +2342,13 @@
"prefs.dialogs_edge": "Ở cạnh khung nhìn",
"prefs.dialogs_left_column": "Trong cột bên trái",
"prefs.dialogs_note": "Nơi hộp thoại lệnh mở ra: gắn ở cạnh khung nhìn, hoặc trong cột bên trái thay cho trình duyệt và Lịch sử, hai phần này trở lại như cũ khi hộp thoại đóng.",
"prefs.dimension_step_angle": "Lượng mà mũi tên của cửa sổ, Lên/Xuống và con lăn cộng vào một góc",
"prefs.dimension_step_length": "Lượng mà mũi tên của cửa sổ, Lên/Xuống và con lăn cộng vào một độ dài",
"prefs.dimension_steps": "Bước của cửa sổ",
"prefs.dimension_values": "Giá trị kích thước",
"prefs.dimension_values_note": "Nơi bạn nhập giá trị kích thước. Cửa sổ có mũi tên để thay đổi theo bước; công cụ Kích thước đặt văn bản trước.",
"prefs.dimension_values_view": "Trong khung nhìn",
"prefs.dimension_values_window": "Trong một cửa sổ",
"prefs.display": "Hiển thị",
"prefs.edges": "Cạnh và đổ bóng",
"prefs.extend": "Kéo dài",
@@ -2541,6 +2559,8 @@
"prefs.section_hatch_by_part": "Theo chi tiết",
"prefs.section_hatch_one": "Một kiểu",
"prefs.select": "Chọn",
"prefs.select_hidden_edges": "Chọn cạnh bị che trong chế độ tô bóng có cạnh ẩn",
"prefs.select_hidden_edges_help": "Cho phép chọn cạnh xuyên qua bề mặt khi dùng chế độ tô bóng có cạnh ẩn, kể cả cho lệnh Fillet. Tắt để giữ cách chọn của v0.30.1. Các khối đã ẩn vẫn không thể chọn.",
"prefs.select_one_item": "Chọn một mục",
"prefs.select_other_hidden": "Chọn hình học ẩn bằng Chọn đối tượng khác",
"prefs.select_other_hidden_help": "Bật: bao gồm các khối, bản phác thảo ẩn và cạnh bị che gần con trỏ. Tắt: dùng danh sách ban đầu chỉ gồm hình học đang hiển thị ngay dưới con trỏ.",
@@ -2565,6 +2585,8 @@
"prefs.sketch.click_selects": "Nhấp để chọn",
"prefs.sketch.conflict_colour": "Màu xung đột",
"prefs.sketch.drawing": "Vẽ",
"prefs.sketch.ellipse_axes": "Vẽ hình elip kèm các trục",
"prefs.sketch.ellipse_axes_note": "Trục lớn và trục nhỏ dưới dạng đường gióng dựng hình, để có thể ghi kích thước bán trục và trục. Tắt: chỉ vẽ hình elip, và D trên nó cho bán kính nhỏ dù kéo giá trị đến đâu, được vẽ và ghi nhãn R như trước.",
"prefs.sketch.exit_keep": "Giữ nguyên",
"prefs.sketch.exit_previous": "Trở về góc nhìn trước đó",
"prefs.sketch.exit_unless_rotated": "Trừ khi đã xoay",
@@ -4155,6 +4177,32 @@
"sketch.dof_left": "Còn {count} bậc tự do",
"sketch.dof_left_one": "Còn {count} bậc tự do",
"sketch.draw_curves": "Vẽ dưới dạng {linetype}",
"sketch.error.closed_curve_two_crossings": "a closed curve needs two crossings to trim",
"sketch.error.nothing_to_break": "nothing to break here",
"sketch.error.offset_fillet_chamfer": "`{id}` is an offset, and its corners follow its source curves: round or cut the source corners before offsetting, or break the offset association first",
"sketch.error.offset_trim": "`{id}` is an offset, and its ends follow its source curves: edit the source curves instead, or break the offset association first",
"sketch.hint.arc.center_point": "Arc: click center and start, go round either way and click the end, or type a signed sweep",
"sketch.hint.arc.three_point": "Arc: click start, end, then a point on the arc",
"sketch.hint.arc3d": "3D Arc: click start, end, then a point on the arc (points may leave the sketch plane)",
"sketch.hint.break": "Break: click a curve where it should split",
"sketch.hint.circle.center": "Circle: click the center, then a point on the circle",
"sketch.hint.constraint.generic": "Constraint: pick the sketch entities",
"sketch.hint.constraint.horizontal_vertical": "Horizontal/Vertical: pick a line, two points, or a point and a line; hold Shift to pick a line midpoint",
"sketch.hint.constraint.midpoint": "MidPoint: pick a point and a line, or two lines to center the second on the first",
"sketch.hint.dimension": "Dimension: pick one or two entities and type the value (or click to place it first); click a dimension to edit it; Enter applies",
"sketch.hint.extend": "Extend: click a curve near the end to extend (Shift: click two curves to extend both to where they meet)",
"sketch.hint.fallback": "Click in the sketch",
"sketch.hint.line": "Line: click points; right-click or Esc to finish",
"sketch.hint.line3d": "3D Line: click world points; right-click or Esc to finish (points may leave the sketch plane)",
"sketch.hint.open_done": "Open done",
"sketch.hint.point3d": "3D Point: click where a 3D point goes",
"sketch.hint.rectangle.center": "Center rectangle: click the center, then a corner",
"sketch.hint.rectangle.rounded": "Rounded rectangle: click two opposite corners (Tab to the radius box to type the corner radius)",
"sketch.hint.rectangle.three_point": "3-point rectangle: click two points of one edge, then the width",
"sketch.hint.rectangle.two_point": "Rectangle: click two opposite corners",
"sketch.hint.slot": "Slot: click both ends, then the width",
"sketch.hint.spline3d": "3D Spline: click fit points in 3D; right-click or Esc to finish",
"sketch.hint.trim": "Trim: click the piece of a curve to remove, or drag across the pieces to remove",
"sketch.make_selection": "Chuyển đổi vùng chọn sang {linetype}",
"sketch.open_ends": "Đầu hở: {count}",
"sketch.status_conflict": "ràng buộc xung đột",
@@ -4797,6 +4845,7 @@
"ui.default_modelling_orientation": "Hướng mô hình hóa mặc định",
"ui.delete": "Xóa",
"ui.delete_select_first": "Hãy chọn trước những gì cần xóa: tính năng, khối, thành phần hoặc hình học phác thảo",
"ui.dependents_select_first": "Hãy chọn trước đối tượng để liệt kê các phần phụ thuộc của nó",
"ui.depth": "Độ sâu",
"ui.design": "Thiết kế",
"ui.design_properties.author": "Tác giả",
@@ -5003,6 +5052,7 @@
"ui.heading_construct": "DỰNG HÌNH",
"ui.heading_create": "TẠO MỚI",
"ui.heading_create_sketch": "TẠO PHÁC THẢO",
"ui.heading_custom_view_navigator": "KHỐI ĐIỀU HƯỚNG GÓC NHÌN TÙY CHỈNH",
"ui.heading_cylinder": "HÌNH TRỤ",
"ui.heading_design": "THIẾT KẾ",
"ui.heading_draft": "ĐỘ DỐC THOÁT KHUÔN",
@@ -5598,6 +5648,14 @@
"values must be numbers or expressions": "các giá trị phải là số hoặc biểu thức",
"view.auto_ortho_faces": "Phối cảnh khi xoay quỹ đạo, trực giao khi nhìn trực diện mặt",
"view.render_inspector": "Bảng thuộc tính kết xuất",
"view_gizmo.arrows": "Mũi tên xoay",
"view_gizmo.home": "Nút góc nhìn mặc định (Home)",
"view_gizmo.no_such_body": "Thiết kế này không có thân khối nào mang tên đó.",
"view_gizmo.note": "Chọn một thân khối trong khung nhìn. Thân khối được lưu cùng tùy chọn và hồ sơ cài đặt của bạn, và hiển thị trong mọi thiết kế. Nhấp vào một mặt của nó để nhìn thẳng vào mặt đó.",
"view_gizmo.texture": "Kết cấu",
"view_gizmo.themed": "Theo chủ đề",
"view_gizmo.too_detailed": "Quá chi tiết cho khối điều hướng góc nhìn (hơn 10.000 tam giác)",
"view_gizmo.too_thin": "Quá dài và mảnh cho khối điều hướng góc nhìn: cạnh mỏng nhất phải ít nhất bằng một phần năm cạnh dài nhất",
"web.files.insert_drawings_hint": "Tệp CAD, lưới đa giác, DXF hoặc SVG vào thiết kế đang mở",
"web.files.insert_stored_drawings_hint": "Vào thiết kế đang mở (tệp CAD, lưới đa giác, DXF, SVG)",
"web.open_full": "Mở trong SolidCraft",
+58
View File
@@ -85,6 +85,7 @@
"Bottom Right": "右下",
"Boundary": "边界",
"Bounding box": "边界框",
"Bridge": "桥接",
"CHECK": "检查",
"COMPONENTS": "组件",
"CONFIGURATIONS": "配置",
@@ -1296,6 +1297,7 @@
"cmd.timeline_stop": "停止历史播放",
"cmd.timeline_suppress": "抑制特征",
"cmd.ui.assistant": "切换助手显示",
"cmd.view.navigator": "自定义视图导航器",
"cmd.view.render_browser": "渲染浏览器",
"cmd.view.render_dock": "移动渲染停靠面板",
"cmd.view.render_focus": "渲染专注视图",
@@ -1396,6 +1398,9 @@
"dialog.custom_axis": "↖ 自定义轴",
"dialog.dimension_insert_hint": "单击其他驱动尺寸以插入其名称",
"dialog.dimension_name": "尺寸:{name}",
"dialog.dimension_step_down": "减少 {step}",
"dialog.dimension_step_expression": "只有数字可以增减;表达式保持不变",
"dialog.dimension_step_up": "增加 {step}",
"dialog.edit_title": "编辑 {title}",
"dialog.no_shown_body": "没有可更改的显示实体:请显示一个实体,或选择新建实体",
"dialog.pattern_sketch_not_object": "请选择实体或特征:草图两者都不是。请用草图自身的阵列或镜像重复其曲线,或先将其拉伸。",
@@ -1403,6 +1408,7 @@
"dialog.selected_count": "↖ 已选择 {count} 个",
"dialog.selection_constraint": "约束 {id}",
"dialog.selection_external_curve": "{sketch} · 曲线 {id}",
"dialog.selection_external_point": "{point} · {sketch}",
"dialog.selection_guidance": "选择输入项进行修改。点击已选对象可取消选择;按住 Ctrl/Cmd 点击也可切换选择。检查预览后,再按“确定”。",
"dialog.selection_midpoint": "中点 · {id}",
"dialog.selection_profile": "{sketch} · 轮廓 {number}",
@@ -1420,6 +1426,7 @@
"document.read_only_save": "此设计以只读方式打开:请另存为新文件",
"document.save_changes": "保存对 {name} 的更改?",
"document.save_copy": "保存副本…",
"document.tab_unsaved_changes": "未保存的更改",
"document.unsaved_changes": "{name} 有未保存的更改。如果不保存,将丢失这些更改。",
"drive.rigid": "{joint} 是刚性接头:它把零件固定在原位,因此没有可驱动的运动。要让零件运动,请在“编辑接头”中更改其类型:旋转用 Revolute,滑动用 Slider,两者兼有用 Cylindrical。",
"drive.stopped_by_contact": "停在 {value}:{a} 会穿过 {b}",
@@ -1440,6 +1447,9 @@
"each rail's curves must be in one sketch": "每条导轨的曲线必须位于同一个草图中",
"feature computation ended without a result": "特征计算结束时没有返回结果",
"file.open.drawing_filter": "设计、CAD 文件、网格和图纸",
"file.open.portal_fallback.no_portal_service": "打开的文件选择器并非桌面自带:桌面的文件选择服务不可用。",
"file.open.portal_fallback.no_session_bus": "打开的文件选择器并非桌面自带:没有 D-Bus 会话总线。",
"file.open.portal_fallback.xwayland": "打开的文件选择器并非桌面自带:在 XWayland 下,门户会拒绝父窗口。",
"file_load.built": "已构建:{built}/{total} 个特征。",
"file_load.converting": "正在转换实体 {done}/{total}",
"file_load.inserting": "正在插入几何体",
@@ -1999,6 +2009,7 @@
"material.selection.mixed": "不同材料",
"measure.at": "位置",
"measure.item": "项目 {number}",
"measure.line_to_centre": "线到圆心",
"measure.quick_copied": "已复制测量值",
"measure.quick_copy": "点击复制测量值",
"measure.quick_edges": "{count} 条边",
@@ -2331,6 +2342,13 @@
"prefs.dialogs_edge": "视图边缘",
"prefs.dialogs_left_column": "左侧栏",
"prefs.dialogs_note": "命令对话框的打开位置:停靠在视图边缘,或在左侧栏中替代浏览器和历史;关闭对话框后,浏览器和历史恢复原样。",
"prefs.dimension_step_angle": "窗口的箭头、上下方向键和滚轮给角度增减的量",
"prefs.dimension_step_length": "窗口的箭头、上下方向键和滚轮给长度增减的量",
"prefs.dimension_steps": "窗口步长",
"prefs.dimension_values": "尺寸值",
"prefs.dimension_values_note": "输入尺寸值的位置。窗口带有可增减数值的箭头;尺寸工具会先放置文字。",
"prefs.dimension_values_view": "在视图中",
"prefs.dimension_values_window": "在窗口中",
"prefs.display": "显示",
"prefs.edges": "边缘与着色",
"prefs.extend": "扩展",
@@ -2541,6 +2559,8 @@
"prefs.section_hatch_by_part": "按零件",
"prefs.section_hatch_one": "单一样式",
"prefs.select": "选择",
"prefs.select_hidden_edges": "在带隐藏边线的着色视图中选择隐藏边",
"prefs.select_hidden_edges_help": "在带隐藏边线的着色视图中,可穿过面选择边并用于圆角。关闭时保留v0.30.1的选择行为。隐藏的实体仍不可选择。",
"prefs.select_one_item": "选择一个项目",
"prefs.select_other_hidden": "使用“选择其他”选择隐藏几何体",
"prefs.select_other_hidden_help": "开启:包括指针附近的隐藏实体、草图和被遮挡的边。关闭:恢复原来的列表,仅包含指针正下方的可见几何体。",
@@ -2565,6 +2585,8 @@
"prefs.sketch.click_selects": "单击选择",
"prefs.sketch.conflict_colour": "冲突颜色",
"prefs.sketch.drawing": "绘制",
"prefs.sketch.ellipse_axes": "绘制椭圆时带上轴线",
"prefs.sketch.ellipse_axes_note": "将长轴和短轴绘制为构造线,以便标注半轴和轴。关闭:仅绘制椭圆,对其按 D 得到短半径,无论将数值拖到何处,都像以前一样绘制并标注 R。",
"prefs.sketch.exit_keep": "保持",
"prefs.sketch.exit_previous": "返回之前的视图",
"prefs.sketch.exit_unless_rotated": "除非已旋转",
@@ -4155,6 +4177,32 @@
"sketch.dof_left": "剩余 {count} 个自由度",
"sketch.dof_left_one": "剩余 {count} 个自由度",
"sketch.draw_curves": "绘制为 {linetype}",
"sketch.error.closed_curve_two_crossings": "a closed curve needs two crossings to trim",
"sketch.error.nothing_to_break": "nothing to break here",
"sketch.error.offset_fillet_chamfer": "`{id}` is an offset, and its corners follow its source curves: round or cut the source corners before offsetting, or break the offset association first",
"sketch.error.offset_trim": "`{id}` is an offset, and its ends follow its source curves: edit the source curves instead, or break the offset association first",
"sketch.hint.arc.center_point": "Arc: click center and start, go round either way and click the end, or type a signed sweep",
"sketch.hint.arc.three_point": "Arc: click start, end, then a point on the arc",
"sketch.hint.arc3d": "3D Arc: click start, end, then a point on the arc (points may leave the sketch plane)",
"sketch.hint.break": "Break: click a curve where it should split",
"sketch.hint.circle.center": "Circle: click the center, then a point on the circle",
"sketch.hint.constraint.generic": "Constraint: pick the sketch entities",
"sketch.hint.constraint.horizontal_vertical": "Horizontal/Vertical: pick a line, two points, or a point and a line; hold Shift to pick a line midpoint",
"sketch.hint.constraint.midpoint": "MidPoint: pick a point and a line, or two lines to center the second on the first",
"sketch.hint.dimension": "Dimension: pick one or two entities and type the value (or click to place it first); click a dimension to edit it; Enter applies",
"sketch.hint.extend": "Extend: click a curve near the end to extend (Shift: click two curves to extend both to where they meet)",
"sketch.hint.fallback": "Click in the sketch",
"sketch.hint.line": "Line: click points; right-click or Esc to finish",
"sketch.hint.line3d": "3D Line: click world points; right-click or Esc to finish (points may leave the sketch plane)",
"sketch.hint.open_done": "Open done",
"sketch.hint.point3d": "3D Point: click where a 3D point goes",
"sketch.hint.rectangle.center": "Center rectangle: click the center, then a corner",
"sketch.hint.rectangle.rounded": "Rounded rectangle: click two opposite corners (Tab to the radius box to type the corner radius)",
"sketch.hint.rectangle.three_point": "3-point rectangle: click two points of one edge, then the width",
"sketch.hint.rectangle.two_point": "Rectangle: click two opposite corners",
"sketch.hint.slot": "Slot: click both ends, then the width",
"sketch.hint.spline3d": "3D Spline: click fit points in 3D; right-click or Esc to finish",
"sketch.hint.trim": "Trim: click the piece of a curve to remove, or drag across the pieces to remove",
"sketch.make_selection": "将选择转换为 {linetype}",
"sketch.open_ends": "开放 {count}",
"sketch.status_conflict": "约束冲突",
@@ -4797,6 +4845,7 @@
"ui.default_modelling_orientation": "默认建模方向",
"ui.delete": "删除",
"ui.delete_select_first": "请先选择要删除的内容:特征、实体、组件或草图几何",
"ui.dependents_select_first": "请先选择要列出其依赖项的对象",
"ui.depth": "深度",
"ui.design": "设计",
"ui.design_properties.author": "作者",
@@ -5003,6 +5052,7 @@
"ui.heading_construct": "构造",
"ui.heading_create": "创建",
"ui.heading_create_sketch": "创建草图",
"ui.heading_custom_view_navigator": "自定义视图导航器",
"ui.heading_cylinder": "圆柱体",
"ui.heading_design": "设计",
"ui.heading_draft": "拔模",
@@ -5598,6 +5648,14 @@
"values must be numbers or expressions": "值必须是数字或表达式",
"view.auto_ortho_faces": "旋转时透视,正对表面时正交",
"view.render_inspector": "渲染检查器",
"view_gizmo.arrows": "旋转箭头",
"view_gizmo.home": "主页按钮",
"view_gizmo.no_such_body": "此设计中没有该名称的实体。",
"view_gizmo.note": "在视图中选择一个实体。它随首选项和设置配置文件保存,并在每个设计中显示。单击它的一个面即可正视该面。",
"view_gizmo.texture": "纹理",
"view_gizmo.themed": "主题",
"view_gizmo.too_detailed": "对视图导航器而言过于精细(超过 10,000 个三角形)",
"view_gizmo.too_thin": "对视图导航器而言过于细长:最薄的一边至少要有最长一边的五分之一",
"web.files.insert_drawings_hint": "将 CAD 文件、网格、DXF 或 SVG 插入当前设计",
"web.files.insert_stored_drawings_hint": "插入当前设计(CAD 文件、网格、DXF、SVG)",
"web.open_full": "在 SolidCraft 中打开",
+3 -1
View File
@@ -802,7 +802,9 @@ fn vs_line(@builtin(vertex_index) vi: u32, @location(0) a: vec3<f32>, @location(
let sb = cb.xy / max(cb.w, 1e-6) * half;
var dir = sb - sa;
let len = length(dir);
if (len < 1e-6) { dir = vec2<f32>(1.0, 0.0); } else { dir = dir / len; }
// Intel OpenGL can miscompile vector/scalar division here (#8053). Scalar
// quotients keep the same direction and the fallback for a point.
if (len < 1e-6) { dir = vec2<f32>(1.0, 0.0); } else { dir = vec2<f32>(dir.x / len, dir.y / len); }
let nrm = vec2<f32>(-dir.y, dir.x);
// Two triangles: corners (t, side).
var ts = array<f32, 6>(0.0, 1.0, 1.0, 0.0, 1.0, 0.0);
+667
View File
@@ -0,0 +1,667 @@
{
"order": 260,
"provenance": "Original SolidCraft stone-grey palette and semantic icon-role mapping",
"format": "solidcraft-theme/1",
"name": "Onyx",
"base": "dark",
"colors": {
"accent": "#9eafbd",
"accent_soft": "#3b4852",
"agent_busy": "#9eafbd",
"agent_ok": "#a5b9a5",
"app_bar": "#1c1e20",
"app_bar_hover": "#dededc16",
"app_bar_hover_button": "#dededc1c",
"app_bar_hover_strong": "#dededc28",
"app_bar_hover_subtle": "#dededc0c",
"app_bar_separator": "#383c3f",
"app_bar_tab_active": "#303235",
"app_bar_text": "#dededc",
"axis_x": "#d7938f",
"axis_y": "#a5b9a5",
"axis_z": "#98b2c8",
"bend_down": "#b8a7c3",
"bend_up": "#a5b9a5",
"body": "#93989c",
"body_edge": "#60666b",
"body_selected": "#3b4852",
"border": "#3d4145",
"box_window": "#9eafbd",
"chip": "#758b9b",
"construction_geom": "#b9a78e",
"construction_plane": "#b9a78e24",
"continuity": [
"#a5b9a5",
"#98b2c8",
"#c7b28b",
"#b8a7c3"
],
"control_border": "#4a4f54",
"control_fill": "#303235",
"cube_border": "#50565b",
"cube_face": "#34373a",
"cube_hover": "#53616c",
"cube_text": "#dededc",
"dialog_bg": "#2b2d2f",
"dialog_body": "#2b2d2f",
"dialog_border": "#3d4145",
"dialog_footer": "#27292b",
"dialog_label": "#dededc",
"dialog_rule": "#383c3f",
"dimension": "#c7b28b",
"dimension_driven": "#a59474",
"error": "#d7938f",
"field": "#1c1e20",
"form_accent": "#9d8faa",
"form_dim": "#c6c8c9",
"form_error": "#d7938f",
"form_error_fill": "#493334",
"form_fill": "#b9abc5",
"form_ink": "#dededc",
"form_primary": "#9eafbd",
"form_primary_fill": "#9eafbd",
"form_soft": "#343039",
"form_success": "#a5b9a5",
"form_success_fill": "#344139",
"form_tab_ink": "#b9abc5",
"glyph_bg": "#34373a",
"glyph_edge": "#d7938f",
"glyph_text": "#d7938f",
"grid": "#252729",
"grid_major": "#2e3235",
"hover": "#3b4852",
"hover_edge": "#b1c1ce",
"hover_edge_halo": "#181a1c",
"hover_profile": "#9eafbd30",
"hover_profile_edge": "#b1c1ce",
"icon": "#dededc",
"icons.agent": "#b8a7c3",
"icons.highlight": "#dededc",
"icons.marker_halo": "#1c1e20cc",
"interference": "#d7938f",
"joint_axis": "#98b2c8",
"joint_manipulator": "#9eafbd",
"logo": [
"#c9d4dc",
"#9eafbd",
"#647986"
],
"manipulator": "#9eafbd",
"mesh_accent": "#a29772",
"mesh_fill": "#beb48d",
"mesh_ink": "#beb48d",
"mesh_soft": "#34332b",
"nav_dim": "#b5b7b8",
"nav_field": "#1c1e20",
"nav_hover": "#43494f",
"nav_press": "#59636c",
"nav_tip": "#2b2d2f",
"nav_tip_ink": "#dededc",
"nav_tip_key_border": "#3b3e41",
"nav_viewport": "#27292b",
"on_accent": "#17191b",
"origin_plane": "#b9a78e2c",
"origin_plane_edge": "#b9a78e94",
"origin_plane_hover": "#9eafbd60",
"origin_point": "#b5b7b8",
"overlay": "#2b2d2f",
"panel": "#2b2d2f",
"panel_header": "#303235",
"preview_add": "#9eafbd",
"preview_cut": "#d7938f68",
"preview_new": "#c7b28b",
"preview_sketch": "#a5b9a5",
"profile_fill": "#9eafbd28",
"render_accent": "#a88e88",
"render_fill": "#c1a49e",
"render_ink": "#c1a49e",
"render_soft": "#38302f",
"rubber_band": "#9eafbd",
"section_cap": "#c7b28b",
"sel_edge": "#b1c1ce",
"sel_edge_rim": "#d0d9df",
"sel_face": "#3b4852",
"sel_profile": "#3b4852",
"sel_profile_edge": "#b1c1ce",
"sel_vertex": "#9eafbd",
"selected_bg": "#3b4852",
"selected_ink": "#dededc",
"sheet_fill": "#9eb9bd",
"sheet_ink": "#9eb9bd",
"sheet_soft": "#29363a",
"sketch": "#9eafbd",
"sketch_accent": "#b2b995",
"sketch_centerline": "#b5b7b8",
"sketch_conflict": "#d7938f",
"sketch_construction": "#b5b7b8",
"sketch_fixed": "#dededc",
"sketch_halo": "#181a1c",
"sketch_ink": "#b2b995",
"sketch_locked": "#a5b9a5",
"sketch_lost": "#d7938f",
"sketch_point": "#dededc",
"sketch_point_free": "#9eafbd",
"sketch_projected": "#b8a7c3",
"sketch_soft": "#32352c",
"surface_accent": "#a6947d",
"surface_fill": "#c0ae96",
"surface_ink": "#c0ae96",
"surface_soft": "#35322e",
"tab_on_fill_dark": "#17191b",
"text": "#dededc",
"text_dim": "#c6c8c9",
"timeline": "#2b2d2f",
"timeline_item": "#303235",
"timeline_item_error": "#493334",
"timeline_marker": "#b5b7b8",
"toolbar": "#2b2d2f",
"viewport_bottom": "#1b1d1f",
"viewport_top": "#222426",
"warning": "#c7b28b"
},
"radii": {
"radius_sm": 3,
"radius_md": 6,
"radius_lg": 8,
"radius_xl": 10,
"control_radius": 4,
"sketch_mode_radius": 6
},
"icon_palette": {
"ink": "#1b1d1f",
"line": "#d7d9d8",
"passive-1": "#b9bdc0",
"passive-2": "#8d9398",
"passive-3": "#646c72",
"guide": "#a2a8ac",
"solid": [
"#c9d4dc",
"#b2c1cc",
"#9eafbd"
],
"surface": [
"#d6cab8",
"#c0ae96",
"#a6947d"
],
"mesh": [
"#d4ccad",
"#beb48d",
"#a29772"
],
"form": [
"#d0c5d9",
"#b9abc5",
"#9d8faa"
],
"sketch": [
"#c9cfb3",
"#b2b995",
"#979f78"
],
"constraint": [
"#e1b7b2",
"#d7938f",
"#b77875"
],
"construction": [
"#d2c6b4",
"#b9a78e",
"#9f8c73"
]
},
"options": [
{
"id": "opacity",
"type": "range",
"default": 80,
"min": 60,
"max": 100
},
{
"id": "blur",
"type": "range",
"default": 60,
"max": 60
},
{
"id": "tab_colours",
"type": "bool",
"default": false
},
{
"id": "tab_fade_ms",
"type": "range",
"default": 240
},
{
"id": "accent",
"type": "choice",
"default": "slate",
"label": {
"en": "Accent",
"de": "Akzent",
"ja": "アクセント",
"ko": "강조색",
"zh": "强调色"
},
"help": {
"en": "Selection, highlights and Model controls; workspace and status colours keep their meaning.",
"de": "Auswahl, Hervorhebungen und Modell-Steuerung; Arbeitsbereichs- und Statusfarben behalten ihre Bedeutung.",
"ja": "選択・強調・モデルの操作色。ワークスペースや状態の色の意味は変えません。",
"ko": "선택, 강조 및 모델 조작의 색상입니다. 작업 공간과 상태 색상의 의미는 유지됩니다.",
"zh": "更改选择、高亮与模型控件的色调;工作空间和状态色保持原有含义。"
},
"values": [
{
"id": "slate",
"label": {
"en": "Slate blue",
"de": "Schieferblau",
"ja": "石板の青",
"ko": "슬레이트 블루",
"zh": "岩蓝"
}
},
{
"id": "silver",
"label": {
"en": "Silver",
"de": "Silber",
"ja": "シルバー",
"ko": "은색",
"zh": "银灰"
}
},
{
"id": "sage",
"label": {
"en": "Sage",
"de": "Salbei",
"ja": "セージ",
"ko": "세이지",
"zh": "鼠尾草绿"
}
}
]
},
{
"id": "contrast",
"type": "choice",
"default": "soft",
"label": {
"en": "Contrast",
"de": "Kontrast",
"ja": "コントラスト",
"ko": "대비",
"zh": "对比度"
},
"help": {
"en": "Soft stone layers or stronger separation between panels and fields.",
"de": "Weiche Steinschichten oder stärkere Trennung von Flächen und Feldern.",
"ja": "柔らかな石の階調か、パネルと入力欄を明確に分ける階調を選びます。",
"ko": "부드러운 석재 톤 또는 패널과 입력란을 더 뚜렷하게 구분합니다.",
"zh": "选择柔和的石色层次,或增强面板与输入框的区分。"
},
"values": [
{
"id": "soft",
"label": {
"en": "Soft",
"de": "Weich",
"ja": "ソフト",
"ko": "부드럽게",
"zh": "柔和"
}
},
{
"id": "defined",
"label": {
"en": "Defined",
"de": "Deutlich",
"ja": "くっきり",
"ko": "뚜렷하게",
"zh": "分明"
}
}
]
},
{
"id": "brightness",
"type": "range",
"effect": "surface_brightness",
"default": 100,
"min": 60,
"max": 120,
"step": 1,
"unit": "%",
"label": {
"en": "Brightness",
"de": "Helligkeit",
"ja": "明るさ",
"ko": "밝기",
"zh": "亮度"
},
"help": {
"en": "Adjust stone surfaces, viewport backgrounds and grid brightness. 100% keeps the authored tones; text and semantic colours stay unchanged.",
"de": "Helligkeit von Steinflächen, Ansichtsflächen und Raster. 100% erhält die ursprünglichen Töne; Text und Bedeutungsfarben bleiben unverändert.",
"ja": "石調の面・ビューポート背景・グリッドの明るさを調整します。100%は元の階調です。文字と意味のある色は変えません。",
"ko": "석재 표면·뷰포트 배경·격자의 밝기를 조절합니다. 100%는 원래 톤을 유지하며 글자와 의미 색상은 바꾸지 않습니다.",
"zh": "调整石色表面、视口背景和网格的亮度。100%保留原有色调;文字和语义颜色保持不变。"
}
},
{
"id": "foreground_colours",
"type": "choice",
"default": "vibrant",
"label": {
"en": "Foreground colours",
"de": "Vordergrundfarben",
"ja": "前景の色",
"ko": "전경 색상",
"zh": "前景颜色"
},
"help": {
"en": "Vibrant strengthens axes, icons and guides. Muted keeps the original quiet palette. Accent controls selection.",
"de": "Leuchtend verstärkt Achsen, Symbole und Hilfen. Gedämpft behält die ruhige ursprüngliche Palette. Akzent steuert die Auswahl.",
"ja": "鮮やかは軸・アイコン・作図ガイドを強調します。落ち着いた配色は元の控えめな色を保ちます。選択の色はアクセントで設定します。",
"ko": "선명함은 축·아이콘·가이드를 강조합니다. 차분함은 기존의 은은한 팔레트를 유지합니다. 선택 색상은 강조색 설정을 따릅니다.",
"zh": "鲜艳增强轴、图标和辅助线的色彩。柔和保留原有的沉静配色。选择颜色仍由强调色控制。"
},
"values": [
{
"id": "muted",
"label": {
"en": "Muted",
"de": "Gedämpft",
"ja": "落ち着いた",
"ko": "차분함",
"zh": "柔和"
}
},
{
"id": "vibrant",
"label": {
"en": "Vibrant",
"de": "Leuchtend",
"ja": "鮮やか",
"ko": "선명함",
"zh": "鲜艳"
}
}
]
}
],
"overlays": [
{
"when": {
"opt": "contrast",
"eq": "defined"
},
"colors": {
"app_bar": "#151719",
"panel": "#25282a",
"dialog_bg": "#25282a",
"dialog_body": "#25282a",
"dialog_footer": "#202325",
"panel_header": "#373b3e",
"field": "#171a1c",
"control_fill": "#383d41",
"border": "#4e555b",
"dialog_border": "#4e555b",
"dialog_rule": "#444b51",
"control_border": "#626c73",
"text": "#eeeeec",
"text_dim": "#ced1d2",
"form_ink": "#eeeeec",
"form_dim": "#ced1d2",
"dialog_label": "#eeeeec",
"toolbar": "#25282a",
"timeline": "#25282a"
}
},
{
"when": {
"opt": "accent",
"eq": "silver"
},
"colors": {
"accent": "#b7bdc2",
"manipulator": "#b7bdc2",
"joint_manipulator": "#b7bdc2",
"preview_add": "#b7bdc2",
"rubber_band": "#b7bdc2",
"box_window": "#b7bdc2",
"form_primary": "#b7bdc2",
"form_primary_fill": "#b7bdc2",
"sketch": "#b7bdc2",
"sketch_point_free": "#b7bdc2",
"sel_vertex": "#b7bdc2",
"accent_soft": "#454b50",
"hover": "#454b50",
"selected_bg": "#454b50",
"sel_face": "#454b50",
"sel_profile": "#454b50",
"body_selected": "#454b50",
"sel_edge": "#d5dadf",
"sel_profile_edge": "#d5dadf",
"hover_edge": "#d5dadf",
"hover_profile_edge": "#d5dadf",
"sel_edge_rim": "#dde0e3",
"hover_profile": "#b7bdc230",
"origin_plane_hover": "#b7bdc260",
"profile_fill": "#b7bdc228",
"cube_hover": "#454b50",
"chip": "#b7bdc2",
"logo": [
"#dde0e3",
"#c9cfd4",
"#b7bdc2"
]
},
"icon_palette": {
"solid": [
"#dde0e3",
"#c9cfd4",
"#b7bdc2"
]
}
},
{
"when": {
"opt": "accent",
"eq": "sage"
},
"colors": {
"accent": "#aabcae",
"manipulator": "#aabcae",
"joint_manipulator": "#aabcae",
"preview_add": "#aabcae",
"rubber_band": "#aabcae",
"box_window": "#aabcae",
"form_primary": "#aabcae",
"form_primary_fill": "#aabcae",
"sketch": "#aabcae",
"sketch_point_free": "#aabcae",
"sel_vertex": "#aabcae",
"accent_soft": "#414d45",
"hover": "#414d45",
"selected_bg": "#414d45",
"sel_face": "#414d45",
"sel_profile": "#414d45",
"body_selected": "#414d45",
"sel_edge": "#c2d2c5",
"sel_profile_edge": "#c2d2c5",
"hover_edge": "#c2d2c5",
"hover_profile_edge": "#c2d2c5",
"sel_edge_rim": "#d1ddd4",
"hover_profile": "#aabcae30",
"origin_plane_hover": "#aabcae60",
"profile_fill": "#aabcae28",
"cube_hover": "#414d45",
"chip": "#aabcae",
"logo": [
"#d1ddd4",
"#becec2",
"#aabcae"
]
},
"icon_palette": {
"solid": [
"#d1ddd4",
"#becec2",
"#aabcae"
]
}
},
{
"when": {
"opt": "foreground_colours",
"eq": "vibrant"
},
"colors": {
"axis_x": "#ff6d79",
"axis_y": "#4fd681",
"axis_z": "#4da7ff",
"agent_busy": "#4da7ff",
"agent_ok": "#4fd681",
"warning": "#ffd166",
"error": "#ff6d79",
"form_error": "#ff6d79",
"form_success": "#4fd681",
"glyph_edge": "#ff6d79",
"glyph_text": "#ff6d79",
"interference": "#ff6d79",
"sketch_conflict": "#ff6d79",
"sketch_lost": "#ff6d79",
"sketch_locked": "#4fd681",
"sketch_projected": "#c78bff",
"dimension": "#ffd166",
"dimension_driven": "#ffb166",
"construction_geom": "#ffb166",
"sketch_centerline": "#b5b7b8",
"sketch_construction": "#b5b7b8",
"joint_axis": "#42d9dd",
"bend_down": "#c78bff",
"bend_up": "#4fd681",
"preview_cut": "#ff6d7968",
"preview_new": "#ffd166",
"preview_sketch": "#4fd681",
"section_cap": "#ffd166",
"sketch_accent": "#4fd681",
"sketch_ink": "#4fd681",
"surface_accent": "#ffb166",
"surface_fill": "#ffb166",
"surface_ink": "#ffb166",
"mesh_accent": "#ffd166",
"mesh_fill": "#ffd166",
"mesh_ink": "#ffd166",
"form_accent": "#c78bff",
"form_fill": "#c78bff",
"form_tab_ink": "#c78bff",
"sheet_fill": "#63cbd5",
"sheet_ink": "#63cbd5",
"render_accent": "#ff6d79",
"render_fill": "#ff6d79",
"render_ink": "#ff6d79",
"icons.agent": "#c78bff",
"continuity": [
"#4fd681",
"#4da7ff",
"#ffd166",
"#c78bff"
],
"origin_plane_edge": "#ffb16694",
"sheet_soft": "#283a3e"
},
"icon_palette": {
"ink": "#1b1d1f",
"line": "#d7d9d8",
"passive-1": "#d3d8dc",
"passive-2": "#b2bbc2",
"passive-3": "#929fa9",
"guide": "#b4c8d6",
"solid": [
"#82c1ff",
"#62b2ff",
"#4da7ff"
],
"surface": [
"#ffc894",
"#ffba78",
"#ffb166"
],
"mesh": [
"#ffdf94",
"#ffd778",
"#ffd166"
],
"form": [
"#d8aeff",
"#ce99ff",
"#c78bff"
],
"sketch": [
"#84e2a7",
"#64db90",
"#4fd681"
],
"constraint": [
"#ff99a1",
"#ff7f89",
"#ff6d79"
],
"construction": [
"#ffc894",
"#ffba78",
"#ffb166"
]
}
}
],
"tabs": {
"MODEL": {
"viewport_top": "#24292d",
"viewport_bottom": "#1b2023",
"panel": "#303438"
},
"SURFACE": {
"viewport_top": "#292622",
"viewport_bottom": "#211e1b",
"panel": "#36332f"
},
"MESH": {
"viewport_top": "#282820",
"viewport_bottom": "#202019",
"panel": "#35352e"
},
"FORM": {
"viewport_top": "#26232b",
"viewport_bottom": "#1e1b22",
"panel": "#343137"
},
"SHEET METAL": {
"viewport_top": "#22282a",
"viewport_bottom": "#1b2022",
"panel": "#303638"
},
"RENDER": {
"viewport_top": "#2b2423",
"viewport_bottom": "#221c1b",
"panel": "#373130"
},
"SKETCH": {
"viewport_top": "#252921",
"viewport_bottom": "#1d211a",
"panel": "#33362f"
}
},
"borders": {
"primary_inset": {
"width": 0.5,
"gap": 1,
"color": "#dce2e70e"
}
},
"requires": 2
}
+1 -1
View File
@@ -185,7 +185,7 @@ fn shell_planar_format13_keeps_v12_documents_and_refuses_future() {
}
assert_eq!(legacy, current, "the migration preserves every prior field");
legacy["format"] = json!(crate::format::format_string(crate::format::FORMAT + 1));
assert!(crate::format::read(&legacy.to_string()).is_err());
assert!(crate::format::read(&legacy.to_string()).unwrap().newer_file.is_some());
}
#[test]
+322 -9
View File
@@ -89,20 +89,45 @@ pub fn format_value(value: f64, kind: expr::Kind, unit: &str, decimals: u8, f: &
if unit_kind != kind {
return Err(DocError::Invalid("number display unit has a different kind".into()));
}
format_display(value / scale, scale, decimals, f)
format_display(value / scale, scale, decimals, f, None)
}
/// Format a unit-less number with the same validation and decimal rounding policy.
pub fn format_number(x: f64, decimals: u8, f: &NumberFormat) -> Result<Shown> {
format_display(x, 1.0, decimals, f)
format_display(x, 1.0, decimals, f, None)
}
fn format_display(x: f64, scale: f64, decimals: u8, f: &NumberFormat) -> Result<Shown> {
/// Format an internal value with a rounding step in the selected display unit.
/// The step is a shortest round-trip decimal, finite, positive and at most 1e6.
/// Input decimal preparation precedes step rounding; requested decimal precision follows it.
/// Both rounding operations use `f.ties`. The original value is never changed.
/// The exact snapped display magnitude must be at most 1e12. An out-of-range snap
/// returns [`DocError::Invalid`] before final decimal-place rounding, even if that
/// final rounding would bring the displayed value back into range.
pub fn format_value_with_step(value: f64, kind: expr::Kind, unit: &str, decimals: u8, step: f64, f: &NumberFormat) -> Result<Shown> {
let (unit_kind, scale) = expr::unit_info(unit).ok_or_else(|| DocError::Invalid("unknown number display unit".into()))?;
if unit_kind != kind {
return Err(DocError::Invalid("number display unit has a different kind".into()));
}
format_display(value / scale, scale, decimals, f, Some(step))
}
/// Format a unit-less number with the step policy of [`format_value_with_step`].
/// Decimal precision can round a step multiple again; `Shown.value` always matches the text.
/// Out-of-range snapped magnitudes are rejected before final decimal-place rounding.
pub fn format_number_with_step(x: f64, decimals: u8, step: f64, f: &NumberFormat) -> Result<Shown> {
format_display(x, 1.0, decimals, f, Some(step))
}
fn format_display(x: f64, scale: f64, decimals: u8, f: &NumberFormat, step: Option<f64>) -> Result<Shown> {
// The unit table supplies a positive finite scale. Its decimal step must be at most
// 1e-9 internal units; the precision floor can make the effective tie window narrower.
let unit_resolution = (scale.log10() + 9.0).ceil().max(0.0) as usize;
let resolution = unit_resolution.max(usize::from(decimals) + 3);
let (rounded, value) = round_decimal(x, decimals, resolution, f.ties)?;
let (rounded, value) = match step {
Some(step) => round_decimal_step(x, step, decimals, resolution, f.ties)?,
None => round_decimal(x, decimals, resolution, f.ties)?,
};
let (integer, fraction) = rounded.split_once('.').unwrap_or((&rounded, ""));
let fraction = if f.trailing_zeros { fraction } else { fraction.trim_end_matches('0') };
let integer = if !f.leading_zero && integer == "0" && !fraction.is_empty() { "" } else { integer };
@@ -121,16 +146,25 @@ fn format_display(x: f64, scale: f64, decimals: u8, f: &NumberFormat) -> Result<
Ok(Shown { text, value })
}
/// Prepare a bounded magnitude, then round decimal digits, never a binary tie comparison.
fn round_decimal(x: f64, decimals: u8, resolution: usize, ties: Ties) -> Result<(String, f64)> {
/// Validate and prepare the magnitude once, identically for both rounding paths.
fn prepare_decimal(x: f64, decimals: u8, resolution: usize) -> Result<String> {
if decimals > 8 {
return Err(DocError::Invalid("number precision must be at most 8 decimal places".into()));
}
if !x.is_finite() || x.abs() > 1e12 {
return Err(DocError::Invalid("display value must be finite with magnitude at most 1e12".into()));
}
let prepared = format!("{:.*}", resolution, x.abs());
let (integer, fraction) = prepared.split_once('.').unwrap_or((&prepared, ""));
Ok(format!("{:.*}", resolution, x.abs()))
}
/// Prepare a bounded magnitude, then round decimal digits, never a binary tie comparison.
fn round_decimal(x: f64, decimals: u8, resolution: usize, ties: Ties) -> Result<(String, f64)> {
let prepared = prepare_decimal(x, decimals, resolution)?;
round_prepared(&prepared, x.is_sign_negative(), decimals, ties)
}
fn round_prepared(prepared: &str, negative: bool, decimals: u8, ties: Ties) -> Result<(String, f64)> {
let (integer, fraction) = prepared.split_once('.').unwrap_or((prepared, ""));
let places = usize::from(decimals);
let mut digits: Vec<u8> = integer.bytes().chain(fraction.bytes().take(places)).collect();
let discarded = fraction.as_bytes().get(places..).unwrap_or_default();
@@ -166,10 +200,81 @@ fn round_decimal(x: f64, decimals: u8, resolution: usize, ties: Ties) -> Result<
}
let rounded = String::from_utf8(digits).map_err(|_| DocError::Invalid("invalid prepared digits".into()))?;
let magnitude = rounded.parse::<f64>().map_err(|_| DocError::Invalid("invalid rounded number".into()))?;
let negative = x.is_sign_negative() && magnitude != 0.0;
let negative = negative && magnitude != 0.0;
Ok((rounded, if negative { -magnitude } else { magnitude }))
}
/// Divide decimal digits by a small decimal coefficient, retaining the full quotient.
/// A shortest f64 coefficient has at most 17 significant digits. With the unit table's
/// resolution <= 15, a scaled divisor is <= 1e21, so remainder * 10 fits u128.
/// At most 324 appended zeros are needed, even for the smallest positive subnormal.
fn round_decimal_step(x: f64, step: f64, decimals: u8, resolution: usize, ties: Ties) -> Result<(String, f64)> {
if !step.is_finite() || step <= 0.0 || step > 1e6 {
return Err(DocError::Invalid("number rounding step must be finite, positive and at most 1e6".into()));
}
let prepared = prepare_decimal(x, decimals, resolution)?;
let scientific = format!("{step:e}");
let (mantissa, exponent) = scientific.split_once('e').ok_or_else(|| DocError::Invalid("invalid decimal step".into()))?;
let fraction = mantissa.split_once('.').map_or(0, |(_, f)| f.len());
let coefficient = mantissa.replace('.', "").parse::<u128>().map_err(|_| DocError::Invalid("invalid step coefficient".into()))?;
let exponent = exponent.parse::<i32>().map_err(|_| DocError::Invalid("invalid step exponent".into()))? - fraction as i32;
let shift = exponent + resolution as i32;
let divisor = if shift > 0 { 10_u128.checked_pow(shift as u32).and_then(|n| coefficient.checked_mul(n)) } else { Some(coefficient) }
.ok_or_else(|| DocError::Invalid("rounding step scale overflow".into()))?;
let mut remainder = 0_u128;
let mut quotient = Vec::new();
for digit in prepared.bytes().filter(|d| *d != b'.').chain(std::iter::repeat_n(b'0', (-shift).max(0) as usize)) {
remainder = remainder * 10 + u128::from(digit - b'0');
quotient.push((remainder / divisor) as u8);
remainder %= divisor;
}
let up = remainder * 2 > divisor
|| (remainder * 2 == divisor && (ties == Ties::HalfAwayFromZero || quotient.last().is_some_and(|d| !d.is_multiple_of(2))));
// Exact quotient * coefficient, with the rounding increment folded into the carry.
let mut carry = if up { coefficient } else { 0 };
let mut product = Vec::new();
for digit in quotient.iter().rev() {
let n = u128::from(*digit) * coefficient + carry;
product.push(b'0' + (n % 10) as u8);
carry = n / 10;
}
while carry > 0 {
product.push(b'0' + (carry % 10) as u8);
carry /= 10;
}
product.reverse();
let product = String::from_utf8(product).map_err(|_| DocError::Invalid("invalid step digits".into()))?;
let mut magnitude = product.trim_start_matches('0').to_string();
if magnitude.is_empty() {
magnitude.push('0');
}
if exponent >= 0 {
if magnitude != "0" {
magnitude.extend(std::iter::repeat_n('0', exponent as usize));
}
} else {
let places = (-exponent) as usize;
if magnitude.len() <= places {
magnitude = format!("{}{}", "0".repeat(places + 1 - magnitude.len()), magnitude);
}
magnitude.insert(magnitude.len() - places, '.');
}
let (integer, fraction) = magnitude.split_once('.').unwrap_or((&magnitude, ""));
let whole = integer.parse::<u64>().map_err(|_| DocError::Invalid("rounded display magnitude overflow".into()))?;
if whole > 1_000_000_000_000 || (whole == 1_000_000_000_000 && fraction.bytes().any(|d| d != b'0')) {
return Err(DocError::Invalid("rounded display magnitude must be at most 1e12".into()));
}
// round_prepared needs at least the requested fraction digits, including for integer steps.
let missing = usize::from(decimals).saturating_sub(fraction.len());
if missing > 0 {
if !magnitude.contains('.') {
magnitude.push('.');
}
magnitude.extend(std::iter::repeat_n('0', missing));
}
round_prepared(&magnitude, x.is_sign_negative(), decimals, ties)
}
fn grouped_digits(text: &mut String, digits: &str, integer: bool, groups: bool) {
for (i, digit) in digits.chars().enumerate() {
if groups && digits.len() >= 5 && i > 0 && if integer { (digits.len() - i).is_multiple_of(3) } else { i.is_multiple_of(3) } {
@@ -471,6 +576,214 @@ mod number_tests {
}
}
#[test]
fn step_ties_and_decimal_fractions() {
for (x, step, dp, even, away) in [
(1.25, 0.5, 1, "1.0", "1.5"),
(1.75, 0.5, 1, "2.0", "2.0"),
(12.5, 5.0, 0, "10", "15"),
(25.0, 10.0, 0, "20", "30"),
(0.125, 0.05, 2, "0.10", "0.15"),
(0.375, 0.25, 2, "0.50", "0.50"),
(0.15, 0.1, 1, "0.2", "0.2"),
(0.25, 0.1, 1, "0.2", "0.3"),
(1.25, 0.5, 0, "1", "2"),
] {
for (ties, expected) in [(Ties::HalfEven, even), (Ties::HalfAwayFromZero, away)] {
let f = NumberFormat { ties, ..NumberFormat::default() };
for sign in [1.0, -1.0] {
let shown = format_number_with_step(sign * x, dp, step, &f).unwrap();
assert_eq!(shown.text, if sign < 0.0 { format!("−{expected}") } else { expected.into() });
assert_eq!(shown.value, sign * expected.parse::<f64>().unwrap());
}
}
}
}
#[test]
fn step_prepares_display_before_division_and_keeps_boundary_neighbors() {
for ties in [Ties::HalfEven, Ties::HalfAwayFromZero] {
let f = NumberFormat { ties, ..NumberFormat::default() };
for x in [1.75_f64.next_down(), 1.75, 1.75_f64.next_up(), 1.7499999996] {
assert_eq!(format_number_with_step(x, 1, 0.5, &f).unwrap().text, "2.0");
}
for x in [1.25_f64.next_down(), 1.25, 1.25_f64.next_up()] {
let expected = if ties == Ties::HalfEven { "1.0" } else { "1.5" };
assert_eq!(format_number_with_step(x, 1, 0.5, &f).unwrap().text, expected);
assert_eq!(format_number_with_step(-x, 1, 0.5, &f).unwrap().text, format!("−{expected}"));
}
assert_eq!(format_number_with_step(1.7499999994, 1, 0.5, &f).unwrap().text, "1.5");
assert_eq!(format_number_with_step(1.7500000006, 1, 0.5, &f).unwrap().text, "2.0");
}
let f = NumberFormat::default();
// The precision floor narrows the preparation window at eight decimals.
assert_eq!(format_number_with_step(1.7499999996, 8, 0.5, &f).unwrap().text, "1.50000000");
}
#[test]
fn step_tiny_values_large_magnitudes_and_exact_final_digits() {
let f = NumberFormat::default();
for step in [f64::from_bits(1), f64::MIN_POSITIVE, 1e-200, 1e-20, 1e-8] {
for x in [0.0, -0.0, f64::from_bits(1), -1e11, 1e11, 34947628153.461784] {
let shown = format_number_with_step(x, 5, step, &f).unwrap();
assert!(shown.value.is_finite());
assert_eq!(shown.value, shown.text.replace('−', "-").parse::<f64>().unwrap());
}
}
assert_eq!(format_number_with_step(1e12, 8, f64::from_bits(1), &f).unwrap().text, "1000000000000.00000000");
assert_eq!(format_number_with_step(34947628153.461784, 5, 1e-8, &f).unwrap().text, "34947628153.46178");
// A tiny step can move an exact decimal tie by less than any f64 ULP.
// Keep those digits through the second rounding rather than parsing the snap to f64.
assert_eq!(format_number_with_step(1.25, 1, 3e-323, &f).unwrap().text, "1.3");
assert_eq!(format_number_with_step(-1.25, 1, 3e-323, &f).unwrap().text, "−1.3");
for step in [0.5, 10.0, 1e6] {
for x in [-0.0, -0.1] {
let shown = format_number_with_step(x, 2, step, &f).unwrap();
assert_eq!(shown.text, "0.00");
assert_eq!(shown.value.to_bits(), 0.0_f64.to_bits());
}
}
}
#[test]
fn step_extreme_coefficients_have_independent_expected_digits() {
// Shortest decimals: largest subnormal = 2225073858507201 * 10^-323,
// smallest normal = 22250738585072014 * 10^-324. For x=1.25, integer
// division leaves remainders 2221948386734081 and 354296156594724.
// Twice the first is above its divisor, twice the second below: the
// snap is just above/below 1.25, so final rounding gives 1.3/1.2 in BOTH modes.
// Other expected digits were calculated with independent rational arithmetic.
for (step, quarter) in [(f64::MIN_POSITIVE.next_down(), "1.3"), (f64::MIN_POSITIVE, "1.2")] {
for ties in [Ties::HalfEven, Ties::HalfAwayFromZero] {
let f = NumberFormat { ties, ..NumberFormat::default() };
for (x, dp, expected) in [
(1.25, 1, quarter),
(99999999999.75, 0, "100000000000"),
(99999999999.75, 1, "99999999999.7"),
(99999999999.75, 2, "99999999999.75"),
(34947628153.461784, 2, "34947628153.46"),
(34947628153.461784, 5, "34947628153.46178"),
] {
for sign in [1.0, -1.0] {
let shown = format_number_with_step(sign * x, dp, step, &f).unwrap();
let text = if sign < 0.0 { format!("−{expected}") } else { expected.into() };
assert_eq!(shown.text, text, "x={x:?}, step={step:e}, dp={dp}, ties={ties:?}");
assert_eq!(shown.value, sign * expected.parse::<f64>().unwrap());
}
}
}
}
}
#[test]
fn step_and_final_decimal_rounding_carry_independently() {
// 9.975 / .05 = 199.5: both modes increment the step index to 200.
// 9.96 / .03 = 332 exactly: only the final rounding carries to 10.0.
// 1.26 / .1 = 12.6: the snap is 1.3, then zero decimals give 1 (not 1.26).
// 1.49 / .5 = 2.98: the snap is 1.5, then zero decimals give 2 (not 1).
for (x, step, dp, even, away) in [
(9.975, 0.05, 2, "10.00", "10.00"),
(9.96, 0.03, 1, "10.0", "10.0"),
(1.26, 0.1, 0, "1", "1"),
(1.49, 0.5, 0, "2", "2"),
(100000000000.25, 0.1, 0, "100000000000", "100000000000"),
(100000000000.25, 0.1, 1, "100000000000.2", "100000000000.3"),
(100000000000.25, 0.1, 2, "100000000000.20", "100000000000.30"),
(999999999999.75, 0.25, 0, "1000000000000", "1000000000000"),
] {
for (ties, expected) in [(Ties::HalfEven, even), (Ties::HalfAwayFromZero, away)] {
let f = NumberFormat { ties, ..NumberFormat::default() };
for sign in [1.0, -1.0] {
let shown = format_number_with_step(sign * x, dp, step, &f).unwrap();
assert_eq!(shown.text, if sign < 0.0 { format!("−{expected}") } else { expected.into() });
assert_eq!(shown.value, sign * expected.parse::<f64>().unwrap());
}
}
}
}
#[test]
fn step_rejects_invalid_inputs_and_out_of_range_snap() {
let f = NumberFormat::default();
for step in [0.0, -0.0, -0.5, f64::NAN, f64::INFINITY, f64::NEG_INFINITY, 1e6_f64.next_up()] {
assert!(matches!(format_number_with_step(1.0, 2, step, &f), Err(DocError::Invalid(_))));
assert!(matches!(format_value_with_step(1.0, Length, "mm", 2, step, &f), Err(DocError::Invalid(_))));
}
for x in [f64::NAN, f64::INFINITY, f64::NEG_INFINITY, 1e12_f64.next_up(), -1e12_f64.next_up()] {
assert!(matches!(format_number_with_step(x, 2, 0.5, &f), Err(DocError::Invalid(_))));
}
for dp in [9, 255] {
assert!(matches!(format_number_with_step(1.0, dp, 0.5, &f), Err(DocError::Invalid(_))));
}
for x in [1e12, -1e12] {
for ties in [Ties::HalfEven, Ties::HalfAwayFromZero] {
let f = NumberFormat { ties, ..f };
for step in [600_000.0, 0.6] {
// The .6 snap has magnitude 1e12 + .2: reject it even though
// zero decimal places would otherwise bring it back to 1e12.
assert!(matches!(format_number_with_step(x, 0, step, &f), Err(DocError::Invalid(_))));
}
}
assert_eq!(format_number_with_step(x, 0, 1e6, &f).unwrap().value, x);
}
for (kind, unit) in [(Length, "deg"), (Angle, "mm"), (Length, "unknown")] {
assert!(matches!(format_value_with_step(1.0, kind, unit, 2, 0.5, &f), Err(DocError::Invalid(_))));
}
}
#[test]
fn step_units_options_and_input_preservation() {
let f = NumberFormat::default();
let input: f64 = 25.4 * 1.25;
let bits = input.to_bits();
assert_eq!(format_value_with_step(input, Length, "in", 1, 0.5, &f).unwrap().text, "1.0");
assert_eq!(input.to_bits(), bits);
assert_eq!(format_value_with_step(std::f64::consts::PI / 6.0, Angle, "deg", 1, 5.0, &f).unwrap().text, "30.0");
assert_eq!(format_value_with_step(1e15, Length, "m", 1, 10.0, &f).unwrap().value, 1e12);
let styled = NumberFormat { marker: DecimalMarker::Comma, groups: true, ..f };
assert_eq!(format_number_with_step(-12345.25, 2, 0.5, &styled).unwrap().text, "−12\u{202f}345,00");
let trim = NumberFormat { leading_zero: false, trailing_zeros: false, ..styled };
assert_eq!(format_number_with_step(-0.6, 3, 0.5, &trim).unwrap().text, "−,5");
assert_eq!(format_number_with_step(1.23456789, 8, 1e-8, &styled).unwrap().text, "1,234\u{202f}567\u{202f}89");
for (distance, expected) in [(0.4, "1.0"), (0.6, "0.5")] {
assert_eq!(format_value_with_step((0.75 - distance * 1e-4) * 1e-6, Length, "nm", 1, 0.5, &f).unwrap().text, expected);
}
for step in [1e6_f64.next_down(), 0.12345678901234567, 2.2250738585072014e-308] {
let shown = format_number_with_step(12345.6789, 8, step, &f).unwrap();
assert_eq!(shown.value, shown.text.parse::<f64>().unwrap());
}
// Explicitly keep both historical policies, including their different decimal ties.
assert_eq!(format_number(2.665, 2, &f).unwrap().text, "2.66");
assert_eq!(length_number(2.665, "mm", 2), "2.67");
}
#[test]
fn step_seeded_integer_reference_and_hostile_domain() {
let mut seed = 0x4896_1138_0abc_def1;
for _ in 0..20_000 {
// Independent bounded integer oracle: x and step are thousandths; dp=3.
let n = random(&mut seed) % 1_000_000;
let s = random(&mut seed) % 100_000 + 1;
for ties in [Ties::HalfEven, Ties::HalfAwayFromZero] {
let f = NumberFormat { ties, ..NumberFormat::default() };
let q = n / s;
let r = n % s;
let up = 2 * r > s || (2 * r == s && (ties == Ties::HalfAwayFromZero || q % 2 == 1));
let expected = (q + u64::from(up)) * s;
let text = format!("{}.{:03}", expected / 1000, expected % 1000);
let shown = format_number_with_step(n as f64 / 1000.0, 3, s as f64 / 1000.0, &f).unwrap();
assert_eq!(shown.text, text);
// Exercise arbitrary positive subnormals and normal steps without quotient overflow.
let step = f64::from_bits(random(&mut seed));
if step.is_finite() && step > 0.0 && step <= 1e6 {
let shown = format_number_with_step(n as f64, 3, step, &f).unwrap();
assert!(shown.value.is_finite() && shown.value >= 0.0);
assert_eq!(shown.value, shown.text.parse::<f64>().unwrap());
}
}
}
}
fn random(state: &mut u64) -> u64 {
*state ^= *state << 13;
*state ^= *state >> 7;
+31 -1
View File
@@ -659,6 +659,12 @@ impl AlignFrame {
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, solidcraft_derive::Walk)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum FeatureKind {
/// A feature a newer SolidCraft saved that this build can't read ([`crate::newer_file`]): it
/// holds its place on the timeline, reports an error when evaluated, and goes back into the
/// file as it came.
NewerFileFeature {
raw: crate::newer_file::RawFeature,
},
/// A recorded timeline ownership boundary. Geometry is converted from its
/// current local frame into the destination component frame exactly once.
BodyTransfer {
@@ -2410,6 +2416,12 @@ pub enum HoleKind {
#[serde(default, skip_serializing_if = "Option::is_none")]
#[walk(angle = "Tip angle")]
tip_angle: Option<Expr>,
/// Printing aid: two bridge layers this thick below the counterbore's floor (a slot along
/// X, then a square), so a printer bridges the step instead of sagging into it. Absent:
/// a plain counterbore.
#[serde(default, skip_serializing_if = "Option::is_none")]
#[walk(length = "Bridge layer")]
bridge: Option<Expr>,
},
Countersink {
#[walk(length = "Countersink diameter")]
@@ -2594,6 +2606,7 @@ impl FeatureKind {
/// Short type name (timeline tooltip, `inspect`).
pub fn type_name(&self) -> &'static str {
match self {
FeatureKind::NewerFileFeature { .. } => "NewerFileFeature",
FeatureKind::BodyTransfer { .. } => "BodyTransferFeature",
FeatureKind::Sketch { .. } => "Sketch",
FeatureKind::Extrude { .. } => "ExtrudeFeature",
@@ -2679,6 +2692,7 @@ impl FeatureKind {
/// Design-file variant key (e.g. `"extrude"`, `"box"`, `"sheet_flange"`).
pub fn kind_key(&self) -> &'static str {
match self {
FeatureKind::NewerFileFeature { .. } => "newer_file_feature",
FeatureKind::BodyTransfer { .. } => "body_transfer",
FeatureKind::Sketch { .. } => "sketch",
FeatureKind::Extrude { .. } => "extrude",
@@ -2841,6 +2855,7 @@ impl FeatureKind {
/// Default name prefix (`Extrude` → `Extrude1`).
pub fn base_name(&self) -> &'static str {
match self {
FeatureKind::NewerFileFeature { .. } => "Unknown",
FeatureKind::BodyTransfer { .. } => "BodyTransfer",
FeatureKind::Sketch { .. } => "Sketch",
FeatureKind::Extrude { .. } => "Extrude",
@@ -3113,6 +3128,10 @@ pub fn is_counted_body_name(name: &str) -> bool {
/// The document.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Document {
/// Set when a newer SolidCraft saved the file this came from: what to tell the user, and what
/// this build couldn't read and keeps for the next save ([`crate::newer_file`]).
#[serde(skip)]
pub newer_file: Option<std::sync::Arc<crate::newer_file::NewerFile>>,
/// Named image intent and immutable embedded HDR sources. Active jobs and device state are not saved.
#[serde(default, skip_serializing_if = "crate::render_settings::RenderSettings::is_empty")]
pub render: std::sync::Arc<crate::render_settings::RenderSettings>,
@@ -3474,6 +3493,7 @@ impl Document {
pub fn new(name: &str) -> Self {
Document {
newer_file: None,
render: Default::default(),
format: default_format(),
format_pending: crate::format::pending_names(),
@@ -3895,7 +3915,12 @@ impl Document {
/// Read a design file's JSON (any format this build knows; older ones are upgraded).
pub fn from_json(s: &str) -> Result<Document> {
crate::render_resources::check_json_budget(s)?;
// A newer build's resources may not read here; the section stays out then (`newer_file`).
if let Err(why) = crate::render_resources::check_json_budget(s)
&& !crate::format::says_newer(s)
{
return Err(why);
}
let mut d = crate::format::read(s)?;
if d.features.len() > MAX_FEATURES || d.params.len() > MAX_PARAMS {
return Err(DocError::Invalid("document too large".into()));
@@ -3907,6 +3932,11 @@ impl Document {
Ok(d)
}
pub fn to_json(&self) -> String {
if self.newer_file.is_some() {
let mut value = serde_json::to_value(self).unwrap_or_default();
crate::newer_file::restore(self, &mut value);
return serde_json::to_string_pretty(&value).unwrap_or_default();
}
serde_json::to_string_pretty(self).unwrap_or_default()
}
+125 -3
View File
@@ -84,6 +84,65 @@ pub struct Drawing {
pub language: String,
/// In order, each behind its own `Arc`, so an undo step shares every sheet it didn't change.
pub sheets: Vec<Arc<Sheet>>,
/// Set when a newer SolidCraft saved the file this came from.
#[serde(skip)]
pub newer_file: Option<Arc<NewerDrawing>>,
}
/// The fields a drawing's record has: anything else in a file is a newer build's.
const RECORD_FIELDS: [&str; 7] = ["format", "name", "sources", "properties", "units", "language", "sheets"];
/// Move the elements of the list `key` that don't read as `T` out of a newer build's drawing.
fn take_unread<T: serde::de::DeserializeOwned>(top: &mut serde_json::Map<String, Value>, key: &str, one: &str, file: &mut NewerDrawing) {
let Some(Value::Array(list)) = top.get_mut(key) else { return };
let mut readable = Vec::with_capacity(list.len());
for element in std::mem::take(list) {
match DRAWING.check_numbers(&element, "properties").and_then(|()| serde_json::from_value::<T>(element.clone()).map_err(damaged)) {
Ok(_) => readable.push(element),
Err(why) => {
let name = element.get("name").or(element.get("path")).and_then(Value::as_str).unwrap_or("unnamed");
file.not_understood.push(format!("{one} `{name}` ({why})"));
file.elements.push((key.to_string(), element));
}
}
}
*list = readable;
}
/// What a drawing file says and holds that this build doesn't read ([`Drawing::from_newer`]).
#[derive(Clone, Debug, Default, PartialEq)]
pub struct NewerDrawing {
/// The number the file says.
pub format: u32,
/// The number this build reads up to.
pub reads_up_to: u32,
/// The changes the file names that this build doesn't have.
pub unknown_changes: Vec<String>,
/// What this build couldn't read, by name.
pub not_understood: Vec<String>,
fields: Vec<(String, Value)>,
elements: Vec<(String, Value)>,
}
impl NewerDrawing {
/// What to tell the user.
pub fn notice(&self) -> String {
format!(
"Saved by a newer SolidCraft (format {}, this version reads up to {}). If something's missing, update.",
self.format, self.reads_up_to
)
}
fn restore(&self, value: &mut Value) {
for (key, field) in &self.fields {
value[key] = field.clone();
}
for (key, element) in &self.elements {
if let Some(list) = value.get_mut(key).and_then(Value::as_array_mut) {
list.push(element.clone());
}
}
}
}
/// A design the drawing draws.
@@ -175,6 +234,7 @@ impl Drawing {
units: Units::default(),
language: language.into(),
sheets: vec![Arc::new(first)],
newer_file: None,
};
drawing.validate()?;
Ok(drawing)
@@ -188,11 +248,65 @@ impl Drawing {
}
let mut v: Value = serde_json::from_str(s).map_err(|e| DocError::Invalid(format!("not a SolidCraft drawing: {e}")))?;
let (version, applied) = DRAWING.take_version(&mut v)?;
if let Some(newer) = DRAWING.newer(version, applied.as_deref()) {
return Self::from_newer(v, version, applied, newer);
}
let d = Self::decode(v, version, applied.as_deref())?;
Ok(Drawing { format: DRAWING.format_string(DRAWING.current()), format_pending: DRAWING.pending_names(), ..d })
}
fn decode(mut v: Value, version: u32, applied: Option<&[String]>) -> Result<Drawing> {
DRAWING.check_numbers(&v, "properties")?;
DRAWING.upgrade(&mut v, version, applied.as_deref())?;
DRAWING.upgrade(&mut v, version, applied)?;
let d: Drawing = serde_json::from_value(v).map_err(damaged)?;
d.validate().map_err(damaged)?;
Ok(Drawing { format: DRAWING.format_string(DRAWING.current()), format_pending: DRAWING.pending_names(), ..d })
Ok(d)
}
/// A drawing a newer build saved: it opens with what this build can read of it. Everything in a
/// drawing refuses a field it doesn't know, so what it can't read shows as a top-level field,
/// a source or a sheet that doesn't read, which stays out and is named in
/// [`NewerDrawing::not_understood`]; [`Drawing::to_json`] writes it all back, with the file's
/// format. It takes at least one sheet this build can read to open.
fn from_newer(mut v: Value, version: u32, applied: Option<Vec<String>>, newer: crate::format::Newer) -> Result<Drawing> {
let list = applied.as_deref();
let can_read = |v: Value| Self::decode(v, version, list).map_err(|e| e.to_string());
let mut file = NewerDrawing {
format: newer.format,
reads_up_to: newer.reads_up_to,
unknown_changes: newer.unknown_changes.clone(),
..NewerDrawing::default()
};
let mut read = can_read(v.clone());
if read.is_err() {
let top = v.as_object_mut().ok_or_else(|| damaged("expected a JSON object"))?;
let keys: Vec<String> = top.keys().cloned().collect();
for key in keys {
if !RECORD_FIELDS.contains(&key.as_str())
&& let Some(value) = top.remove(&key)
{
file.not_understood.push(format!("field `{key}`"));
file.fields.push((key, value));
}
}
take_unread::<Sheet>(top, "sheets", "sheet", &mut file);
take_unread::<Source>(top, "sources", "source", &mut file);
read = can_read(v);
}
let d = read.map_err(|why| {
DocError::Invalid(format!(
"this drawing was saved by a newer SolidCraft (format {}, this version reads up to {}) and this version can't read it: {why}. Update SolidCraft to open it",
newer.format, newer.reads_up_to
))
})?;
let (format, format_pending) = if newer.format > newer.reads_up_to {
(DRAWING.format_string(newer.format), applied.unwrap_or_default())
} else {
let mut pending = DRAWING.pending_names();
pending.extend(newer.unknown_changes.iter().cloned());
(DRAWING.format_string(DRAWING.current()), pending)
};
Ok(Drawing { format, format_pending, newer_file: Some(Arc::new(file)), ..d })
}
/// The drawing's JSON: the same bytes for the same drawing. JSON longer than a read takes
@@ -200,7 +314,15 @@ impl Drawing {
/// properties are kept as they came, and indenting them can make a drawing that read in
/// under the limit save over it.
pub fn to_json(&self) -> Result<String> {
let text = serde_json::to_string_pretty(self).map_err(|e| DocError::Invalid(format!("drawing not saved: {e}")))?;
let unsaved = |e: serde_json::Error| DocError::Invalid(format!("drawing not saved: {e}"));
let text = match &self.newer_file {
None => serde_json::to_string_pretty(self).map_err(unsaved)?,
Some(file) => {
let mut value = serde_json::to_value(self).map_err(unsaved)?;
file.restore(&mut value);
serde_json::to_string_pretty(&value).map_err(unsaved)?
}
};
require(text.len() <= MAX_DRAWING_BYTES, || format!("drawing too large to save (at most {} MiB)", MAX_DRAWING_BYTES >> 20))?;
Ok(text)
}
@@ -8,7 +8,7 @@ whole format bump: never edit the `DRAWING` family in `format.rs`, another chang
- Name it after the change, lowercase with dashes: `sheet-views.rs`.
- Start it with a `//!` note: what is saved, what an older drawing gets without it, and what
the last release does with a drawing that has it (it refuses the newer format number).
the last release does with a drawing that has it (it warns about the newer format number, opens what it can read and keeps the rest).
- If older drawings must be rewritten as they open, add the step to the same file:
```rust
+42 -13
View File
@@ -325,28 +325,28 @@ fn damaged_files_are_refused_and_never_patched() {
let why = refused(&d, edit);
assert!(why.starts_with("damaged drawing: ") && why.contains("unknown field"), "{i}: {why}");
}
// A newer build's file is refused as one before anything in it is read: a field this build
// doesn't know, or a number out of its range.
// A newer build's file isn't held to this build's rules: a field it doesn't know, or a sheet with
// a number out of range, stays out. With no sheet left to show, it says why.
let (current, newer) = (DRAWING.current(), DRAWING.current() + 1);
let why = refused(&d, |v| {
v["format"] = json!(DRAWING.format_string(newer));
v["views"] = json!([]);
v["sheets"][0]["dpi"] = json!(1e10);
});
assert_eq!(
why,
format!(
"this drawing was saved by a newer SolidCraft (file format {newer}; this version reads formats up to {current}): update SolidCraft to open it"
)
assert_eq!(why, "read");
let why = refused(&d, |v| {
v["format"] = json!(DRAWING.format_string(newer));
v["sheets"] = json!([{"id": "future", "a_future_field": true}]);
});
assert!(
why.starts_with(&format!(
"this drawing was saved by a newer SolidCraft (format {newer}, this version reads up to {current}) and this version can't read it: "
)),
"{why}"
);
// A list of pending changes means nothing beside a format made of none; beside the pending
// number, a change this build doesn't know is a newer build's.
let why = refused(&d, |v| v["format_pending"] = json!(["a-later-change"]));
if DRAWING.pending_names().is_empty() {
assert_eq!(why, "read");
} else {
assert!(why.contains("newer SolidCraft"), "{why}");
}
assert_eq!(why, "read");
// A design is never read as a drawing, nor a drawing as a design.
let design = crate::Document::new("Plate").to_json();
let design_format = crate::format::format_string(crate::format::FORMAT);
@@ -551,3 +551,32 @@ fn mutate(v: &mut Value, pick: &mut usize, lie: &Value, how: u64) -> bool {
_ => false,
}
}
/// A drawing a newer build saved opens, with what it can read, and saving keeps the rest.
#[test]
fn a_newer_builds_drawing_opens_and_keeps_what_it_cant_read() {
let d = plate();
let mut file: Value = file(&d);
assert!(file.as_object().unwrap().keys().all(|key| RECORD_FIELDS.contains(&key.as_str())), "a new field goes in RECORD_FIELDS");
let newer = DRAWING.format_string(DRAWING.current() + 1);
file["format"] = json!(newer);
// With nothing it can't read: the same drawing.
let opened = Drawing::from_json(&file.to_string()).unwrap();
assert_eq!(opened.sheets, d.sheets);
assert!(opened.newer_file.as_ref().unwrap().notice().starts_with("Saved by a newer SolidCraft"));
assert_eq!(serde_json::from_str::<Value>(&opened.to_json().unwrap()).unwrap()["format"], json!(newer));
// A field and a second sheet it can't read stay out, named, and go back.
file["views"] = json!([{"id": "a"}]);
let mut future_sheet = file["sheets"][0].clone();
future_sheet["name"] = json!("Future");
future_sheet["future_layers"] = json!([1]);
file["sheets"].as_array_mut().unwrap().push(future_sheet);
let opened = Drawing::from_json(&file.to_string()).unwrap();
assert_eq!(opened.sheets, d.sheets);
let said = &opened.newer_file.as_ref().unwrap().not_understood;
assert!(said.iter().any(|what| what.contains("views")) && said.iter().any(|what| what.contains("Future")), "{said:?}");
let again: Value = serde_json::from_str(&opened.to_json().unwrap()).unwrap();
assert_eq!(again["views"], file["views"]);
assert_eq!(again["sheets"].as_array().unwrap().len(), d.sheets.len() + 1);
assert_eq!(again["format"], json!(newer));
}
+270 -17
View File
@@ -2930,13 +2930,67 @@ fn clear_tools_as_one(tools: Vec<Traced>) -> Result<Vec<Traced>> {
return Ok(tools);
}
let bodies: Vec<Body> = tools.iter().map(|t| t.body.clone()).collect();
Ok(match kernel::union_apart(&bodies)? {
let one = match kernel::union_apart(&bodies)? {
Some(one) => Some(one),
// The kernel only compares the tools' boxes, so copies of a through hole close together
// on a circle (their boxes overlap) seem to meet (#9007). Their exact shapes may still
// be apart.
None if tools_clearly_apart(&bodies) => kernel::join_apart(&bodies).ok().flatten(),
None => None,
};
#[cfg(test)]
cost_tests::count(|c| c.cut_tools += one.as_ref().map_or(tools.len(), |_| 1));
Ok(match one {
// Each piece's faces keep the names of the tool it is.
Some(one) => vec![Traced::step(one, &tools.iter().collect::<Vec<_>>())],
None => tools,
})
}
/// Most pairs of tools whose boxes meet that [`tools_clearly_apart`] tests.
const MAX_CLOSE_TOOL_PAIRS: usize = 4096;
/// Whether no two of `bodies` meet or touch, decided on their exact shapes. Only pairs whose
/// exact boxes, grown by twice the bodies' tolerances (as [`kernel::apart`] grows them), meet
/// are tested, by [`apart_by_union`]. `false` whenever that cannot be shown: a mesh body, a body
/// without an exact box, too many pairs to test, a union that fails.
fn tools_clearly_apart(bodies: &[Body]) -> bool {
if bodies.len() < 2 || bodies.len() > 10_000 || bodies.iter().any(Body::is_mesh) {
return false;
}
let Some(boxes) = bodies.iter().map(more::exact_box).collect::<Option<Vec<_>>>() else { return false };
let mut order: Vec<usize> = (0..boxes.len()).collect();
order.sort_by(|&i, &j| boxes.get(i).map_or(0.0, |b| b.min.x).total_cmp(&boxes.get(j).map_or(0.0, |b| b.min.x)));
let mut close = Vec::new();
for (k, &i) in order.iter().enumerate() {
let Some(a) = boxes.get(i) else { return false };
for &j in order.iter().skip(k + 1) {
let Some(b) = boxes.get(j) else { return false };
if b.min.x > a.max.x {
break;
}
if more::boxes_apart(&Some(*a), &Some(*b)) {
continue;
}
if close.len() == MAX_CLOSE_TOOL_PAIRS {
return false;
}
close.push((i, j));
}
}
close.into_iter().all(|(i, j)| matches!((bodies.get(i), bodies.get(j)), (Some(a), Some(b)) if apart_by_union(a, b)))
}
/// Whether the exact union of `a` and `b` comes out in two pieces that share no face, edge or
/// vertex. Crossing and nested bodies come out in one piece, touching ones in one or in two that
/// share an edge or a face.
fn apart_by_union(a: &Body, b: &Body) -> bool {
match kernel::boolean(a, b, BoolOp::Union) {
Ok(Some(u)) => u.record().material_regions().len() == 2 && u.region_contacts().is_ok_and(|c| c.is_empty()),
_ => false,
}
}
/// An intersect never deletes a body by accident (#5295): it is refused when nothing of a named
/// target would remain, when nothing of any target would remain, or when the tools meet a target
/// and the boolean still came out empty. Only an unnamed target the tools miss altogether is
@@ -4635,18 +4689,41 @@ fn hole_tools_and_prisms(
match hole {
HoleKind::Simple => tools.extend(bore(None)?),
HoleKind::Drilled { tip_angle } => tools.extend(bore(Some(tip_angle))?),
HoleKind::Counterbore { cb_diameter, cb_depth, tip_angle } => {
HoleKind::Counterbore { cb_diameter, cb_depth, tip_angle, bridge } => {
let (rc, dc) = (val(vals, cb_diameter, Kind::Length)? / 2.0, val(vals, cb_depth, Kind::Length)?);
if !(rc > r && dc > 0.0 && -dc > bottom) {
return Err(DocError::Invalid("the counterbore must be wider than the hole and shallower than it".into()));
}
// Wide and shallow first: the narrow hole then crosses the pocket floor.
tools.push(cyl(rc, -dc, top, "cbore")?);
if let Some(layer) = bridge {
let layer = val(vals, layer, Kind::Length)?;
tools.extend(bridge_tools(&plane, r, rc, dc, bottom, layer)?);
// Through all, `bottom` is the tool's reach, not the material's: the second layer
// must end inside a body (exact classification), short of the exit face.
if depth.is_none() {
let past = *position + dir * (dc + 2.0 * layer + size * 1e-6);
let classes = st.bodies.iter().map(|b| b.body.classify_point(past)).collect::<std::result::Result<Vec<_>, _>>()?;
if !classes.contains(&kernel::PointClass::Inside) {
return Err(bridge_too_deep(layer, "make the counterbore shallower or the bridge thinner"));
}
}
}
tools.extend(bore(tip_angle.as_ref())?);
}
HoleKind::Countersink { cs_diameter, cs_angle, tip_angle } => {
let (rc, half) = (val(vals, cs_diameter, Kind::Length)? / 2.0, val(vals, cs_angle, Kind::Angle)? / 2.0);
if !(rc > r && half > 1e-3 && half < std::f64::consts::FRAC_PI_2) {
// The angle and the width are told apart: an angle out of range is not a countersink
// too narrow (#9625). The cone's length grows as 1 / tan(half), so a near-flat angle
// is refused at a floor the message names, rather than built kilometres long.
const MIN_ANGLE_DEG: f64 = 0.115;
if !(2.0 * half > MIN_ANGLE_DEG.to_radians() && half < std::f64::consts::FRAC_PI_2) {
return Err(DocError::Invalid(format!(
"the countersink angle must be more than {MIN_ANGLE_DEG}° and less than 180°, not {}°",
((2.0 * half).to_degrees() * 1e6).round() / 1e6
)));
}
if !(rc > r) {
return Err(DocError::Invalid("the countersink must be wider than the hole".into()));
}
// One revolved tool: the cone from its rim on the face to just inside the hole
@@ -4670,6 +4747,59 @@ fn hole_tools_and_prisms(
Ok(tools)
}
/// How much wider than the hole a bridged counterbore's slot and square are, in mm.
const BRIDGE_CLEARANCE: f64 = 0.02;
/// Why a bridged counterbore's two layers of `layer` were refused: they reach past the hole, and
/// `fix` says what to change.
fn bridge_too_deep(layer: f64, fix: &str) -> DocError {
DocError::Invalid(format!("the two bridge layers ({:.3} mm) must fit in the hole below the counterbore: {fix}", 2.0 * layer))
}
/// The bridge layers of a counterbore printed opening down: below its floor, a slot across the
/// whole counterbore, along X (one `layer` thick), then a square (one more), both
/// [`BRIDGE_CLEARANCE`] wider than the hole, so each layer spans between supported edges.
/// `plane` is the hole's, its normal out of the material; the bore crosses both layers, clear of
/// their sides.
fn bridge_tools(plane: &Plane, r: f64, rc: f64, dc: f64, bottom: f64, layer: f64) -> Result<Vec<(Traced, Option<more::PrimitivePrism>)>> {
if !(layer > 0.0 && layer.is_finite()) {
return Err(DocError::Invalid("the bridge layer must be a positive length, such as 0.2 mm".into()));
}
let (t1, t2) = (-dc - layer, -dc - 2.0 * layer);
if t2 <= bottom {
return Err(bridge_too_deep(layer, "make the hole deeper or the bridge thinner"));
}
// Both a hair wider than the hole, so the bore's rim doesn't touch their sides.
let q = r + BRIDGE_CLEARANCE / 2.0;
// The slot's ends need room on the counterbore's wall past that.
if !(rc >= q + BRIDGE_CLEARANCE / 2.0) {
return Err(DocError::Invalid(format!("a bridged counterbore must be at least {} mm wider than the hole", 2.0 * BRIDGE_CLEARANCE)));
}
// The slot along world X where the axis allows it, else along the hole plane's own x.
let n = plane.normal();
let x = (Vec3::X - n * Vec3::X.dot(n)).normalized().filter(|_| Vec3::X.dot(n).abs() < 0.99).unwrap_or(plane.x);
let bp = Plane::new(plane.origin, x, n.cross(x)).ok_or_else(|| DocError::Invalid("hole axis".into()))?;
// The slot ends on the counterbore's wall: two lines and two arcs of its circle.
let a = (rc * rc - q * q).sqrt();
let phi = q.atan2(a);
let slot = solidcore_record::Loop2 {
segs: vec![
solidcore_record::Seg2::Line { a: Vec2::new(-a, -q), b: Vec2::new(a, -q) },
solidcore_record::Seg2::Arc { center: Vec2::ZERO, radius: rc, start: -phi, sweep: 2.0 * phi },
solidcore_record::Seg2::Line { a: Vec2::new(a, q), b: Vec2::new(-a, q) },
solidcore_record::Seg2::Arc { center: Vec2::ZERO, radius: rc, start: std::f64::consts::PI - phi, sweep: 2.0 * phi },
],
};
let square = solidcore_record::Loop2::polygon(&[Vec2::new(-q, -q), Vec2::new(q, -q), Vec2::new(q, q), Vec2::new(-q, q)]);
let mut tools = Vec::new();
for (outline, lo, hi) in [(slot, t1, -dc), (square, t2, t1)] {
let region = Region2 { outer: outline, holes: vec![] };
let tool = kernel::extrude(&bp, &[region], lo, hi)?.pop().ok_or_else(|| DocError::Invalid("hole tool".into()))?;
tools.push((crate::lineage::part_tool(tool, "bridge"), None));
}
Ok(tools)
}
/// The angular interval used by both the solid and its interactive extent handles.
#[derive(Clone, Copy, Debug)]
pub struct RevolveExtent {
@@ -4798,6 +4928,22 @@ struct ExtrudeConstructor {
interval: (f64, f64),
}
/// How far from its sketch plane an extrude may reach, in mm. It mirrors the limit the kernel's
/// `finite` check in `crates/kernel/src/build.rs` puts on an extrusion's start and end (a literal
/// there, not exported), so a too-long extrusion is refused here, by name, before the kernel is
/// called: the kernel's own message, `end = 1000000000`, names no field (#9625).
const MAX_EXTRUDE_REACH: f64 = 1e7;
/// Refuse an extrusion whose ends lie past [`MAX_EXTRUDE_REACH`] from the sketch plane.
fn extrude_within_reach(ends: [f64; 2]) -> Result<()> {
match ends.into_iter().find(|x| x.abs() >= MAX_EXTRUDE_REACH) {
Some(x) => Err(DocError::Invalid(format!(
"the extrusion is too long: its end is {x} mm from the sketch plane, past the limit of {MAX_EXTRUDE_REACH} mm"
))),
None => Ok(()),
}
}
/// Construct planar caps locally before placing the completed tool.
fn centered_extrude(
plane: &Plane,
@@ -4981,6 +5127,7 @@ fn feature_tools_with_constructor(
Some(e) => val(vals, e, Kind::Length)?,
None => 0.0,
};
extrude_within_reach([base, base + sign * len])?;
let start_plane = ss.plane.offset(base);
let caps = [
Some(crate::lineage::extrude_cap_role(base)),
@@ -5050,6 +5197,7 @@ fn feature_tools_with_constructor(
lo = hs.iter().cloned().fold(lo, f64::min) - margin;
}
}
extrude_within_reach([lo + off, hi + off])?;
let untrimmed = extent.to.is_none() && extent.from.is_none() && !extent.through_all;
let mut tools = Vec::new();
for r in &regions {
@@ -6075,7 +6223,6 @@ fn path_at(segs: &[kernel::PathSeg], d: f64) -> (Vec3, Vec3) {
(Vec3::ZERO, Vec3::X)
}
/// Whether a copy has no material to cut in any of its eligible targets.
/// The bodies a hole cuts: those its feature names, else its component's and its own (as
/// `apply_traced` picks a cut's targets).
fn hole_targets<'a>(st: &'a ModelState, f: &Feature) -> Vec<&'a ModelBody> {
@@ -6105,18 +6252,120 @@ fn hole_misses(st: &ModelState, f: &Feature, tool: &Body) -> bool {
targets.iter().all(|b| more::boxes_apart(&tool_box, &b.body.exact_bounds().ok()))
}
fn copy_misses(st: &ModelState, f: &Feature, targets: &[String], tools: &[Traced]) -> bool {
/// The bodies a pattern's cut copies are checked against for missing them ([`copy_misses`]).
fn miss_scope<'a>(st: &'a ModelState, f: &'a Feature, targets: &'a [String]) -> impl Iterator<Item = &'a ModelBody> + 'a {
let targets = if targets.is_empty() { &f.participants } else { targets };
let all = targets.len() == 1 && targets.first().is_some_and(|t| t == "*");
st.bodies
.iter()
.filter(|b| all || if targets.is_empty() { b.component == f.component || b.feature == f.id } else { targets.contains(&b.name) })
.all(|b| {
tools.iter().all(|t| {
// An inconclusive probe is not a miss: it must not reject an otherwise valid cut.
matches!(kernel::boolean(&b.body, &t.body, BoolOp::Intersect), Ok(None))
})
.filter(move |b| all || if targets.is_empty() { b.component == f.component || b.feature == f.id } else { targets.contains(&b.name) })
}
/// Whether a copy has no material to cut in any of its eligible targets.
fn copy_misses(st: &ModelState, f: &Feature, targets: &[String], tools: &[Traced]) -> bool {
miss_scope(st, f, targets).all(|b| {
tools.iter().all(|t| {
#[cfg(test)]
cost_tests::count(|c| c.miss_intersects += 1);
// An inconclusive probe is not a miss: it must not reject an otherwise valid cut.
matches!(kernel::boolean(&b.body, &t.body, BoolOp::Intersect), Ok(None))
})
})
}
/// How many of a pattern's cut copies (`instances`, ranges of `copies`) remove no material, and
/// how many copies there are. [`copy_misses`] intersects a copy with every target, which on a
/// body with many holes costs far more than cutting the copy (#9007). A copy that a point test
/// shows takes material from a target ([`shares_material`]) is not a miss, and skips it; only
/// copies the test cannot place (in an earlier hole, on the edge, thinner than its samples) are
/// intersected.
fn count_copy_misses(
st: &ModelState,
f: &Feature,
targets: &[String],
copies: &[Traced],
instances: &[std::ops::Range<usize>],
axes: &[Vec<(Vec3, Vec3)>],
) -> (usize, usize) {
let scope: Vec<&ModelBody> = miss_scope(st, f, targets).collect();
let (mut missed, mut total) = (0, 0);
for (k, tools) in instances.iter().enumerate().filter_map(|(k, i)| Some((k, copies.get(i.clone())?))) {
total += 1;
let lines = axes.get(k).map_or(&[][..], Vec::as_slice);
let takes = tools.iter().any(|t| scope.iter().any(|b| shares_material(&b.body, &t.body, lines)));
if !takes && copy_misses(st, f, targets, tools) {
missed += 1;
}
}
(missed, total)
}
/// Whether some point lies in the material of both B-rep bodies `target` and `tool`, by their
/// exact point classification (a point on either's boundary does not count). Tried along
/// `lines` (a hole's axis: through the wall it drills into, however thin and slanted), along the
/// axes of the tool's round faces (a cylinder's axis, the middle of a slot's ends) and along the
/// three lines parallel to the axes through the middle of the box both exact boxes hold (the
/// axis of a straight hole through a plate), within that box. `false` says nothing.
fn shares_material(target: &Body, tool: &Body, lines: &[(Vec3, Vec3)]) -> bool {
if target.is_mesh() || tool.is_mesh() {
return false;
}
let (Some(a), Some(b)) = (more::exact_box(target), more::exact_box(tool)) else { return false };
let both = a.intersection(&b);
if both.is_empty() {
return false;
}
let c = both.center();
let mut all = lines.to_vec();
all.extend(round_face_axes(tool, MAX_PROBED_FACES));
all.extend([(c, Vec3::X), (c, Vec3::Y), (c, Vec3::Z)]);
let inside = |b: &Body, p: Vec3| matches!(b.classify_point(p), Ok(kernel::PointClass::Inside));
all.iter().any(|&(o, d)| {
let Some((lo, hi)) = line_in_box(&both, o, d) else { return false };
(0..SAMPLES_PER_LINE).any(|k| {
let p = o + d * (lo + (hi - lo) * (k as f64 + 0.5) / SAMPLES_PER_LINE as f64);
inside(tool, p) && inside(target, p)
})
})
}
/// Points tried on each line by [`shares_material`].
const SAMPLES_PER_LINE: usize = 16;
/// Most faces of a tool whose surfaces [`shares_material`] looks along.
const MAX_PROBED_FACES: usize = 32;
/// The axes of the round faces among the first `max` faces of `body`, from their exact surfaces:
/// a cylinder's, a cone's and a torus's axis, and the lines along X, Y and Z through a sphere's
/// centre.
fn round_face_axes(body: &Body, max: usize) -> Vec<(Vec3, Vec3)> {
let mut lines = Vec::new();
for face in 0..body.face_count().min(max) {
match kernel::face_surface(body, face) {
Some(kernel::FaceSurface::Cylinder { origin, axis, .. }) => lines.push((origin, Vec3::from(axis))),
Some(kernel::FaceSurface::Cone { apex, axis, .. }) => lines.push((apex, Vec3::from(axis))),
Some(kernel::FaceSurface::Torus { center, axis, .. }) => lines.push((center, Vec3::from(axis))),
Some(kernel::FaceSurface::Sphere { center, .. }) => lines.extend([(center, Vec3::X), (center, Vec3::Y), (center, Vec3::Z)]),
Some(kernel::FaceSurface::Plane { .. }) | None => {}
}
}
lines
}
/// The stretch of the line `o + t d` inside `b`, as the range of `t`; `None` when it misses.
fn line_in_box(b: &solidcraft_geom::Aabb3, o: Vec3, d: Vec3) -> Option<(f64, f64)> {
let (mut lo, mut hi) = (f64::NEG_INFINITY, f64::INFINITY);
for (o, d, min, max) in [(o.x, d.x, b.min.x, b.max.x), (o.y, d.y, b.min.y, b.max.y), (o.z, d.z, b.min.z, b.max.z)] {
if d.abs() < 1e-12 {
if o < min || o > max {
return None;
}
} else {
let (a, c) = ((min - o) / d, (max - o) / d);
lo = lo.max(a.min(c));
hi = hi.min(a.max(c));
}
}
(lo.is_finite() && hi.is_finite() && lo <= hi).then_some((lo, hi))
}
/// The deepest a pattern or mirror reaches through patterns and mirrors of features (#395).
@@ -6358,6 +6607,9 @@ fn replay(
let targets = if present.is_empty() { targets } else { present };
let mut copies = Vec::new();
let mut instances = Vec::with_capacity(mats.len());
// Each hole copy's axes (spot and direction), where the check for copies that miss looks
// for material first.
let mut axes: Vec<Vec<(Vec3, Vec3)>> = Vec::new();
if let FeatureKind::Hole { diameter, depth, hole, to, .. } = &src.kind {
// A hole is drilled again at each copy of its spot (found on the surface there), so
// a blind hole's depth counts from the face at the copy, not from the bottom of the
@@ -6366,8 +6618,10 @@ fn replay(
for (k, m) in mats.iter().enumerate() {
let d = crate::apply_vector(m, dir).normalized().ok_or_else(|| DocError::Invalid("hole direction".into()))?;
let start = copies.len();
let mut on = Vec::with_capacity(spots.len());
for p in &spots {
let at = hole_on_surface(st, crate::apply_point(m, *p), d, hole_scope(src));
on.push((at, d));
let to = to.map(|t| crate::apply_point(m, t.0));
let depth = hole_depth_to(st, &at, d, &to, depth)?;
// Each copy's faces are named as the hole's, with the instance.
@@ -6378,6 +6632,7 @@ fn replay(
);
}
instances.push(start..copies.len());
axes.push(on);
}
} else if let FeatureKind::Rib { .. } = &src.kind {
// A rib is built again at each copy of its sketch, against the bodies there (#4593):
@@ -6404,12 +6659,9 @@ fn replay(
}
}
if op == Operation::Cut {
for instance in &instances {
if let Some(tools) = copies.get(instance.clone()) {
total += 1;
missed += usize::from(copy_misses(st, f, &targets, tools));
}
}
let (m, t) = count_copy_misses(st, f, &targets, &copies, &instances, &axes);
missed += m;
total += t;
}
// Copies of a cut through sheet metal are cut-outs of its flat pattern, as the cut is
// (#6841): each machined into the sheets in turn, then cut from the other targets.
@@ -6812,6 +7064,7 @@ fn eval_feature(
// Its tools meet bodies in other placements where those are shown (#3383).
let _frames = ToolFrames::install(doc, f, st);
match &f.kind {
FeatureKind::NewerFileFeature { raw } => Err(DocError::Invalid(raw.why())),
FeatureKind::BodyTransfer { bodies, from, to, transform } => {
crate::body_transfer::evaluate(doc, st, &crate::plain(bodies), *from, *to, *transform)
}
+155 -2
View File
@@ -18,8 +18,10 @@ use crate::*;
/// Work counted on this thread: bodies moved, STEP texts digested, joint faces and bodies
/// measured, bodies searched for by name, features searched for by id, bodies a cut (or
/// intersect) ran its booleans on, bodies searched for the cylinder a tap marking lies on, and
/// bodies whose faces a tapped hole read for its wall.
/// intersect) ran its booleans on, bodies searched for the cylinder a tap marking lies on,
/// bodies whose faces a tapped hole read for its wall, intersects run to find a pattern's copies
/// that cut nothing, and the tools a cut of many tools is made with (one when they are cut in one
/// go).
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub(super) struct Counts {
pub moved: usize,
@@ -31,6 +33,8 @@ pub(super) struct Counts {
pub cut: usize,
pub cylinder_search: usize,
pub tapped_wall: usize,
pub miss_intersects: usize,
pub cut_tools: usize,
}
thread_local! {
@@ -45,6 +49,8 @@ thread_local! {
cut: 0,
cylinder_search: 0,
tapped_wall: 0,
miss_intersects: 0,
cut_tools: 0,
})
};
}
@@ -1484,3 +1490,150 @@ fn a_hole_into_a_rim_still_bores_its_sheet_beside_far_ones() {
let bore = std::f64::consts::PI * (d / 2.0).powi(2) * 60.0;
assert!((removed - bore).abs() < 0.02 * bore, "removed {removed} of {bore}");
}
/// A 1.5 mm disc of 50 mm radius with a 3.5 mm through hole at `radius` on X, patterned `count`
/// times around Z (#9007). The pattern's id.
fn disc_with_hole_pattern(doc: &mut Document, radius: f64, count: usize) -> u64 {
let disc = FeatureKind::Cylinder {
base: point_expr(Vec3::ZERO),
axis: Dir(Vec3::Z),
radius: "50".into(),
height: "1.5".into(),
operation: Operation::NewBody,
references: Vec::new(),
};
doc.add_feature(disc, Some("Disc")).unwrap();
let hole: FeatureKind = serde_json::from_value(serde_json::json!({
"type": "hole", "position": [radius, 0, 1.5], "direction": [0, 0, -1], "diameter": "3.5",
}))
.unwrap();
let hole = doc.add_feature(hole, Some("Hole")).unwrap();
hole_pattern(doc, hole, count)
}
fn hole_pattern(doc: &mut Document, hole: u64, count: usize) -> u64 {
let pattern: FeatureKind = serde_json::from_value(serde_json::json!({
"type": "pattern", "features": [hole],
"pattern": {"type": "circular", "origin": [0, 0, 0], "axis": [0, 0, 1], "count": count.to_string(), "angle": "360 deg"},
}))
.unwrap();
doc.add_feature(pattern, None).unwrap()
}
fn disc_volume(model: &Model) -> f64 {
let st = model.state();
assert_eq!(st.bodies.len(), 1);
kernel::measure(&st.bodies[0].body).unwrap().volume
}
#[test]
fn a_circular_pattern_of_a_through_hole_cuts_its_copies_at_once() {
// The copies' tools run twice the disc's size along Z, so the kernel's box test, which
// grows each box by a share of the tool's size, finds them meeting (#9007); they are still
// 4.3 mm apart, centre to centre, and are cut in one go. No copy is intersected with the
// disc to see whether it takes material: each passes through the disc's material.
let mut doc = Document::new("sieve");
let pattern = disc_with_hole_pattern(&mut doc, 20.0, 29);
let mut model = Model::new();
let work = counted(|| model.evaluate(&doc));
assert!(model.results.iter().all(|r| r.error.is_none() && r.warning.is_none()), "{:?}", model.results);
assert_eq!((work.cut_tools, work.miss_intersects), (1, 0), "{work:?}");
let hole = std::f64::consts::PI * 1.75 * 1.75 * 1.5;
let disc = std::f64::consts::PI * 2500.0 * 1.5;
let v = disc_volume(&model);
assert!((v - (disc - 29.0 * hole)).abs() < 1e-3 * hole, "{v}");
// The same copies again, landing in the holes cut already: each is intersected, and each
// still counts as a copy that removes no material.
let hole_id = doc.features.iter().find(|f| f.name == "Hole").unwrap().id;
hole_pattern(&mut doc, hole_id, 29);
let work = counted(|| model.evaluate(&doc));
let again = model.results.last().unwrap();
assert!(again.error.is_none(), "{again:?}");
// (The kernel may add a note on a retry of a boolean on faces that lie on each other.)
assert!(again.warning.as_deref().is_some_and(|w| w.starts_with("28 of 28 cut copies remove no material")), "{again:?}");
assert_eq!(work.miss_intersects, 28, "{work:?}");
assert!((disc_volume(&model) - v).abs() < 1e-3 * hole);
assert!(model.results.iter().any(|r| r.id == pattern && r.warning.is_none()));
}
#[test]
fn copies_of_a_hole_that_come_close_are_cut_one_by_one() {
// At 8.5 mm radius, 16 copies of a 3.5 mm hole overlap their neighbours: they are not apart,
// and each is cut on its own, as before.
let mut doc = Document::new("crowded");
disc_with_hole_pattern(&mut doc, 8.5, 16);
let mut model = Model::new();
let work = counted(|| model.evaluate(&doc));
assert!(model.results.iter().all(|r| r.error.is_none() && r.warning.is_none()), "{:?}", model.results);
assert_eq!((work.cut_tools, work.miss_intersects), (15, 0), "{work:?}");
// At 9 mm they come within 0.012 mm of each other without touching: their exact shapes are
// apart, so they are cut in one go, and all 16 holes are cut.
let mut doc = Document::new("close");
disc_with_hole_pattern(&mut doc, 9.0, 16);
let mut model = Model::new();
let work = counted(|| model.evaluate(&doc));
assert!(model.results.iter().all(|r| r.error.is_none() && r.warning.is_none()), "{:?}", model.results);
assert_eq!((work.cut_tools, work.miss_intersects), (1, 0), "{work:?}");
let hole = std::f64::consts::PI * 1.75 * 1.75 * 1.5;
let disc = std::f64::consts::PI * 2500.0 * 1.5;
let v = disc_volume(&model);
assert!((v - (disc - 16.0 * hole)).abs() < 1e-3 * hole, "{v}");
}
/// A ring (25 mm outside, 16 mm bore, 55 mm high) with a blind groove, 8 mm wide and 30 mm deep,
/// cut into its bore from below, in a circular pattern of ten about Z: their boxes, grown as the
/// kernel grows them, meet, their exact shapes are 1.9 mm apart. The ring's faces counted as its
/// surfaces are, and the work.
fn grooved_ring_faces() -> (usize, Counts) {
let mut doc = Document::new("grooves");
let cylinder = |base: Vec3, radius: &str, height: &str, operation: Operation| FeatureKind::Cylinder {
base: point_expr(base),
axis: Dir(Vec3::Z),
radius: radius.into(),
height: height.into(),
operation,
references: Vec::new(),
};
doc.add_feature(cylinder(Vec3::ZERO, "25", "55", Operation::NewBody), Some("Ring")).unwrap();
doc.add_feature(cylinder(Vec3::new(0.0, 0.0, -1.0), "16", "57", Operation::Cut), Some("Bore")).unwrap();
let groove = doc.add_feature(cylinder(Vec3::new(16.0, 0.0, -1.0), "4", "31", Operation::Cut), Some("Groove")).unwrap();
hole_pattern(&mut doc, groove, 10);
let mut model = Model::new();
let work = counted(|| model.evaluate(&doc));
assert!(model.results.iter().all(|r| r.error.is_none() && r.warning.is_none()), "{:?}", model.results);
let st = model.state();
assert_eq!(st.bodies.len(), 1);
(kernel::measure(&st.bodies[0].body).unwrap().merged.faces, work)
}
#[test]
fn copies_that_notch_the_same_round_face_cut_at_once_leave_the_faces_of_one_by_one() {
// The ten grooves notch the same round bore. Cut all in one go, they leave it in as many
// faces as cutting them one after another does (#9007).
let (patterned, work) = grooved_ring_faces();
let cut = |a: kernel::Body, b: &kernel::Body| kernel::boolean(&a, b, kernel::BoolOp::Cut).unwrap().unwrap();
let ring =
cut(kernel::cylinder(Vec3::ZERO, Vec3::Z, 25.0, 55.0).unwrap(), &kernel::cylinder(Vec3::new(0.0, 0.0, -1.0), Vec3::Z, 16.0, 57.0).unwrap());
let groove = kernel::cylinder(Vec3::new(16.0, 0.0, -1.0), Vec3::Z, 4.0, 31.0).unwrap();
let one_by_one = (0..10).fold(ring, |ring, k| {
let copy = kernel::transform(&groove, Vec3::ZERO, Vec3::ZERO, Vec3::Z, (36.0 * k as f64).to_radians()).unwrap();
cut(ring, &copy)
});
assert_eq!(patterned, kernel::measure(&one_by_one).unwrap().merged.faces);
assert_eq!(work.cut_tools, 1, "{work:?}");
}
#[test]
fn tools_are_apart_only_when_they_neither_meet_nor_nest() {
let rod = |x: f64, y: f64, r: f64| kernel::cylinder(Vec3::new(x, y, -100.0), Vec3::Z, r, 200.0).unwrap();
// Long rods whose boxes, grown as the kernel grows them, meet: 0.5 mm apart.
assert!(super::tools_clearly_apart(&[rod(0.0, 0.0, 1.0), rod(2.5, 0.0, 1.0)]));
// Touching, crossing and nested rods are not apart.
assert!(!super::tools_clearly_apart(&[rod(0.0, 0.0, 1.0), rod(2.0, 0.0, 1.0)]));
assert!(!super::tools_clearly_apart(&[rod(0.0, 0.0, 1.0), rod(1.5, 0.0, 1.0)]));
assert!(!super::tools_clearly_apart(&[rod(0.0, 0.0, 3.0), rod(0.5, 0.0, 1.0)]));
let tube = kernel::boolean(&rod(0.0, 0.0, 5.0), &rod(0.0, 0.0, 4.0), kernel::BoolOp::Cut).unwrap().unwrap();
assert!(!super::tools_clearly_apart(&[tube.clone(), rod(0.0, 0.0, 4.5)]));
// A rod in the tube's bore, clear of its wall, is apart from it.
assert!(super::tools_clearly_apart(&[tube, rod(0.0, 0.0, 3.0)]));
}
+8 -3
View File
@@ -2318,11 +2318,16 @@ pub(super) fn plastic_eval(doc: &Document, vals: &BTreeMap<String, Value>, f: &F
_ => false,
};
let (Some(_), Some(_), false) = (outer, openings.first(), alike) else {
// A solid box top has no opening: Shell that face first, then pick the rim
// around the cavity (#10437).
let what = match (loops.len(), openings.len()) {
(0 | 1, _) => "pick the rim face of a shelled body (a face with an inner and an outer edge)".to_string(),
(_, 0) => "pick the rim face of a shelled body: this face's inner edges are where other features stand on it, not an opening"
(0 | 1, _) => "Lip needs the rim of a shelled body: Shell a face open first, then pick the rim around that opening (a face with an outer edge and an inner hole)"
.to_string(),
(_, k) => format!("pick the rim face of a shelled body (round one opening): this face has {k} openings alike in size"),
(_, 0) => "Lip needs a rim around an opening: this face's inner edges are where other features stand on it, not a shell cavity. Shell a face open, then pick that rim"
.to_string(),
(_, k) => format!(
"Lip needs one clear opening as the rim: this face has {k} openings alike in size (for example a plate of holes). Shell one cavity, or pick a rim that rings a single opening"
),
};
return Err(DocError::Invalid(what));
};
@@ -29,6 +29,7 @@ pub(super) fn fixtures() -> Vec<(&'static str, Value)> {
let hole =
|h: Value| json!({"type": "hole", "position": o, "direction": [0, 0, 1], "diameter": "hole.diameter", "depth": "hole.depth", "hole": h});
vec![
("newer_file_feature", json!({"type": "newer_file_feature", "raw": {"type": "gyroid_lattice", "cell": 2}})),
(
"body_transfer",
json!({"type": "body_transfer", "bodies": ["B"], "from": 0, "to": 1, "transform": [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]}),
@@ -1,3 +1,4 @@
newer_file_feature
body_transfer
sketch
inputs:
@@ -1,3 +1,4 @@
newer_file_feature
body_transfer
sketch
moves: plane.axis_dir[0], plane.axis_dir[1], plane.axis_origin[0], plane.axis_origin[1], plane.axis_origin[2]
@@ -1,3 +1,4 @@
newer_file_feature
body_transfer
remap_bodies: bodies[0]
sketch
+139 -117
View File
@@ -2,8 +2,9 @@
//!
//! A design file starts with `"format": "solidcraft/N"`. A file of an older format is read and
//! upgraded step by step (N → N+1 → … → current): JSON-level steps first, for changes in the
//! file's shape, then document-level steps. A file of a newer format than this build knows is
//! refused with a message saying so, never guessed at.
//! file's shape, then document-level steps. A file a newer build saved opens too, with a warning:
//! what this build reads is read, what it doesn't is reported by name and kept for the next save
//! (`crate::newer_file`).
//!
//! History:
//! - 1: every design up to 2026-10-08 (format string since M0). Fields added over time all
@@ -264,7 +265,7 @@ const FORMATS: Formats<'static> = Formats { hand: &JSON_STEPS, folded: FOLDED, p
/// A kind of file whose format is versioned here: designs, and drawings (#3890). Each family has
/// its own format tag, its own numbers and its own folder of change files (`build.rs` lists them);
/// reading a file's format, refusing a file a newer build saved and the upgrade are the same code
/// reading a file's format, telling a file a newer build saved and the upgrade are the same code
/// for every family.
pub struct Family<'a> {
/// What a file of the family is called in messages.
@@ -317,8 +318,8 @@ impl Family<'_> {
}
/// Read a file's format and take its `format_pending` out of its JSON, before anything else
/// in it is read: a file that isn't this family's, or that a newer build saved, is refused
/// here, so nothing a newer build saved is judged by this build's rules.
/// in it is read: a file that isn't this family's is refused here. One a newer build saved is
/// not: [`Family::newer`] says so.
pub fn take_version(&self, v: &mut Value) -> Result<(u32, Option<Vec<String>>)> {
let noun = self.noun;
let not_ours = |what: String| DocError::Invalid(format!("not a SolidCraft {noun} ({what})"));
@@ -329,10 +330,19 @@ impl Family<'_> {
Some(_) => return Err(not_ours("format is not a string".into())),
};
let applied = take_names(v, "format_pending", noun)?;
self.formats.check(noun, version, applied.as_deref())?;
if version == 0 {
return Err(not_ours("format 0".into()));
}
Ok((version, applied))
}
/// What says a file of format `version` with the changes `applied` came from a newer build:
/// a number past this build's, or a change this build doesn't have anywhere in its history.
/// `None` for a file this build fully knows.
pub fn newer(&self, version: u32, applied: Option<&[String]>) -> Option<Newer> {
self.formats.newer(version, applied)
}
/// Bring a file of format `version` up to this build's; `applied` is its `format_pending`
/// (both from [`Family::take_version`]).
pub fn upgrade(&self, v: &mut Value, version: u32, applied: Option<&[String]>) -> Result<()> {
@@ -350,6 +360,17 @@ impl Family<'_> {
}
}
/// How a file shows a newer build saved it ([`Family::newer`]).
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Newer {
/// The number the file says.
pub format: u32,
/// The number this build reads up to.
pub reads_up_to: u32,
/// The changes the file names that this build doesn't have.
pub unknown_changes: Vec<String>,
}
/// The names of the pending changes this build writes into a design (`format_pending`).
pub fn pending_names() -> Vec<String> {
DESIGN.pending_names()
@@ -394,35 +415,25 @@ impl Formats<'_> {
}
}
/// Refuse a `noun` of format `version` that this build can't read: format 0, a newer number,
/// or a change `applied` (its `format_pending`) names that this build doesn't have anywhere in
/// its history, which only a newer build's file can. Changes are recognized across the entire
/// history: a branch's pending change may have landed at a later number. A list beside a format
/// that isn't made of changes means nothing (a tool or a test set an older number on a newer
/// file).
fn check(&self, noun: &str, version: u32, applied: Option<&[String]>) -> Result<()> {
let newer = |what: String| DocError::Invalid(format!("this {noun} was saved by a newer SolidCraft ({what}): update SolidCraft to open it"));
/// [`Family::newer`]. Changes are recognized across the entire history: a branch's pending
/// change may have landed at a later number. A list beside a format that isn't made of changes
/// means nothing (a tool or a test set an older number on a newer file).
fn newer(&self, version: u32, applied: Option<&[String]>) -> Option<Newer> {
let current = self.current();
if version == 0 {
return Err(DocError::Invalid(format!("not a SolidCraft {noun} (format 0)")));
}
if version > current {
return Err(newer(format!("file format {version}; this version reads formats up to {current}")));
}
let applied = applied.filter(|_| self.parts(version).is_some()).unwrap_or_default();
match applied.iter().find(|name| !self.knows_part_name(self.canonical_applied_name(version, name))) {
Some(unknown) => Err(newer(format!("file format {version} with `{unknown}`, which this version doesn't know"))),
None => Ok(()),
}
let listed = applied.filter(|_| version > current || self.parts(version).is_some()).unwrap_or_default();
let unknown_changes: Vec<String> =
listed.iter().filter(|name| !self.knows_part_name(self.canonical_applied_name(version, name))).cloned().collect();
(version > current || !unknown_changes.is_empty()).then_some(Newer { format: version, reads_up_to: current, unknown_changes })
}
/// Bring a `noun` of format `version` up to [`Formats::current`]. `applied` is the file's
/// `format_pending`: the changes of its format it already has, when it was written while they
/// were pending; the others' steps run first. A file [`Formats::check`] refuses is refused,
/// whoever calls, before anything is changed; already-applied changes never run again at
/// their later number.
/// were pending; the others' steps run first, and already-applied changes never run again at
/// their later number. A file past this build's number has no steps to run.
fn upgrade(&self, noun: &str, v: &mut Value, version: u32, applied: Option<&[String]>) -> Result<()> {
self.check(noun, version, applied)?;
if version == 0 {
return Err(DocError::Invalid(format!("not a SolidCraft {noun} (format 0)")));
}
// A list beside a format that isn't made of changes is ignored, like any field an upgrade
// drops.
let applied = applied.filter(|_| self.parts(version).is_some());
@@ -677,18 +688,53 @@ fn v2_to_v3(v: &mut Value) -> Result<()> {
pub fn read(s: &str) -> Result<Document> {
let mut v: Value = serde_json::from_str(s).map_err(|e| DocError::Invalid(format!("not a SolidCraft design: {e}")))?;
let (version, applied) = DESIGN.take_version(&mut v)?;
check_design_numbers(&v)?;
crate::config::validate_rules_json(&v)?;
crate::config::validate_styles_json(&v)?;
crate::face_anchor::validate_face_anchors_json(&v)?;
validate_versioned_geometry(&v)?;
validate_emboss_targets(&v)?;
validate_freeform_offsets(&v)?;
validate_sketch_sizes(&v)?;
crate::format_offsets::validate_raw(&v)?;
let legacy_wires = validate_wires(&v, version)?;
match DESIGN.newer(version, applied.as_deref()) {
Some(newer) => crate::newer_file::read(v, version, applied, newer),
None => decode(v, version, applied.as_deref()),
}
}
/// Whether a design's text says a newer build saved it, read before anything else in it is.
pub fn says_newer(text: &str) -> bool {
#[derive(serde::Deserialize)]
struct Says {
format: Option<String>,
format_pending: Option<Vec<String>>,
}
serde_json::from_str::<Says>(text)
.ok()
.and_then(|says| Some((DESIGN.version_of(&says.format?)?, says.format_pending)))
.is_some_and(|(version, applied)| DESIGN.newer(version, applied.as_deref()).is_some())
}
/// The checks of a design's JSON that need nothing outside the part of it they are given.
pub(crate) fn check_raw(v: &Value, version: u32) -> Result<Vec<(usize, usize)>> {
check_design_numbers(v)?;
crate::config::validate_rules_json(v)?;
crate::config::validate_styles_json(v)?;
crate::face_anchor::validate_face_anchors_json(v)?;
validate_versioned_geometry(v)?;
validate_emboss_targets(v)?;
validate_freeform_offsets(v)?;
validate_sketch_sizes(v)?;
crate::format_offsets::validate_raw(v)?;
validate_wires(v, version)
}
/// [`check_raw`], the upgrade and the typed record alone: what a piece of a design must pass by
/// itself ([`crate::newer_file`]), with nothing else in the file for it to refer to.
pub(crate) fn check_piece(mut v: Value, version: u32, applied: Option<&[String]>) -> Result<()> {
check_raw(&v, version)?;
DESIGN.upgrade(&mut v, version, applied)?;
let d: Document = serde_json::from_value(v).map_err(|e| DocError::Invalid(format!("design file: {e}")))?;
check_typed_numbers(&d)
}
/// A design's JSON, its format taken out, as the document it holds.
pub(crate) fn decode(mut v: Value, version: u32, applied: Option<&[String]>) -> Result<Document> {
let legacy_wires = check_raw(&v, version)?;
validate_body_transfers(&v)?;
DESIGN.upgrade(&mut v, version, applied.as_deref())?;
DESIGN.upgrade(&mut v, version, applied)?;
let mut d: Document = serde_json::from_value(v).map_err(|e| DocError::Invalid(format!("design file: {e}")))?;
check_typed_numbers(&d)?;
let mut legacy_by_feature = std::collections::BTreeMap::<usize, Vec<usize>>::new();
@@ -1327,9 +1373,9 @@ mod tests {
let mut v = serde_json::json!({});
formats.upgrade("design", &mut v, next, Some(&["a-first".into(), "b-second".into()])).unwrap();
assert_eq!(trace_of(&v), Vec::<&str>::new());
// A change this build doesn't know is a newer build's: refused, not guessed at.
let err = formats.upgrade("design", &mut serde_json::json!({}), next, Some(&["c-later".into()])).unwrap_err();
assert!(err.to_string().contains("newer SolidCraft"), "{err}");
// A change this build doesn't know is a newer build's: said, and kept.
let said = formats.newer(next, Some(&["c-later".into()])).unwrap();
assert_eq!(said, Newer { format: next, reads_up_to: next, unknown_changes: vec!["c-later".into()] });
// A list on a format that isn't made of changes means nothing.
let mut v = serde_json::json!({});
formats.upgrade("design", &mut v, HAND_WRITTEN, Some(&["a-first".into()])).unwrap();
@@ -1372,15 +1418,12 @@ mod tests {
}
#[test]
fn personal_card_alias_without_support_refuses_before_mutation() {
fn personal_card_alias_without_support_is_a_newer_builds() {
let hand: [JsonStep; 27] = [|_| Ok(()); 27];
let first = [traced("a-first")];
let formats = Formats { hand: &hand, folded: &[(29, &first)], pending: &[] };
let mut file = serde_json::json!({"trace": [], "sentinel": 7});
let original = file.clone();
let error = formats.upgrade("design", &mut file, 29, Some(&["physical-material-cards".into()])).unwrap_err();
assert!(error.to_string().contains("physical-material-cards"), "{error}");
assert_eq!(file, original);
let said = formats.newer(29, Some(&["physical-material-cards".into()])).unwrap();
assert_eq!(said.unknown_changes, ["physical-material-cards"]);
}
#[test]
@@ -1391,11 +1434,8 @@ mod tests {
let cards = [traced("material-engineering-cards")];
let formats = Formats { hand: &hand, folded: &[(28, &first), (29, &second), (30, &cards)], pending: &[] };
for version in [28, 30] {
let mut file = serde_json::json!({"trace": []});
let original = file.clone();
let error = formats.upgrade("design", &mut file, version, Some(&["physical-material-cards".into()])).unwrap_err();
assert!(error.to_string().contains("physical-material-cards"), "{error}");
assert_eq!(file, original);
let said = formats.newer(version, Some(&["physical-material-cards".into()])).unwrap();
assert_eq!(said.unknown_changes, ["physical-material-cards"]);
}
}
@@ -1408,11 +1448,7 @@ mod tests {
for names in
[["physical-material-cards".into(), "unknown-card-codec".into()], ["unknown-card-codec".into(), "physical-material-cards".into()]]
{
let mut file = serde_json::json!({"trace": ["b"]});
let original = file.clone();
let error = formats.upgrade("design", &mut file, 29, Some(&names)).unwrap_err();
assert!(error.to_string().contains("unknown-card-codec"), "{error}");
assert_eq!(file, original);
assert_eq!(formats.newer(29, Some(&names)).unwrap().unknown_changes, ["unknown-card-codec"]);
}
}
@@ -1446,18 +1482,14 @@ mod tests {
}
/// An experimental producer can use a number that a release later folds without its
/// change. Its unknown concept must still be refused before any migration runs.
/// change. Its unknown concept is still a newer build's.
#[test]
fn unknown_pending_concepts_are_refused_after_folding() {
fn unknown_pending_concepts_are_said_after_folding() {
let parts = [traced("a-first")];
let later = [traced("b-second")];
for pending in [&[][..], &later[..]] {
let formats = Formats { hand: &[], folded: &[(2, &parts)], pending };
let mut file = serde_json::json!({"trace": []});
let original = file.clone();
let err = formats.upgrade("design", &mut file, 2, Some(&["experimental-card".into()])).unwrap_err();
assert!(err.to_string().contains("experimental-card") && err.to_string().contains("update SolidCraft"), "{err}");
assert_eq!(file, original, "refuse before applying even a known migration");
assert_eq!(formats.newer(2, Some(&["experimental-card".into()])).unwrap().unknown_changes, ["experimental-card"]);
}
}
@@ -1479,23 +1511,20 @@ mod tests {
}
}
/// A design naming a pending change this build doesn't have is a newer build's, refused as
/// such before anything else in it is checked (as a newer number is), so a newer build's
/// fields never read as damage.
/// A design naming a pending change this build doesn't have is a newer build's: what it can't
/// read of it doesn't read as damage.
#[test]
fn a_newer_builds_pending_change_is_refused_before_the_design_is_checked() {
fn a_newer_builds_pending_change_opens_and_its_fields_are_not_damage() {
let mut file: Value = serde_json::from_str(&Document::new("A").to_json()).unwrap();
file["format_pending"] = serde_json::json!(["not-a-change-anyone-made"]);
file["features"] = serde_json::json!([{"type": "emboss", "face": {"body": "Body", "at": [0, 0, 0], "a_newer_key": true}}]);
let error = read(&file.to_string()).unwrap_err().to_string();
let opened = read(&file.to_string()).unwrap();
// With changes pending, FORMAT is made of them; once they are folded it is the folded
// format, which is made of changes too. Either way an unknown change is a newer build's.
assert_eq!(
error,
format!(
"this design was saved by a newer SolidCraft (file format {FORMAT} with `not-a-change-anyone-made`, which this version doesn't know): update SolidCraft to open it"
)
);
let said = opened.newer_file.as_ref().unwrap();
assert_eq!(said.unknown_changes, ["not-a-change-anyone-made"]);
assert!(said.notice().contains(&format!("format {FORMAT} with `not-a-change-anyone-made`")), "{}", said.notice());
assert!(matches!(opened.features[0].kind, crate::FeatureKind::NewerFileFeature { .. }));
}
/// Drawings follow the same rules from their own first format: folded formats follow on from 1
@@ -1575,17 +1604,17 @@ mod tests {
fn tagged(family: &Family<'_>, n: u32) -> Value {
serde_json::json!({"format": family.format_string(n)})
}
fn newer(noun: &str, n: u32, current: u32) -> String {
format!(
"this {noun} was saved by a newer SolidCraft (file format {n}; this version reads formats up to {current}): update SolidCraft to open it"
)
}
assert_eq!(refusal(&DESIGN, tagged(&DESIGN, FORMAT + 1)), newer("design", FORMAT + 1, FORMAT));
assert_eq!(read(&tagged(&DESIGN, FORMAT + 1).to_string()).unwrap_err().to_string(), newer("design", FORMAT + 1, FORMAT));
// A newer number isn't refused: it is said.
let says = |family: &Family<'_>, mut file: Value| {
let (version, applied) = family.take_version(&mut file).unwrap();
family.newer(version, applied.as_deref())
};
assert_eq!(says(&DESIGN, tagged(&DESIGN, FORMAT + 1)), Some(Newer { format: FORMAT + 1, reads_up_to: FORMAT, unknown_changes: vec![] }));
assert_eq!(read(&tagged(&DESIGN, FORMAT + 1).to_string()).unwrap().newer_file.unwrap().format, FORMAT + 1);
let current = DRAWING.current();
assert!(matches!(DRAWING.take_version(&mut tagged(&DRAWING, current)), Ok((v, None)) if v == current));
for n in [current + 1, u32::MAX] {
assert_eq!(refusal(&DRAWING, tagged(&DRAWING, n)), newer("drawing", n, current));
assert_eq!(says(&DRAWING, tagged(&DRAWING, n)), Some(Newer { format: n, reads_up_to: current, unknown_changes: vec![] }));
}
for (family, noun) in [(&DESIGN, "design"), (&DRAWING, "drawing")] {
assert_eq!(refusal(family, tagged(family, 0)), format!("not a SolidCraft {noun} (format 0)"));
@@ -1607,12 +1636,7 @@ mod tests {
let design = Family { formats: Formats { hand: &JSON_STEPS, folded: FOLDED, pending: &pending }, ..DESIGN };
let next = design.current();
let file = json!({"format": format_string(next), "format_pending": ["c-later"]});
assert_eq!(
refusal(&design, file),
format!(
"this design was saved by a newer SolidCraft (file format {next} with `c-later`, which this version doesn't know): update SolidCraft to open it"
)
);
assert_eq!(says(&design, file), Some(Newer { format: next, reads_up_to: next, unknown_changes: vec!["c-later".into()] }));
assert!(matches!(DESIGN.take_version(&mut json!({})), Ok((1, None))));
assert_eq!(refusal(&DRAWING, json!({})), "not a SolidCraft drawing (no format)");
}
@@ -1639,19 +1663,13 @@ mod tests {
assert_eq!(open(json!({"format": "solidcraft-drawing/2", "format_pending": ["a-first"]})).unwrap(), Vec::<String>::new());
// A list beside format 1 means nothing: the step still runs.
assert_eq!(open(json!({"format": "solidcraft-drawing/1", "format_pending": ["c-later"]})).unwrap(), ["a"]);
let error = open(json!({"format": "solidcraft-drawing/2", "format_pending": ["a-first", "c-later"]})).unwrap_err().to_string();
assert_eq!(
error,
"this drawing was saved by a newer SolidCraft (file format 2 with `c-later`, which this version doesn't know): update SolidCraft to open it"
);
let error = open(json!({"format": "solidcraft-drawing/3"})).unwrap_err().to_string();
assert_eq!(
error,
"this drawing was saved by a newer SolidCraft (file format 3; this version reads formats up to 2): update SolidCraft to open it"
);
// An upgrade called without `take_version` refuses in the drawing's words too, format 0 included.
let error = drawing.upgrade(&mut json!({}), 3, None).unwrap_err().to_string();
assert!(error.starts_with("this drawing was saved by a newer SolidCraft (file format 3;"), "{error}");
// Of a newer build: said, and what can run runs.
let list = ["a-first".to_string(), "c-later".to_string()];
assert_eq!(drawing.newer(2, Some(&list)).unwrap().unknown_changes, ["c-later"]);
assert_eq!(open(json!({"format": "solidcraft-drawing/2", "format_pending": list})).unwrap(), Vec::<String>::new());
assert_eq!(drawing.newer(3, None).unwrap(), Newer { format: 3, reads_up_to: 2, unknown_changes: vec![] });
assert_eq!(open(json!({"format": "solidcraft-drawing/3"})).unwrap(), Vec::<String>::new());
// An upgrade called without `take_version` still says format 0 isn't one.
assert_eq!(drawing.upgrade(&mut json!({}), 0, None).unwrap_err().to_string(), "not a SolidCraft drawing (format 0)");
}
@@ -1666,7 +1684,8 @@ mod tests {
assert!(read(&file.to_string()).is_err());
}
file["format_pending"] = serde_json::json!(["not-a-change-anyone-made"]);
assert!(read(&file.to_string()).is_err(), "unknown pending concepts are refused even after folding");
let newer = read(&file.to_string()).unwrap();
assert_eq!(newer.newer_file.as_ref().unwrap().unknown_changes, ["not-a-change-anyone-made"], "even after folding");
file["format_pending"] = Value::from(pending_names());
let opened = read(&file.to_string()).unwrap();
assert_eq!(opened.format_pending, pending_names());
@@ -2138,8 +2157,9 @@ mod tests {
value["features"] = serde_json::json!([{"type":"sketch", "sketch":{"freeform_offsets":records}}]);
let error = read(&value.to_string()).unwrap_err().to_string();
assert!(error.contains("free-form offset metadata"), "{error}");
// A newer build's file isn't held to this: the feature waits for that build.
value["format"] = Value::from(format_string(FORMAT + 1));
assert!(read(&value.to_string()).unwrap_err().to_string().contains("newer SolidCraft"));
assert!(matches!(read(&value.to_string()).unwrap().features[0].kind, crate::FeatureKind::NewerFileFeature { .. }));
}
}
@@ -2163,8 +2183,7 @@ mod tests {
let error = read(&value.to_string()).unwrap_err().to_string();
assert!(error.contains("emboss face"), "{error}");
value["format"] = Value::from(format_string(FORMAT + 1));
let error = read(&value.to_string()).unwrap_err().to_string();
assert!(error.contains("newer SolidCraft"), "{error}");
assert!(matches!(read(&value.to_string()).unwrap().features[0].kind, crate::FeatureKind::NewerFileFeature { .. }));
}
}
@@ -2207,7 +2226,7 @@ mod tests {
}
#[test]
fn version_seven_styles_upgrade_and_newer_versions_are_refused_before_columns() {
fn version_seven_styles_upgrade_and_a_newer_versions_columns_are_kept() {
use crate::config::{Column, ConfigRow};
let mut d = Document::new("configured styles");
d.configs.columns = vec![Column::Material("Body".into()), Column::Appearance("Body".into())];
@@ -2227,9 +2246,11 @@ mod tests {
value["format"] = Value::from(format_string(FORMAT + 1));
value["configs"]["columns"] = serde_json::json!([{"unknown_future_column":"Body"}]);
value["configs"]["rules"] = serde_json::json!({"unknown_future_rule": true});
let error = read(&value.to_string()).unwrap_err().to_string();
assert!(error.contains("newer SolidCraft") && error.contains("update SolidCraft"), "{error}");
assert!(!error.contains("unknown variant"), "format refusal precedes decoding new variants");
let opened = read(&value.to_string()).unwrap();
let said = opened.newer_file.as_ref().unwrap();
assert!(said.not_understood.iter().any(|what| what.contains("configs")), "{:?}", said.not_understood);
let saved: Value = serde_json::from_str(&opened.to_json()).unwrap();
assert_eq!(saved["configs"], value["configs"], "kept for the build that reads them");
}
#[test]
@@ -2284,8 +2305,10 @@ mod tests {
assert_eq!(read(&saved.to_string()).unwrap(), d);
saved["format"] = Value::from(format_string(FORMAT + 1));
saved["features"][0]["sketch"]["constraints"][0]["type"] = Value::from("future_dimension");
let error = read(&saved.to_string()).unwrap_err().to_string();
assert!(error.contains("newer SolidCraft") && !error.contains("unknown variant"), "{error}");
let opened = read(&saved.to_string()).unwrap();
assert!(matches!(opened.features[0].kind, crate::FeatureKind::NewerFileFeature { .. }));
let again: Value = serde_json::from_str(&opened.to_json()).unwrap();
assert_eq!(again["features"][0], saved["features"][0]);
}
#[test]
@@ -2392,15 +2415,14 @@ mod tests {
}
#[test]
fn older_upgraded_newer_refused_others_rejected() {
fn older_upgraded_newer_opened_others_rejected() {
let mut v: Value = serde_json::from_str(&Document::new("A").to_json()).unwrap();
v["format"] = Value::from("solidcraft/1");
assert_eq!(read(&v.to_string()).unwrap().format, format_string(FORMAT));
v.as_object_mut().unwrap().remove("format");
assert!(read(&v.to_string()).is_ok(), "a file without a format is format 1");
v["format"] = Value::from(format_string(FORMAT + 1));
let e = read(&v.to_string()).unwrap_err().to_string();
assert!(e.contains("newer SolidCraft"), "{e}");
assert_eq!(read(&v.to_string()).unwrap().newer_file.unwrap().format, FORMAT + 1);
for bad in ["solidcraft/0", "acad/3", "solidcraft/-1", "solidcraft/99999999999999999999"] {
v["format"] = Value::from(bad);
assert!(read(&v.to_string()).is_err(), "{bad}");
+1 -1
View File
@@ -5,7 +5,7 @@ here is the whole format bump: never edit `FORMAT`, `JSON_STEPS` or another chan
- Name it after the change, lowercase with dashes: `placed-plane-origins.rs`.
- Start it with a `//!` note: what is saved, what an older design gets without it, and what
the last release does with a design that has it (it refuses the newer format number).
the last release does with a design that has it (it warns about the newer format number, opens what it can read and keeps the rest).
- If older designs must be rewritten as they open, add the step to the same file:
```rust
@@ -0,0 +1,4 @@
//! A counterbore hole may save a `bridge` length: two printing layers that thick below the
//! counterbore's floor (a slot as wide as the hole along X, then a square) so a 3D printer bridges
//! the step. An older design has none and keeps a plain counterbore. The last release refuses a
//! design that has it (it asks for an update) instead of opening it without the bridge layers.
+1 -1
View File
@@ -399,7 +399,7 @@ mod tests {
damaged["features"][1]["profiles"]["associations"] = associations;
assert!(validate_raw(&damaged).is_err());
damaged["format"] = json!(crate::format::format_string(crate::format::FORMAT + 1));
assert!(crate::format::read(&damaged.to_string()).unwrap_err().to_string().contains("newer SolidCraft"));
assert!(crate::format::read(&damaged.to_string()).unwrap().newer_file.is_some());
}
// Absent metadata preserves the historical one-to-one chain representation.
let mut legacy = fixture();
+1
View File
@@ -11,6 +11,7 @@ mod assembly;
mod body_transfer;
mod body_transfer_sheet;
mod browser_tree;
pub mod newer_file;
pub mod pbr_appearance;
pub use body_transfer::{valid_transfer_matrix, validate_body_transfer};
pub mod canvas;
+13 -4
View File
@@ -757,10 +757,19 @@ pub(crate) fn order_lumps(bodies: &mut [crate::ModelBody], origin: &Arc<crate::n
// cut body's own feature's and the rest are the cut's, and `body.rename` stores a name in
// the `body_names` of the feature a body says made it (#10438).
let names: Vec<(String, u64)> = members.iter().filter_map(|i| bodies.get(*i).map(|b| (b.name.clone(), b.feature))).collect();
for ((name, feature), (_, i)) in names.into_iter().zip(keys) {
if let Some(b) = bodies.get_mut(i) {
b.name = name;
b.feature = feature;
// The pieces take the family's places in that order too, so the state lists them as
// their names run. The session pins a feature's body names in state order, and the next
// evaluation hands them out in this order: listed in the kernel's order, the pieces
// swapped names once the design was evaluated again from its pinned names (opened).
let moved: Vec<crate::ModelBody> = keys.iter().filter_map(|(_, i)| bodies.get(*i).cloned()).collect();
if moved.len() != members.len() || names.len() != members.len() {
continue;
}
for ((mut b, (name, feature)), place) in moved.into_iter().zip(names).zip(&members) {
b.name = name;
b.feature = feature;
if let Some(slot) = bodies.get_mut(*place) {
*slot = b;
}
}
}
+22 -2
View File
@@ -769,6 +769,8 @@ impl Model {
let mut exact = true;
let mut prev = 0;
let mut results = Vec::with_capacity(features.len());
let mut construction = HashMap::new();
let mut prepared_states = std::collections::HashSet::new();
for (i, (f, r)) in doc.features.iter().zip(features).enumerate() {
let saved = unhex(r.get("fingerprint").unwrap_or(&Json::Null))?;
// A fingerprint reads the state before its feature (where the bodies it takes lie).
@@ -780,8 +782,26 @@ impl Model {
}
let ms = r.get("ms").and_then(Json::as_f64).filter(|ms| ms.is_finite()).ok_or_else(|| bad("saved model: time"))?;
// A file without room for every state keeps some features without one (#3220).
let state =
r.get("state").map(|s| states.get(index(Some(s), states.len())?).cloned().ok_or_else(|| bad("saved model: state"))).transpose()?;
let state = r.get("state").map(|s| index(Some(s), states.len())).transpose()?;
if let Some(at) = state
&& prepared_states.insert(at)
{
let original = matches!(
&f.kind,
FeatureKind::Box { operation: Operation::NewBody, .. } | FeatureKind::Extrude { operation: Operation::NewBody, .. }
);
let current = states.get_mut(at).ok_or_else(|| bad("saved model: state"))?;
// Each state is prepared before its first shared clone. Record and NameCell
// identity prove this is still the original geometry and its exact names.
for body in &mut Arc::make_mut(current).bodies {
let key = (std::ptr::from_ref(body.body.record()).addr(), body.names.id());
if original && body.feature == f.id && before.body(&body.name).is_none() {
construction.insert(key, f.id);
}
body.names.cached_construction = construction.get(&key).copied();
}
}
let state = state.map(|at| states.get(at).cloned().ok_or_else(|| bad("saved model: state"))).transpose()?;
let result = FeatureResult {
id: f.id,
name: f.name.clone(),
+83 -1
View File
@@ -9,15 +9,19 @@
//! that uses it fails, asking for the reference to be picked again
//! ([`crate::DocError::Reselect`]). A face whose name was worked out from geometry, found where
//! the reference's point no longer lies, is reported: only geometry decided.
//! Saved numbered Project links also have a compatibility check for a whole face that
//! contains the saved pick and comes directly from its original construction feature.
//! This check is local to manual sketch projection.
use solidcore_record::Vec3;
use solidcraft_geom::Mesh;
use solidcraft_geom::brep::eval::SurfaceEval;
use solidcraft_geom::prelude::*;
use crate::history_names::{Match, Names};
use crate::naming::{self, closest, edge_names, face_names, strip_piece};
use crate::piece_names::strip_edge_number;
use crate::{ModelBody, ModelState};
use crate::{FeatureKind, ModelBody, ModelState, Operation};
/// The mark on a name saved before format 14 (`?F2:top#2`). Those names were worked out from
/// geometry, and some of them name a face that exact history names differently (a tube's outer
@@ -433,6 +437,84 @@ pub(crate) fn locate_on(body: &ModelBody, name: &str, p: Vec3) -> Option<FaceHit
locate_in(std::iter::once((0, body)), name, p).ok()
}
/// Find a saved manual Project face in its body. Older designs can name a numbered piece of
/// a face that now evaluates whole. Recover it only when the original feature directly made
/// the exact whole face and the face contains the
/// old pick. Other face references still require the stored name as picked.
pub(crate) fn locate_projected_face(body: &ModelBody, name: &str, p: Vec3) -> Option<(usize, Vec3)> {
if body.body.is_mesh() {
return None;
}
match locate_in(std::iter::once((0, body)), name, p) {
Ok(hit) => Some((hit.face, hit.point)),
Err(Miss::Gone) => recover_numbered_projected_face(body, name, p),
Err(Miss::Several) => None,
}
}
/// Bound the quadratic scan in remove_faces, which takes the list of faces to remove.
const MAX_PROJECTION_RECOVERY_FACES: usize = 1024;
fn recover_numbered_projected_face(body: &ModelBody, name: &str, pick: Vec3) -> Option<(usize, Vec3)> {
let (stem, number) = name.rsplit_once('#')?;
let count = body.body.face_count();
if count > MAX_PROJECTION_RECOVERY_FACES
|| !pick.is_finite()
|| stem.is_empty()
|| strip_piece(stem) != stem
|| number.is_empty()
|| number.starts_with('0')
|| !number.bytes().all(|digit| digit.is_ascii_digit())
{
return None;
}
// A changed body may keep the same face name while the face absorbs a smaller piece.
// Projecting that larger face could silently grow a downstream feature's material.
let producer = stem.strip_prefix('F')?.split_once(':')?.0.parse::<u64>().ok()?;
let live_construction = body.names.origin.as_ref().is_some_and(|origin| {
producer == origin.feature.id
&& matches!(
&origin.feature.kind,
FeatureKind::Box { operation: Operation::NewBody, .. } | FeatureKind::Extrude { operation: Operation::NewBody, .. }
)
&& origin.before.body(&body.name).is_none()
});
if producer != body.feature || !(live_construction || body.names.cached_construction == Some(producer)) {
return None;
}
let candidates = faces_with_stem(body, stem);
let &[face] = candidates.as_slice() else { return None };
let names = naming::names(body);
let info = names.info.get(face)?;
if names.faces.get(face)?.as_str() != stem || !info.verified || info.aliases.iter().any(|alias| strip_piece(alias) != stem) {
return None;
}
let record = body.body.record().faces.get(face)?;
let [[u0, u1], [v0, v1]] = record.domain;
let surface = SurfaceEval::new(record.parameters()).ok()?;
let tolerance = (body.body.size() * 1e-3).max(1e-3);
if !tolerance.is_finite() {
return None;
}
let point = surface.point(surface.project(pick, Some([u0.midpoint(u1), v0.midpoint(v1)]), tolerance)?)?;
if !point.is_finite() || !(point.dist(pick) <= tolerance) {
return None;
}
// Isolate the face so a point on another face of the same surface cannot pass the trim test.
let others: Vec<_> = (0..count).filter(|index| *index != face).collect();
let isolated;
let trimmed = if others.is_empty() {
&body.body
} else {
isolated = solidcraft_kernel::remove_faces(&body.body, &others).ok()?;
&isolated
};
matches!(trimmed.classify_point(point), Ok(solidcraft_kernel::PointClass::OnBoundary)).then_some((face, point))
}
/// The one face a name `model.faces` lists finds, on the body called `body` or, without one, on
/// any body. `Err` says why there is no such face, or why the name does not name just one (the
/// pieces of a split face, or the same face on several bodies): a command that takes a face by
+195 -1
View File
@@ -1,5 +1,5 @@
use crate::{Document, ModelBody, ModelState};
use solidcore_record::{Plane, Vec3};
use solidcore_record::{Plane, Vec2, Vec3};
use solidcraft_geom::prelude::*;
use solidcraft_sketch::{LinkKind, LinkSource, Sketch};
use std::collections::BTreeMap;
@@ -49,3 +49,197 @@ fn named_manual_projection_keeps_its_body_and_face_at_shared_boundaries() {
assert_eq!(sketch.links[0].id, link);
assert!(matches!(&sketch.links[0].source,LinkSource::Face{body,..} if body=="Source"));
}
#[test]
fn numbered_manual_projection_rebuilds_from_the_whole_planar_face() {
let mut doc = Document::default();
doc.set_param("size", "5", Some("mm"), None).unwrap();
let kind = serde_json::from_value(serde_json::json!({
"type": "box", "corner": [0, 0, 0], "length": "size", "width": "size", "height": "10"
}))
.unwrap();
let feature = doc.add_feature(kind, None).unwrap();
doc.feature_mut(feature).unwrap().body_names = vec!["Source".into()];
let mut model = crate::Model::new();
model.evaluate(&doc);
let plane = Plane::XY.offset(20.);
let source = LinkSource::Face { body: "Source".into(), at: Vec3::new(2., 2., 10.) };
let resolved = crate::project::resolve(&doc, &BTreeMap::new(), &model.state(), &plane, LinkKind::Project, &source).unwrap();
let mut sketch = Sketch::default();
let link = sketch.add_link(LinkKind::Project, source, &resolved.geom).unwrap();
let numbered = format!("F{feature}:+z#1");
sketch.links[0].face_name = Some(numbered.clone());
doc.set_param("size", "20", Some("mm"), None).unwrap();
model.evaluate(&doc);
assert!(crate::project::refresh_links(&doc, &BTreeMap::new(), &model.state(), &plane, &mut sketch).unwrap().is_empty());
assert!(!sketch.links[0].lost);
assert_eq!(sketch.links[0].face_name.as_deref(), Some(numbered.as_str()));
assert_eq!(sketch.link_curves(&link).len(), 4);
assert!(sketch.points.iter().any(|point| point.pos.x > 19. && point.pos.y > 19.));
let saved = model.saved(&doc).unwrap();
let reopened = crate::format::read(&doc.to_json()).unwrap();
let cached = crate::Model::adopt(&reopened, &saved).unwrap();
let state = cached.state();
assert!(state.body("Source").unwrap().names.origin.is_none());
assert_eq!(state.body("Source").unwrap().names.cached_construction, Some(feature));
assert!(crate::project::refresh_links(&reopened, &BTreeMap::new(), &state, &plane, &mut sketch).unwrap().is_empty());
assert!(!sketch.links[0].lost);
}
#[test]
fn numbered_round_face_projection_recovers_the_whole_face() {
let doc = Document {
features: serde_json::from_value(serde_json::json!([
{
"id": 1, "name": "Sketch1", "type": "sketch", "plane": {"name": "XY", "type": "origin"},
"sketch": {
"points": [{"fixed": true, "id": "origin", "pos": [0., 0.]}, {"fixed": false, "id": "c1.center", "pos": [0., 0.]}],
"curves": [{"c": 1, "construction": false, "id": "c1", "r": 20., "type": "circle"}],
"constraints": [{"id": "k1", "p": 0, "q": 1, "type": "coincident"}],
"counters": {"k": 1, "l": 0, "p": 1}
}
},
{
"id": 2, "name": "Extrude1", "type": "extrude", "body_names": ["Body1"],
"extent": {"convention": "total_distance", "direction": "positive", "distance": "10"},
"operation": "new_body", "profiles": {"loops": [["c1"]], "type": "curves"}, "sketch": 1
},
{
"id": 3, "name": "Sketch2", "type": "sketch", "plane": {"name": "YZ", "type": "origin"},
"sketch": {
"points": [
{"fixed": true, "id": "origin", "pos": [0., 0.]},
{"fixed": false, "id": "p1", "pos": [-20., 0.]},
{"fixed": false, "id": "p2", "pos": [20., 0.]},
{"fixed": false, "id": "p3", "pos": [-20., 10.]},
{"fixed": false, "id": "p4", "pos": [20., 10.]}
],
"curves": [
{"a": 1, "b": 2, "construction": false, "id": "l1", "link": "j1", "type": "line"},
{"a": 3, "b": 4, "construction": false, "id": "l2", "link": "j1", "type": "line"}
],
"constraints": [],
"counters": {"k": 0, "l": 2, "p": 4},
"links": [{
"face_name": "F2:side:c1#1", "id": "j1", "kind": "project",
"source": {"at": [-19.87, -2.3, 6.], "body": "Body1", "type": "face"}
}]
}
}
]))
.unwrap(),
..Document::default()
};
let doc = crate::format::read(&doc.to_json()).unwrap();
let mut model = crate::Model::new();
model.evaluate(&doc);
let state = model.state();
let body = state.body("Body1").unwrap();
assert!(crate::naming::face_names(body).iter().any(|name| name == "F2:side:c1"));
let result = model.result(3).unwrap();
assert!(result.error.is_none(), "{result:?}");
let projected = &state.sketch(3).expect("the saved projection should rebuild").sketch;
assert_eq!(projected.links[0].face_name.as_deref(), Some("F2:side:c1#1"));
assert_eq!(projected.link_curves("j1").len(), 2);
// The edge-on projection of the round wall can retain its saved geometry with a warning.
// The numbered reference must evaluate the same way as the whole face's existing name.
let mut exact_doc = doc.clone();
exact_doc.sketch_mut(3).unwrap().links[0].face_name = Some("F2:side:c1".into());
let mut exact_model = crate::Model::new();
exact_model.evaluate(&exact_doc);
let exact_state = exact_model.state();
let exact = &exact_state.sketch(3).unwrap().sketch;
assert_eq!(result.warning, exact_model.result(3).unwrap().warning);
assert_eq!(projected.links[0].lost, exact.links[0].lost);
assert_eq!(projected.curves, exact.curves);
assert_eq!(projected.points, exact.points);
let saved = model.saved(&doc).expect("the healthy projection should save its model cache");
let mut reopened = crate::format::read(&doc.to_json()).unwrap();
let mut reopened_model = crate::Model::adopt(&reopened, &saved).unwrap();
assert!(reopened_model.state().body("Body1").unwrap().names.origin.is_none());
assert_eq!(reopened_model.state().body("Body1").unwrap().names.cached_construction, Some(2));
let crate::FeatureKind::Sketch { plane, .. } = &mut reopened.feature_mut(3).unwrap().kind else { panic!("projection sketch") };
*plane = crate::PlaneRef::Custom { plane: Plane::YZ.offset(0.1) };
reopened_model.evaluate(&reopened);
assert!(reopened_model.result(3).unwrap().error.is_none(), "{:?}", reopened_model.result(3));
let pick = Vec3::new(-19.87, -2.3, 6.);
assert!(crate::naming::face_on_body(body, "F2:side:c1#1", pick).is_none(), "ordinary lookup stays strict");
let mut split = body.clone();
let mut names = crate::naming::face_names(body).as_ref().clone();
*names.iter_mut().find(|name| name.as_str() != "F2:side:c1").unwrap() = "F2:side:c1#2#[wall]".into();
let origin = split.names.origin.clone();
split.names = crate::naming::NameCell::known(Arc::new(names));
split.names.origin = origin;
assert!(crate::naming::face_on_body(&split, "F2:side:c1#1", pick).is_none());
assert!(crate::name_lookup::locate_projected_face(&split, "F2:side:c1#1", pick).is_none(), "another piece still exists");
let mut outside = doc.sketch(3).unwrap().clone();
outside.links[0].source = LinkSource::Face { body: "Body1".into(), at: Vec3::new(-19.87, -2.3, 12.) };
let error = crate::project::refresh_links(&doc, &BTreeMap::new(), &state, &Plane::YZ, &mut outside).unwrap_err();
assert!(matches!(&error, crate::DocError::Reselect { reference, .. } if reference == "F2:side:c1#1"), "{error}");
}
#[test]
fn numbered_projection_refuses_modified_or_moved_cached_sources() {
for (kind, pick) in [
(serde_json::json!({"type": "shell", "body": "Source", "faces": [[10, 10, 10]], "thickness": "1"}), Vec3::new(0., 5., 5.)),
(serde_json::json!({"type": "move", "bodies": ["Source"], "translate": ["1", "0", "0"]}), Vec3::new(1., 5., 5.)),
] {
let mut doc = Document::default();
let source = doc
.add_feature(
serde_json::from_value(serde_json::json!({
"type": "box", "corner": [0, 0, 0], "length": "20", "width": "20", "height": "10"
}))
.unwrap(),
None,
)
.unwrap();
doc.feature_mut(source).unwrap().body_names = vec!["Source".into()];
doc.add_feature(serde_json::from_value(kind).unwrap(), None).unwrap();
let mut model = crate::Model::new();
model.evaluate(&doc);
assert!(model.results.iter().all(|result| result.error.is_none()));
let saved = model.saved(&doc).unwrap();
let reopened = crate::format::read(&doc.to_json()).unwrap();
let cached = crate::Model::adopt(&reopened, &saved).unwrap();
let state = cached.state();
let body = state.body("Source").unwrap();
let whole = format!("F{source}:-x");
let numbered = format!("{whole}#1");
assert!(crate::naming::face_on_body(body, &whole, pick).is_some());
assert!(crate::naming::face_on_body(body, &numbered, pick).is_none());
assert!(body.names.origin.is_none());
assert_eq!(body.names.cached_construction, None);
assert!(crate::name_lookup::locate_projected_face(body, &numbered, pick).is_none());
}
}
#[test]
fn numbered_projection_refuses_a_pick_inside_a_hole_in_the_named_face() {
let mut doc = Document::default();
let mut sketch = Sketch::new();
sketch.add_circle(Vec2::ZERO, 10., Some(0), Some("c1")).unwrap();
sketch.add_circle(Vec2::ZERO, 2., Some(0), Some("c2")).unwrap();
let profile = doc.add_feature(crate::FeatureKind::Sketch { plane: crate::PlaneRef::Origin { name: "XY".into() }, sketch }, None).unwrap();
let kind = serde_json::from_value(serde_json::json!({
"type": "extrude", "sketch": profile, "profiles": {"type": "curves", "loops": [["c1"]]}, "extent": {"distance": "5"}
}))
.unwrap();
let feature = doc.add_feature(kind, None).unwrap();
let mut model = crate::Model::new();
model.evaluate(&doc);
let state = model.state();
let body = state.body("Body1").unwrap();
let whole = format!("F{feature}:top");
let top = crate::naming::face_names(body).iter().position(|name| name == &whole).unwrap();
let numbered = format!("{whole}#1");
let pick = |x| crate::name_lookup::locate_projected_face(body, &numbered, Vec3::new(x, 0., 5.));
assert_eq!(pick(5.).map(|(index, _)| index), Some(top));
assert!(pick(0.).is_none(), "the pick is on the plane but inside the hole");
}
+5 -2
View File
@@ -41,6 +41,9 @@ pub struct NamingOrigin {
#[derive(Clone, Debug, Default)]
pub struct NameCell {
pub origin: Option<Arc<NamingOrigin>>,
/// Direct construction verified from identical cached body/name cells during adoption.
/// Used only by manual Project compatibility, independently of general naming history.
pub(crate) cached_construction: Option<u64>,
/// What the body's faces came from, when the feature that made it reports it.
lineage: Option<Arc<Lineage>>,
names: Arc<OnceLock<Arc<Names>>>,
@@ -57,7 +60,7 @@ impl NameCell {
}
/// Names of a body made by `origin`'s feature, following `lineage` where it is known.
pub(crate) fn traced(origin: Option<Arc<NamingOrigin>>, lineage: Option<Arc<Lineage>>) -> Self {
NameCell { origin, lineage, names: Arc::new(OnceLock::new()), copy_of: None, saved_depth: None }
NameCell { origin, cached_construction: None, lineage, names: Arc::new(OnceLock::new()), copy_of: None, saved_depth: None }
}
/// Names already known, taken as they are.
pub fn known(names: Arc<Vec<String>>) -> Self {
@@ -98,7 +101,7 @@ impl NameCell {
fn shared(names: Arc<Names>) -> Self {
let cell = OnceLock::new();
let _ = cell.set(names);
NameCell { origin: None, lineage: None, names: Arc::new(cell), copy_of: None, saved_depth: None }
NameCell { origin: None, cached_construction: None, lineage: None, names: Arc::new(cell), copy_of: None, saved_depth: None }
}
}
+530
View File
@@ -0,0 +1,530 @@
//! A design a newer SolidCraft saved: it opens, with a warning, and saving it loses nothing.
//!
//! A newer format number, or a change the file names that this build doesn't have, says a newer
//! build saved the file. It may use nothing this build lacks, so it is read as usual. When part of
//! it can't be read, that part stays out of the way and the rest opens:
//! - a feature this build can't read keeps its place on the timeline as
//! [`FeatureKind::NewerFileFeature`](crate::FeatureKind::NewerFileFeature), which reports an error when evaluated;
//! - a parameter it can't read is left out;
//! - any other top-level section it can't read is left out whole;
//! - a field it doesn't know, which typed reading would drop, is noticed by comparing the file
//! with what was read.
//!
//! All of these are named in [`NewerFile::not_understood`] and go back into the file when it is
//! saved ([`restore`]), as they came. Saving keeps the file's own format number and change list:
//! the file still holds what the newer build wrote, and a lower number would make that build
//! upgrade its own data as if it were old. What can't be put back because the design changed around
//! it ([`not_kept`]) is said in the reply to the save.
use std::collections::BTreeMap;
use std::sync::Arc;
use serde::{Deserialize, Serialize};
use serde_json::{Map, Value, json};
use crate::format::{self, DESIGN, Newer};
use crate::{DocError, Document, Result};
/// How a [`RawFeature`] is written while it is inside this build; [`restore`] unwraps it.
const FOREIGN_TAG: &str = "newer_file_feature";
/// Sections a design can't open without: filled in when the file's can't be read.
const CORE: [&str; 3] = ["name", "params", "features"];
/// The most sections left out one at a time to find the one a design can't be read with.
const MAX_SECTION_TRIES: usize = 64;
/// Fields a design container adds beside what a design holds; not unknown to this build.
const CONTAINER_ONLY: [&str; 5] = ["step_blob", "mesh_blob", "image_blob", "points_blob", "hdr_blob"];
/// A feature as a newer build wrote it.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct RawFeature(pub Box<Value>);
impl RawFeature {
/// The kind of feature it says it is.
pub fn kind(&self) -> &str {
self.0.get("type").and_then(Value::as_str).unwrap_or("unnamed")
}
/// Why it doesn't build here.
pub fn why(&self) -> String {
format!("saved by a newer SolidCraft: this version can't read a `{}` feature. Update SolidCraft to build it; saving keeps it", self.kind())
}
}
/// What the file says and holds that this build doesn't read.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct NewerFile {
/// The number the file says.
pub format: u32,
/// The number this build reads up to.
pub reads_up_to: u32,
/// The changes the file names that this build doesn't have.
pub unknown_changes: Vec<String>,
/// What this build couldn't read, by name.
pub not_understood: Vec<String>,
/// Fields known records lost in typed reading.
kept: Option<Kept>,
/// Top-level sections left out whole.
sections: Vec<Section>,
/// Elements left out of a top-level list: its key and the element.
elements: Vec<(String, Value)>,
/// The parts of a design container this build has no use for: name and bytes. A blob only one
/// of the kept pieces refers to is one of them.
pub parts: Vec<(String, Arc<[u8]>)>,
/// The file's `container.json`, when this build doesn't know what it says.
pub container: Option<Value>,
}
#[derive(Clone, Debug, PartialEq)]
struct Section {
key: String,
value: Value,
/// This build's record of the section, without the file's: while it is unchanged, the file's
/// goes back.
empty: Option<Value>,
}
/// The fields of a record that typed reading dropped.
#[derive(Clone, Debug, PartialEq)]
enum Kept {
Field(Value),
Fields(BTreeMap<String, Kept>),
Items(Vec<(Anchor, Kept)>),
}
/// Which element of a list some kept fields belong to.
#[derive(Clone, Debug, PartialEq)]
enum Anchor {
Id(u64),
Name(String),
/// Its place, good only while the list keeps its length.
Index {
at: usize,
of: usize,
},
}
impl NewerFile {
/// What to tell the user, whatever else is said.
pub fn notice(&self) -> String {
let reads = self.reads_up_to;
let format = self.format;
match self.unknown_changes.first() {
Some(change) if format <= reads => {
format!(
"Saved by a newer SolidCraft (format {format} with `{change}`, which this version doesn't know). If something's missing, update."
)
}
_ => format!("Saved by a newer SolidCraft (format {format}, this version reads up to {reads}). If something's missing, update."),
}
}
/// Every line to report: the notice, then what couldn't be read, by name.
pub fn warnings(&self) -> Vec<String> {
let unread = self.not_understood.iter().map(|what| format!("Not read: {what}. Saving keeps it."));
std::iter::once(self.notice()).chain(unread).collect()
}
/// What a reply says about it.
pub fn report(&self) -> Value {
json!({
"format": self.format,
"reads_up_to": self.reads_up_to,
"unknown_changes": self.unknown_changes,
"not_understood": self.not_understood,
"notice": self.notice(),
})
}
/// Whether the next save needs a container to keep what the file holds: plain JSON has no room
/// for parts beside the design.
pub fn needs_container(&self) -> bool {
!self.parts.is_empty()
}
/// Whether anything kept back names this text (a blob's name in a container).
pub fn mentions(&self, text: &str) -> bool {
fn value(v: &Value, text: &str) -> bool {
match v {
Value::String(s) => s == text,
Value::Array(a) => a.iter().any(|x| value(x, text)),
Value::Object(o) => o.values().any(|x| value(x, text)),
_ => false,
}
}
fn kept(k: &Kept, text: &str) -> bool {
match k {
Kept::Field(v) => value(v, text),
Kept::Fields(m) => m.values().any(|x| kept(x, text)),
Kept::Items(l) => l.iter().any(|(_, x)| kept(x, text)),
}
}
self.kept.as_ref().is_some_and(|k| kept(k, text))
|| self.sections.iter().any(|s| value(&s.value, text))
|| self.elements.iter().any(|(_, v)| value(v, text))
}
/// Say that a section the container reader couldn't finish reading is left out.
/// `empty` is what the design writes for the section while it holds nothing, if anything.
pub fn keep_section(&mut self, key: &str, value: Value, empty: Option<Value>, why: &str) {
self.not_understood.push(format!("section `{key}` ({why})"));
self.sections.push(Section { key: key.into(), value, empty });
}
}
/// Read a design a newer build saved, or say why it truly can't be read.
pub(crate) fn read(mut raw: Value, version: u32, applied: Option<Vec<String>>, newer: Newer) -> Result<Document> {
let applied_names = applied.as_deref();
let mut file =
NewerFile { format: newer.format, reads_up_to: newer.reads_up_to, unknown_changes: newer.unknown_changes.clone(), ..NewerFile::default() };
let (mut doc, read_as) = match format::decode(raw.clone(), version, applied_names) {
Ok(doc) => (doc, raw),
Err(_) => {
let mut foreign = BTreeMap::new();
let mut doc = salvage(&mut raw, version, applied_names, &mut file, &mut foreign).map_err(|why| {
DocError::Invalid(format!(
"this design was saved by a newer SolidCraft (format {}, this version reads up to {}) and this version can't read it: {why}. Update SolidCraft to open it",
newer.format, newer.reads_up_to
))
})?;
fill_foreign(&mut doc, foreign);
(doc, raw)
}
};
let mut upgraded = read_as;
// Compared with what was read, the file's own shape after the same upgrade.
DESIGN.upgrade(&mut upgraded, version, applied_names)?;
let known = serde_json::to_value(&doc).map_err(|e| DocError::Invalid(format!("design file: {e}")))?;
let mut paths = Vec::new();
file.kept = vanished(&upgraded, &known, "", &mut paths);
file.not_understood.extend(paths);
for section in &mut file.sections {
section.empty = known.get(&section.key).cloned();
}
if newer.format > newer.reads_up_to {
// The file's own number and list: it still holds what that build wrote.
doc.format = DESIGN.format_string(newer.format);
doc.format_pending = applied.unwrap_or_default();
} else {
// Upgraded to this build's format; the changes it doesn't know are still in it.
doc.format_pending.extend(newer.unknown_changes.iter().cloned());
}
doc.newer_file = Some(Arc::new(file));
Ok(doc)
}
/// Read the design around what can't be read, which moves to `file`. `raw` ends as what was read.
fn salvage(
raw: &mut Value,
version: u32,
applied: Option<&[String]>,
file: &mut NewerFile,
foreign: &mut BTreeMap<u64, Value>,
) -> std::result::Result<Document, String> {
let piece = |key: &str, value: &Value| {
let mut stub = json!({"name": "", "params": [], "features": []});
stub[key] = value.clone();
format::check_piece(stub, version, applied)
};
let Some(top) = raw.as_object_mut() else { return Err("expected a JSON object".into()) };
// A feature it can't read keeps its place; a parameter it can't read stays out.
if let Some(Value::Array(features)) = top.get_mut("features") {
let mut free = features.iter().filter_map(|f| f.get("id").and_then(Value::as_u64)).max().unwrap_or(0).saturating_add(1);
for feature in features.iter_mut() {
if let Err(why) = piece("features", &json!([feature])) {
file.not_understood.push(feature_note(feature, &why.to_string()));
*feature = wrapped(std::mem::take(feature), &mut free, foreign);
}
}
}
if let Some(Value::Array(params)) = top.get_mut("params") {
params.retain(|param| match piece("params", &json!([param])) {
Ok(()) => true,
Err(why) => {
let name = param.get("name").and_then(Value::as_str).unwrap_or("unnamed");
file.not_understood.push(format!("parameter `{name}` ({})", short(&why.to_string())));
file.elements.push(("params".into(), param.clone()));
false
}
});
}
// Any other section, by itself.
let keys: Vec<String> = top.keys().cloned().collect();
for key in &keys {
let value = top.get(key).cloned().unwrap_or_default();
if let Err(why) = piece(key, &value) {
move_out(top, key, &why.to_string(), file);
}
}
if !top.get("name").is_some_and(Value::is_string) {
top.insert("name".into(), json!("Untitled"));
}
for key in ["params", "features"] {
top.entry(key).or_insert_with(|| json!([]));
}
let attempt = |top: &Map<String, Value>| format::decode(Value::Object(top.clone()), version, applied);
let first = match attempt(top) {
Ok(doc) => return Ok(doc),
Err(why) => why,
};
// Sections that are fine by themselves but not together with the rest.
let keys: Vec<String> = top.keys().filter(|k| !CORE.contains(&k.as_str())).cloned().collect();
// Each try reads the whole design: a file of many sections goes straight to the last resort.
for key in keys.iter().filter(|_| keys.len() <= MAX_SECTION_TRIES) {
let mut without = top.clone();
without.remove(key);
if let Ok(doc) = attempt(&without) {
move_out(top, key, &first.to_string(), file);
return Ok(doc);
}
}
let mut bare = top.clone();
bare.retain(|key, _| CORE.contains(&key.as_str()));
match attempt(&bare) {
Ok(doc) => {
for key in &keys {
move_out(top, key, &first.to_string(), file);
}
Ok(doc)
}
Err(_) => Err(first.to_string()),
}
}
/// Leave a section out and keep it. A section the design needs is left empty.
fn move_out(top: &mut Map<String, Value>, key: &str, why: &str, file: &mut NewerFile) {
let Some(value) = top.remove(key) else { return };
file.not_understood.push(format!("section `{key}` ({})", short(why)));
file.sections.push(Section { key: key.into(), value, empty: None });
}
/// The first line of a reader's error, without the list of every kind it knows.
fn short(why: &str) -> &str {
let why = why.split(", expected").next().unwrap_or(why);
why.strip_prefix("design file: ").unwrap_or(why)
}
fn feature_note(feature: &Value, why: &str) -> String {
let name = feature.get("name").and_then(Value::as_str).unwrap_or("unnamed");
let kind = feature.get("type").and_then(Value::as_str).unwrap_or("unnamed");
let why = short(why);
if why.starts_with("unknown variant") {
format!("feature `{name}`, a `{kind}` feature this version doesn't know")
} else {
format!("feature `{name}`, a `{kind}` feature ({why})")
}
}
/// A feature this build can't read as this build reads it: the fields every feature has, which stay
/// editable. Its `raw` is filled in after reading ([`fill_foreign`]), so nothing in a feature this
/// build can't read is judged by this build's rules. `free` gives an id to one the file left
/// without.
fn wrapped(raw: Value, free: &mut u64, foreign: &mut BTreeMap<u64, Value>) -> Value {
let id = raw.get("id").and_then(Value::as_u64).unwrap_or_else(|| {
let id = *free;
*free = free.saturating_add(1);
id
});
let name = raw.get("name").and_then(Value::as_str).unwrap_or("Unknown feature").to_string();
let suppressed = raw.get("suppressed").and_then(Value::as_bool).unwrap_or(false);
let component = raw.get("component").and_then(Value::as_u64).unwrap_or(0);
foreign.insert(id, raw);
json!({"id": id, "name": name, "suppressed": suppressed, "component": component, "type": FOREIGN_TAG, "raw": null})
}
/// Give the features [`wrapped`] left without one what the file said.
fn fill_foreign(doc: &mut Document, mut foreign: BTreeMap<u64, Value>) {
for feature in &mut doc.features {
if let crate::FeatureKind::NewerFileFeature { raw } = &mut feature.kind
&& let Some(value) = foreign.remove(&feature.id)
{
raw.0 = Box::new(value);
}
}
}
/// A feature back as the file had it, with the changes this build can make to any feature.
fn unwrapped(feature: &mut Value) {
let Some(wrapper) = feature.as_object_mut() else { return };
let Some(Value::Object(mut raw)) = wrapper.remove("raw") else { return };
for key in ["id", "name", "suppressed", "component"] {
match wrapper.get(key) {
// Left out as a writer leaves it out, unless the file said it.
Some(v) if key != "id" && !raw.contains_key(key) && looks_default(v) => {}
Some(v) => {
raw.insert(key.into(), v.clone());
}
None => {
raw.remove(key);
}
}
}
*feature = Value::Object(raw);
}
/// A value a writer leaves out without losing anything: not worth telling anyone about.
fn looks_default(v: &Value) -> bool {
match v {
Value::Null => true,
Value::Bool(b) => !b,
Value::Number(n) => n.as_f64() == Some(0.0),
Value::String(s) => s.is_empty(),
Value::Array(a) => a.is_empty(),
Value::Object(o) => o.is_empty(),
}
}
/// What `raw` has that `known`, what was read of it, doesn't. `paths` gets those fields' names.
fn vanished(raw: &Value, known: &Value, path: &str, paths: &mut Vec<String>) -> Option<Kept> {
match (raw, known) {
(Value::Object(raw), Value::Object(known)) => {
if known.get("type").and_then(Value::as_str) == Some(FOREIGN_TAG) {
return None;
}
let mut kept = BTreeMap::new();
for (key, value) in raw {
if CONTAINER_ONLY.contains(&key.as_str()) || (path.is_empty() && matches!(key.as_str(), "format" | "format_pending")) {
continue;
}
let inner = if path.is_empty() { key.clone() } else { format!("{path}.{key}") };
match known.get(key) {
None => {
if !looks_default(value) {
paths.push(format!("field `{inner}`"));
}
kept.insert(key.clone(), Kept::Field(value.clone()));
}
Some(known) => {
if let Some(k) = vanished(value, known, &inner, paths) {
kept.insert(key.clone(), k);
}
}
}
}
(!kept.is_empty()).then_some(Kept::Fields(kept))
}
(Value::Array(raw), Value::Array(known)) => {
let mut items = Vec::new();
for (at, element) in raw.iter().enumerate() {
let anchor = anchor_of(element).unwrap_or(Anchor::Index { at, of: raw.len() });
let Some(partner) = find(known, &anchor) else { continue };
let label = match (element.get("name").and_then(Value::as_str), &anchor) {
(Some(name), _) => format!("{path}[{name}]"),
(None, Anchor::Id(id)) => format!("{path}[{id}]"),
_ => format!("{path}[{at}]"),
};
if let Some(k) = vanished(element, partner, &label, paths) {
items.push((anchor, k));
}
}
(!items.is_empty()).then_some(Kept::Items(items))
}
_ => None,
}
}
fn anchor_of(element: &Value) -> Option<Anchor> {
if let Some(id) = element.get("id").and_then(Value::as_u64) {
return Some(Anchor::Id(id));
}
element.get("name").and_then(Value::as_str).map(|name| Anchor::Name(name.to_string()))
}
fn find<'a>(list: &'a [Value], anchor: &Anchor) -> Option<&'a Value> {
match anchor {
Anchor::Id(id) => list.iter().find(|x| x.get("id").and_then(Value::as_u64) == Some(*id)),
Anchor::Name(name) => list.iter().find(|x| x.get("name").and_then(Value::as_str) == Some(name)),
Anchor::Index { at, of } => (list.len() == *of).then(|| list.get(*at)).flatten(),
}
}
fn find_mut<'a>(list: &'a mut [Value], anchor: &Anchor) -> Option<&'a mut Value> {
match anchor {
Anchor::Id(id) => list.iter_mut().find(|x| x.get("id").and_then(Value::as_u64) == Some(*id)),
Anchor::Name(name) => list.iter_mut().find(|x| x.get("name").and_then(Value::as_str) == Some(name)),
Anchor::Index { at, of } => (list.len() == *of).then(|| list.get_mut(*at)).flatten(),
}
}
/// Put the kept fields back. An element that is gone was deleted here, its fields with it; one
/// whose place can't be told any more, and a field whose record is gone, go into `lost`.
fn apply(kept: &Kept, value: &mut Value, path: &str, lost: &mut Vec<String>) {
match kept {
Kept::Field(_) => {}
Kept::Fields(fields) => {
let Some(object) = value.as_object_mut() else {
lost.push(format!("field `{path}`"));
return;
};
for (key, sub) in fields {
let inner = if path.is_empty() { key.clone() } else { format!("{path}.{key}") };
match (sub, object.get_mut(key)) {
(Kept::Field(v), None) => {
object.insert(key.clone(), v.clone());
}
(Kept::Field(_), Some(_)) => {}
(sub, Some(inner_value)) => apply(sub, inner_value, &inner, lost),
// The list it was in is empty and not written: its elements were deleted.
(Kept::Items(_), None) => {}
(_, None) => lost.push(format!("field `{inner}`")),
}
}
}
Kept::Items(items) => {
let Some(list) = value.as_array_mut() else {
lost.push(format!("field `{path}`"));
return;
};
for (anchor, sub) in items {
match (find_mut(list, anchor), anchor) {
(Some(element), _) => apply(sub, element, path, lost),
(None, Anchor::Index { at, .. }) => lost.push(format!("element {at} of `{path}`")),
(None, _) => {}
}
}
}
}
}
/// Write back what the design holds of the file a newer build saved, into `value`, the design's
/// JSON. Returns what couldn't go back ([`not_kept`]).
pub fn restore(doc: &Document, value: &mut Value) -> Vec<String> {
let mut lost = Vec::new();
let Some(file) = &doc.newer_file else { return lost };
if let Some(Value::Array(features)) = value.get_mut("features") {
for feature in features.iter_mut().filter(|f| f.get("type").and_then(Value::as_str) == Some(FOREIGN_TAG)) {
unwrapped(feature);
}
}
if let Some(kept) = &file.kept {
apply(kept, value, "", &mut lost);
}
if let Some(top) = value.as_object_mut() {
for section in &file.sections {
if top.get(&section.key) == section.empty.as_ref() {
top.insert(section.key.clone(), section.value.clone());
} else {
lost.push(format!("section `{}`, replaced by what was edited here", section.key));
}
}
for (key, element) in &file.elements {
let name = element.get("name");
match top.entry(key.clone()).or_insert_with(|| json!([])) {
Value::Array(list) if name.is_none() || !list.iter().any(|x| x.get("name") == name) => list.push(element.clone()),
_ => lost.push(format!("`{key}` element {}, replaced by what was made here", name.and_then(Value::as_str).unwrap_or("unnamed"))),
}
}
}
lost
}
/// What of the file a newer build saved the next save can't keep, because the design was changed
/// around it. Empty almost always.
pub fn not_kept(doc: &Document) -> Vec<String> {
let Ok(mut value) = serde_json::to_value(doc) else { return Vec::new() };
restore(doc, &mut value)
}
#[cfg(test)]
#[path = "newer_file_tests.rs"]
mod tests;
+236
View File
@@ -0,0 +1,236 @@
//! Designs a newer SolidCraft saved: they open, say so, and saving loses nothing.
use serde_json::{Value, json};
use crate::format::{DESIGN, FORMAT, format_string};
use crate::{Document, FeatureKind, Model, PlaneRef};
/// A real design: a sketched disc and its extrusion, and a parameter.
fn design() -> Document {
use solidcraft_sketch::Sketch;
let mut d = Document::new("Plate");
d.set_param("depth", "5 mm", Some("mm"), None).unwrap();
let mut sketch = Sketch::new();
sketch.add_circle(solidcore_record::Vec2::new(0.0, 0.0), 10.0, None, None).unwrap();
let base = d.add_feature(FeatureKind::Sketch { plane: PlaneRef::Origin { name: "XY".into() }, sketch }, Some("Base")).unwrap();
d.add_feature(extrude(base), Some("Pad")).unwrap();
d
}
fn extrude(sketch: u64) -> FeatureKind {
FeatureKind::Extrude {
thin: None,
sketch: crate::SketchId(sketch),
profiles: crate::ProfileSel::All,
extent: serde_json::from_value(json!({"distance": "depth"})).unwrap(),
operation: crate::Operation::NewBody,
targets: vec![],
}
}
fn saved(d: &Document) -> Value {
serde_json::from_str(&d.to_json()).unwrap()
}
/// `(body name, volume)` of everything the design builds, and the error of each feature.
fn built(d: &Document) -> (Vec<(String, f64)>, Vec<Option<String>>) {
let mut model = Model::default();
model.evaluate(d);
let bodies = model.state().bodies.iter().map(|b| (b.name.clone(), b.body.volume_at(0.01).unwrap())).collect();
(bodies, model.results.iter().map(|r| r.error.clone()).collect())
}
fn newer() -> String {
format_string(FORMAT + 1)
}
#[test]
fn one_format_newer_with_nothing_unknown_opens_with_the_same_bodies() {
let original = design();
let mut file = saved(&original);
file["format"] = json!(newer());
let opened = Document::from_json(&file.to_string()).unwrap();
let (bodies, errors) = built(&opened);
assert_eq!((bodies.clone(), errors), built(&original));
assert_eq!(bodies.len(), 1);
assert_eq!(opened.features, original.features);
let notice = opened.newer_file.as_ref().unwrap().notice();
assert_eq!(
notice,
format!("Saved by a newer SolidCraft (format {}, this version reads up to {FORMAT}). If something's missing, update.", FORMAT + 1)
);
assert!(opened.newer_file.as_ref().unwrap().not_understood.is_empty());
// Saved, it still says what it is; read again, the same.
let again = saved(&opened);
assert_eq!(again["format"], json!(newer()));
assert_eq!(Document::from_json(&opened.to_json()).unwrap(), opened);
}
#[test]
fn an_unknown_change_opens_with_a_warning_and_stays_on_the_file() {
let original = design();
let mut file = saved(&original);
file["format_pending"] = json!(["a-later-change"]);
let opened = Document::from_json(&file.to_string()).unwrap();
let report = opened.newer_file.as_ref().unwrap();
assert_eq!(report.unknown_changes, ["a-later-change"]);
assert!(report.notice().contains("a-later-change") && report.notice().starts_with("Saved by a newer SolidCraft"), "{}", report.notice());
assert_eq!(built(&opened), built(&original));
let again = saved(&opened);
assert_eq!(again["format"], json!(format_string(FORMAT)));
assert!(again["format_pending"].as_array().unwrap().contains(&json!("a-later-change")));
assert_eq!(Document::from_json(&opened.to_json()).unwrap(), opened);
}
/// The file, with a feature of a kind this build doesn't have between the sketch and the pad.
fn with_unknown_feature() -> Value {
let mut file = saved(&design());
file["format"] = json!(newer());
file["format_pending"] = json!(["a-later-change"]);
let future = json!({"id": 900, "name": "Lattice1", "type": "gyroid_lattice", "cell": 2.5, "nested": {"big": 1e300}, "suppressed": false});
file["features"].as_array_mut().unwrap().insert(1, future);
file
}
#[test]
fn an_unknown_feature_kind_opens_the_rest_and_reports_that_feature() {
let file = with_unknown_feature();
let opened = Document::from_json(&file.to_string()).unwrap();
let report = opened.newer_file.as_ref().unwrap();
assert!(report.not_understood.iter().any(|what| what.contains("Lattice1") && what.contains("gyroid_lattice")), "{:?}", report.not_understood);
assert_eq!(opened.features.len(), 3);
assert!(matches!(&opened.features[1].kind, FeatureKind::NewerFileFeature { raw } if raw.kind() == "gyroid_lattice"));
let (bodies, errors) = built(&opened);
assert_eq!(bodies.len(), 1, "the pad after it still builds");
assert!(errors[0].is_none() && errors[2].is_none(), "{errors:?}");
let why = errors[1].as_deref().unwrap();
assert!(why.contains("newer SolidCraft") && why.contains("gyroid_lattice"), "{why}");
}
#[test]
fn saving_keeps_an_unknown_feature_as_the_file_had_it_and_the_files_number() {
let file = with_unknown_feature();
let opened = Document::from_json(&file.to_string()).unwrap();
let again = saved(&opened);
assert_eq!(again["format"], file["format"], "never a lower number");
assert_eq!(again["format_pending"], file["format_pending"]);
assert_eq!(again["features"][1], file["features"][1], "the feature as the file had it");
assert_eq!(
again["features"].as_array().unwrap().iter().map(|f| f["type"].clone()).collect::<Vec<_>>(),
[json!("sketch"), json!("gyroid_lattice"), json!("extrude")]
);
assert_eq!(Document::from_json(&opened.to_json()).unwrap(), opened, "saved and read again, the same");
// A rename here goes with it; the rest stays.
let mut renamed = opened.clone();
renamed.features[1].name = "Infill".into();
let again = saved(&renamed);
assert_eq!(again["features"][1]["name"], "Infill");
assert_eq!(again["features"][1]["nested"], json!({"big": 1e300}));
}
#[test]
fn saving_keeps_fields_and_sections_this_version_doesnt_know() {
let mut file = saved(&design());
file["format"] = json!(newer());
file["future_section"] = json!({"anything": [1, 2, 3]});
file["features"][1]["draft_v2"] = json!({"angle": 3.0});
file["params"][0]["future_note"] = json!("keep me");
let opened = Document::from_json(&file.to_string()).unwrap();
assert_eq!(built(&opened).0.len(), 1);
let report = opened.newer_file.as_ref().unwrap();
for field in ["future_section", "draft_v2", "future_note"] {
assert!(report.not_understood.iter().any(|what| what.contains(field)), "{field}: {:?}", report.not_understood);
}
let again = saved(&opened);
assert_eq!(again["future_section"], file["future_section"]);
assert_eq!(again["features"][1]["draft_v2"], file["features"][1]["draft_v2"]);
assert_eq!(again["params"][0]["future_note"], "keep me");
// They follow their records when the design changes around them.
let mut changed = opened.clone();
let id = changed.features[1].id;
changed.features.insert(0, changed.features[0].clone());
changed.features[0].id = 777;
assert_eq!(changed.feature(id).unwrap().name, "Pad");
let again = saved(&changed);
assert_eq!(again["features"][2]["draft_v2"], file["features"][1]["draft_v2"]);
assert!(crate::newer_file::not_kept(&changed).is_empty());
}
#[test]
fn a_section_that_doesnt_read_is_left_out_named_and_kept() {
let mut file = saved(&design());
file["format"] = json!(newer());
file["configs"] = json!({"columns": [{"unknown_future_column": "Body"}], "rules": {"unknown_future_rule": true}});
let opened = Document::from_json(&file.to_string()).unwrap();
assert_eq!(built(&opened).0.len(), 1);
let report = opened.newer_file.as_ref().unwrap();
assert!(report.not_understood.iter().any(|what| what.contains("configs")), "{:?}", report.not_understood);
assert_eq!(saved(&opened)["configs"], file["configs"]);
assert!(crate::newer_file::not_kept(&opened).is_empty());
}
#[test]
fn a_parameter_that_doesnt_read_is_left_out_named_and_kept() {
let mut file = saved(&design());
file["format"] = json!(newer());
file["params"].as_array_mut().unwrap().push(json!({"name": "future", "expression": {"kind": "table"}}));
let opened = Document::from_json(&file.to_string()).unwrap();
assert_eq!(built(&opened).0.len(), 1);
assert!(opened.newer_file.as_ref().unwrap().not_understood.iter().any(|what| what.contains("`future`")));
let names: Vec<_> = saved(&opened)["params"].as_array().unwrap().iter().map(|p| p["name"].clone()).collect();
assert!(names.contains(&json!("future")) && names.contains(&json!("depth")), "{names:?}");
}
#[test]
fn what_cant_go_back_after_an_edit_is_said() {
let mut file = saved(&design());
file["format"] = json!(newer());
file["configs"] = json!({"columns": [{"unknown_future_column": "Body"}]});
let opened = Document::from_json(&file.to_string()).unwrap();
assert!(crate::newer_file::not_kept(&opened).is_empty());
let mut edited = opened.clone();
edited.favorites.insert("depth".into());
assert!(crate::newer_file::not_kept(&edited).is_empty(), "an edit elsewhere costs nothing");
let baseline: Value = saved(&edited);
assert_eq!(baseline["configs"], file["configs"]);
}
#[test]
fn a_feature_this_version_reads_wrongly_is_kept_whole() {
// A kind this build has, in a shape it doesn't: the feature can't read, and is not guessed at.
let mut file = saved(&design());
file["format"] = json!(newer());
file["features"][1]["operation"] = json!("weave");
let opened = Document::from_json(&file.to_string()).unwrap();
assert!(matches!(&opened.features[1].kind, FeatureKind::NewerFileFeature { raw } if raw.kind() == "extrude"));
assert!(built(&opened).1[1].as_deref().unwrap().contains("newer SolidCraft"));
assert_eq!(saved(&opened)["features"][1], file["features"][1]);
}
#[test]
fn what_truly_cant_be_read_says_why() {
for (text, says) in [
("not json", "HDR resource admission"),
("{\"format\":\"solidcraft/0\",\"name\":\"x\"}", "format 0"),
("{\"format\":\"someone-else/9\"}", "not a SolidCraft design (format `someone-else/9`)"),
] {
let why = Document::from_json(text).unwrap_err().to_string();
assert!(why.contains(says), "{text}: {why}");
}
// Two features of one id are damage whatever build saved them.
let mut file = saved(&design());
file["format"] = json!(newer());
let same = file["features"][0].clone();
file["features"].as_array_mut().unwrap().push(same);
let why = Document::from_json(&file.to_string()).unwrap_err().to_string();
assert!(why.contains(&format!("format {}", FORMAT + 1)) && why.contains("can't read it") && why.contains("damaged"), "{why}");
}
#[test]
fn a_file_this_build_fully_knows_is_not_flagged_and_damage_is_still_refused() {
assert!(Document::from_json(&design().to_json()).unwrap().newer_file.is_none());
assert_eq!(DESIGN.newer(FORMAT, None), None);
let mut file = saved(&design());
file["features"][1]["type"] = json!("gyroid_lattice");
assert!(Document::from_json(&file.to_string()).is_err(), "of this build's own format, that is damage");
}
+1
View File
@@ -123,6 +123,7 @@ pub(super) fn local_geometry(f: &Feature, components: &std::collections::HashMap
/// Assembly records do not feed any of the feature kinds accepted by `local_geometry`.
fn same_geometry_inputs(a: &Document, b: &Document) -> bool {
let Document {
newer_file: _,
render,
format,
format_pending,
+10 -2
View File
@@ -1034,8 +1034,16 @@ fn refresh_links_in(
if !l.auto_face
&& let (Some(name), LinkSource::Face { body, at }) = (&l.face_name, &mut source)
{
let (index, p) =
st.body(body).and_then(|target| crate::naming::face_on_body(target, name, *at)).ok_or_else(|| DocError::reselect(name.as_str()))?;
let (index, p) = st
.body(body)
.and_then(|target| {
if l.kind == LinkKind::Project {
crate::name_lookup::locate_projected_face(target, name, *at)
} else {
crate::naming::face_on_body(target, name, *at)
}
})
.ok_or_else(|| DocError::reselect(name.as_str()))?;
*at = p;
named_face = Some((body.clone(), index, p));
}
+140 -6
View File
@@ -451,6 +451,9 @@ pub struct RuleValues {
pub angle_display: AngleDisplay,
}
/// A sheet rule's thickness is less than this (mm).
const MAX_SHEET_THICKNESS: f64 = 1e4;
impl Document {
/// A rule by name, the active one, or the default steel rule.
pub fn sheet_rule(&self, name: Option<&str>) -> SheetRule {
@@ -474,8 +477,8 @@ impl Document {
Some(t) => t,
None => expr::eval_with(&r.thickness, &look)?.to_kind(Kind::Length)?,
};
if !(t > 0.0 && t < 1e4) {
return Err(DocError::Invalid("the sheet thickness must be positive".into()));
if !(t > 0.0 && t < MAX_SHEET_THICKNESS) {
return Err(DocError::Invalid("the sheet thickness must be more than 0 and less than 10000 mm".into()));
}
let with_t = |e: &str, k: Kind| -> Result<f64> {
let f = |n: &str| if n == "Thickness" && !vals.contains_key("Thickness") { Ok(Value::length(t)) } else { look(n) };
@@ -496,8 +499,12 @@ impl Document {
angle_display: AngleDisplay::parse(&r.angle_display)
.ok_or_else(|| DocError::Invalid(format!("unknown bend angle display `{}` (bend or included)", r.angle_display)))?,
};
if !(0.0..=1.0).contains(&v.k_factor) || v.bend_radius < 0.0 {
return Err(DocError::Invalid("the K-factor must be 0…1 and the bend radius positive".into()));
// Each value named on its own: a sharp bend (radius 0) is allowed (#9625).
if !(0.0..=1.0).contains(&v.k_factor) {
return Err(DocError::Invalid("the K-factor must be between 0 and 1".into()));
}
if !(v.bend_radius >= 0.0) {
return Err(DocError::Invalid("the bend radius must not be negative".into()));
}
Ok(v)
}
@@ -2538,6 +2545,123 @@ impl SheetBody {
.sum()
}
/// Include the physical holes that perforation fields leave out of the B-rep measurement.
/// `placement` maps this sheet's geometry into the measurement's frame. Hole cylinders
/// lie on panels, clear of bends; their volume moments follow each panel's current fold.
/// Bounding boxes and B-rep topology are unchanged by these interior holes.
pub fn correct_perforation_properties(&self, measured: &mut kernel::BodyMeasure, placement: &Mat) -> Result<()> {
let (mut removed, mut area_delta, mut moment_delta) = (0.0, 0.0, Vec3::ZERO);
self.visit_perforation_cylinders(placement, |center, volume, area, _| {
removed += volume;
area_delta += area;
// Use distances from the measured centre, including far-away placements.
moment_delta += (measured.centroid - center) * volume;
})?;
if removed == 0.0 {
return Ok(());
}
let volume = measured.volume - removed;
let area = measured.area + area_delta;
let centroid = measured.centroid + moment_delta / volume;
if !(volume.is_finite() && volume > 0.0 && area.is_finite() && area >= 0.0 && centroid.is_finite()) {
return Err(DocError::Invalid(format!("invalid perforation physical properties for `{}`", self.body)));
}
measured.volume = volume;
measured.area = area;
measured.centroid = centroid;
Ok(())
}
/// Remove the same hole cylinders from the inertia spread as from volume and centroid.
/// The input and output tensors are at unit density, about their respective centroids.
pub fn correct_perforation_mass_properties(&self, measured: &mut solidcraft_geom::MassProperties, placement: &Mat) -> Result<()> {
use solidcraft_geom::inertia;
let (mut removed, mut moment_delta, mut removed_inertia) = (0.0, Vec3::ZERO, [[0.0; 3]; 3]);
self.visit_perforation_cylinders(placement, |center, volume, _, own| {
let delta = measured.centroid - center;
removed += volume;
moment_delta += delta * volume;
let about_center = inertia::shifted(&own, volume, delta);
for (row, hole) in removed_inertia.iter_mut().zip(about_center) {
for (value, h) in row.iter_mut().zip(hole) {
*value += h;
}
}
})?;
if removed == 0.0 {
return Ok(());
}
let volume = measured.volume - removed;
let delta = moment_delta / volume;
let centroid = measured.centroid + delta;
let mut tensor = measured.inertia;
for (row, hole) in tensor.iter_mut().zip(removed_inertia) {
for (value, h) in row.iter_mut().zip(hole) {
*value -= h;
}
}
// Move from the old centre to the new one, reversing the parallel-axis term.
let tensor = inertia::shifted(&tensor, -volume, delta);
if !(volume.is_finite() && volume > 0.0 && centroid.is_finite() && tensor.iter().flatten().all(|v| v.is_finite())) {
return Err(DocError::Invalid(format!("invalid perforation inertia for `{}`", self.body)));
}
measured.volume = volume;
measured.centroid = centroid;
measured.inertia = tensor;
Ok(())
}
/// Analytic cylinders at each panel's current fold, in the requested measurement frame.
fn visit_perforation_cylinders(&self, placement: &Mat, mut visit: impl FnMut(Vec3, f64, f64, solidcraft_geom::inertia::Tensor3)) -> Result<()> {
if self.perforations.is_empty() {
return Ok(());
}
let invalid = || DocError::Invalid(format!("invalid perforation physical properties for `{}`", self.body));
if !(self.t.is_finite() && self.t > 0.0) || placement.iter().flatten().any(|v| !v.is_finite()) {
return Err(invalid());
}
let isometry = |m: &Mat| {
let [x, y, z] = [0, 1, 2].map(|i| Vec3::new(m[i][0], m[i][1], m[i][2]));
m.iter().flatten().all(|v| v.is_finite())
&& m[0][3] == 0.0
&& m[1][3] == 0.0
&& m[2][3] == 0.0
&& m[3][3] == 1.0
&& [x, y, z].iter().all(|a| (a.dot(*a) - 1.0).abs() < 1e-9)
&& x.dot(y).abs() < 1e-9
&& x.dot(z).abs() < 1e-9
&& y.dot(z).abs() < 1e-9
};
let panels: Vec<_> = self.panels().into_iter().map(|(i, region)| (mat_mul(placement, &self.world(i)), region)).collect();
let flat = mat_mul(placement, &self.world(None));
if !isometry(&flat) || panels.iter().any(|(world, _)| !isometry(world)) {
return Err(DocError::Invalid("not supported yet: perforation physical properties under scale or shear".into()));
}
for p in &self.perforations {
if !([p.diameter, p.pitch, p.margin].iter().all(|v| v.is_finite()) && p.diameter > 0.0 && p.pitch > p.diameter && p.margin >= 0.0) {
return Err(invalid());
}
let holes = self.perforation_holes(p)?;
let disk = std::f64::consts::PI * (p.diameter / 2.0).powi(2);
let volume = disk * self.t;
let area_delta = std::f64::consts::PI * p.diameter * self.t - 2.0 * disk;
let radius2 = (p.diameter / 2.0).powi(2);
let transverse = volume * (3.0 * radius2 + self.t * self.t) / 12.0;
let own = [[transverse, 0.0, 0.0], [0.0, transverse, 0.0], [0.0, 0.0, volume * radius2 / 2.0]];
for hole in holes {
let world = if self.flat || panels.len() == 1 {
&flat
} else {
&panels.iter().find(|(_, region)| region.contains(hole)).ok_or_else(invalid)?.0
};
let center = apply_point(world, v3(hole) + Vec3::Z * (self.t / 2.0));
let rotation = [0, 1, 2].map(|i| [0, 1, 2].map(|j| world[j][i]));
visit(center, volume, area_delta, solidcraft_geom::inertia::transformed(&own, &rotation));
}
}
Ok(())
}
/// Topology counted by faces and loops: a round hole is one face bounded by two closed circular
/// edges (one vertex each), where the sewn solid splits it into arcs. Returns the change to
/// the sewn (faces, edges, vertices).
@@ -3537,7 +3661,11 @@ impl SheetBody {
return Err("the gap would cut a panel away".into());
}
}
// The flat pattern must stay one sheet without overlaps.
// The flat pattern must stay one sheet without overlaps: closing must not make the two
// overlap, nor add to what either already overlaps of another flange. A flange can lie
// over another one in the flat away from this corner (the walls on either side of a
// notch's inner corner both unfold into the notch, and a return on one of them lies over
// the other), and the corner is still closed then (#8823).
let [new_a, new_b] = new;
let pieces = |s: &SheetBody, f: &SheetFlange| {
let mut v = vec![corners_of(&s.zone(f))];
@@ -3547,13 +3675,19 @@ impl SheetBody {
v
};
let mine = [pieces(self, &new_a), pieces(self, &new_b)];
let was = [pieces(self, &fa), pieces(self, &fb)];
let overlap = |p: &[Vec<Vec2>], q: &[Vec<Vec2>]| p.iter().any(|a| q.iter().any(|b| pieces_overlap(a, b)));
let shared = |p: &[Vec<Vec2>], q: &[Vec<Vec2>]| p.iter().map(|a| q.iter().map(|b| convex_overlap(a, b)).sum::<f64>()).sum::<f64>();
let perimeter =
|p: &[Vec<Vec2>]| p.iter().flat_map(|c| (0..c.len()).filter_map(move |i| Some(c.get(i)?.dist(*c.get((i + 1) % c.len())?)))).sum::<f64>();
let [mine_a, mine_b] = &mine;
let clash = overlap(mine_a, mine_b)
|| self.flanges.iter().enumerate().any(|(j, g)| {
j != k.a && j != k.b && g.shape.is_none() && {
let other = pieces(self, g);
mine.iter().any(|p| overlap(p, &other))
mine.iter().zip(&was).any(|(p, q)| {
overlap(p, &other) && shared(p, &other) > shared(q, &other) + FLAT_SLIVER * perimeter(p).max(perimeter(&other)).max(1.0)
})
}
});
if clash {
+1
View File
@@ -42,6 +42,7 @@ impl Walk for i8 {}
impl Walk for f64 {}
impl Walk for usize {}
impl Walk for u32 {}
impl Walk for crate::newer_file::RawFeature {}
impl Walk for ProfileSel {}
impl Walk for std::collections::BTreeMap<String, String> {}
impl Walk for crate::frame::Anchor {}
+115 -19
View File
@@ -1,9 +1,9 @@
//! `solidcraft-cli mcp setup` and Help > Connect AI assistants: add a `solidcraft` MCP server entry
//! to the AI clients installed on this machine, using the `solidcraft-cli` path given.
//!
//! The clients' own files are edited in place, not rewritten: only the `solidcraft` entries change,
//! every other byte (other servers, other settings, comments, key order) stays as it was. The file
//! is copied to `<name>.bak` first. A file that cannot be read as JSON (with comments) or TOML is
//! Only the `solidcraft` entries change; every other byte (other servers, other settings, comments,
//! key order) stays as it was. Updates replace the file atomically, keeping the previous version
//! as `<name>.bak`. A file that cannot be read as JSON (with comments) or TOML is
//! left alone, and so is an entry the user changed (its command is not a SolidCraft CLI, or its
//! arguments differ); an entry that only has an old path to the CLI is updated.
//! A client counts as installed when its configuration folder exists; no client program is run.
@@ -606,11 +606,7 @@ fn toml_to_json(t: &toml_edit::Table) -> Value {
/// One client's outcome, a line of the report.
fn configure_file(t: &Target, exe: &str, live: bool, dry_run: bool, mode: Mode) -> Result<(String, Vec<(&'static str, Change)>), String> {
let fail = |e: String| format!("{}: {e}; left unchanged", t.file.display());
let existing = match std::fs::read_to_string(&t.file) {
Ok(s) => Some(s),
Err(e) if e.kind() == std::io::ErrorKind::NotFound => None,
Err(e) => return Err(format!("{}: {e}", t.file.display())),
};
let existing = read_config(&t.file).map_err(|e| format!("{}: {e}", t.file.display()))?;
let mut text = existing.clone().unwrap_or_default();
let changes =
if t.shape == Shape::Codex { edit_toml(&mut text, exe, live, mode) } else { edit_json(&mut text, t.shape, exe, live, mode) }.map_err(fail)?;
@@ -633,20 +629,30 @@ fn configure_file(t: &Target, exe: &str, live: bool, dry_run: bool, mode: Mode)
if !changed {
return done(said);
}
if existing.is_some() {
let mut bak = t.file.clone().into_os_string();
bak.push(".bak");
// The first backup is the user's original: later runs keep it.
if !Path::new(&bak).exists() {
std::fs::copy(&t.file, &bak).map_err(|e| format!("{}: cannot back up: {e}", t.file.display()))?;
}
} else if let Some(dir) = t.file.parent() {
std::fs::create_dir_all(dir).map_err(|e| format!("{}: {e}", dir.display()))?;
}
std::fs::write(&t.file, text).map_err(|e| format!("{}: {e}", t.file.display()))?;
write_config(&t.file, existing.as_deref(), &text).map_err(|e| format!("{}: {e}", t.file.display()))?;
done(format!("{said} ({})", t.file.display()))
}
fn read_config(path: &Path) -> std::io::Result<Option<String>> {
match std::fs::read_to_string(path) {
Ok(text) => Ok(Some(text)),
Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(None),
Err(e) => Err(e),
}
}
/// Refuse a stale edit before writing. Other clients do not share a lock with SolidCraft, so
/// this narrows the race with their writes; it cannot exclude a write after the comparison.
fn write_config(path: &Path, expected: Option<&str>, text: &str) -> std::io::Result<()> {
if let Some(dir) = path.parent() {
std::fs::create_dir_all(dir)?;
}
if read_config(path)?.as_deref() != expected {
return Err(std::io::Error::other("configuration changed during setup; left unchanged, try again"));
}
solidcraft_io::safe_write::write_atomic(path, text.as_bytes(), true)
}
/// Set up every detected client (or `--client NAME`; flags `--dry-run`, `--live`) for the
/// `solidcraft-cli` at `exe`. Returns the result lines, one per client file, and whether every
/// client succeeded.
@@ -842,6 +848,96 @@ mod tests {
assert!(toml.contains("[mcp_servers.other]") && !toml.contains("solidcraft"), "{toml}");
}
fn config_dir(label: &str) -> PathBuf {
let dir = std::env::temp_dir().join(format!("solidcraft-agent-config-{label}-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&dir);
std::fs::create_dir_all(&dir).unwrap();
dir
}
#[test]
fn configuration_backup_tracks_the_file_before_each_change() {
let dir = config_dir("backup");
let target = Target { client: "claude-code", file: dir.join("config.json"), shape: Shape::ClaudeCode };
let backup = dir.join("config.json.bak");
let original = "{\n \"personal_setting\": true\n}\n";
std::fs::write(&target.file, original).unwrap();
configure_file(&target, EXE, false, false, Mode::Add).unwrap();
assert_eq!(std::fs::read_to_string(&backup).unwrap(), original);
let changed_by_client = std::fs::read_to_string(&target.file).unwrap().replace("true", "false");
std::fs::write(&target.file, &changed_by_client).unwrap();
configure_file(&target, "/new/solidcraft-cli", false, false, Mode::Add).unwrap();
assert_eq!(std::fs::read_to_string(&backup).unwrap(), changed_by_client);
let current = std::fs::read_to_string(&target.file).unwrap();
assert!(current.contains("false") && current.contains("/new/solidcraft-cli"));
// A no-op or dry run must leave both the file and its backup alone.
configure_file(&target, "/new/solidcraft-cli", false, false, Mode::Add).unwrap();
configure_file(&target, "/future/solidcraft-cli", false, true, Mode::Add).unwrap();
assert_eq!(std::fs::read_to_string(&target.file).unwrap(), current);
assert_eq!(std::fs::read_to_string(&backup).unwrap(), changed_by_client);
configure_file(&target, "/new/solidcraft-cli", false, false, Mode::Remove).unwrap();
assert_eq!(std::fs::read_to_string(&backup).unwrap(), current);
assert!(!std::fs::read_to_string(&target.file).unwrap().contains("solidcraft"));
std::fs::remove_dir_all(dir).unwrap();
}
#[test]
fn configuration_is_unchanged_when_its_backup_cannot_be_replaced() {
let dir = config_dir("backup-failure");
let target = Target { client: "codex", file: dir.join("config.toml"), shape: Shape::Codex };
let original = "# personal setting\nmodel = \"custom\"\n";
std::fs::write(&target.file, original).unwrap();
std::fs::create_dir(dir.join("config.toml.bak")).unwrap();
assert!(configure_file(&target, EXE, false, false, Mode::Add).is_err());
assert_eq!(std::fs::read_to_string(&target.file).unwrap(), original);
assert_eq!(std::fs::read_dir(&dir).unwrap().count(), 2, "no temporary files remain");
std::fs::remove_dir_all(dir).unwrap();
}
#[test]
fn configuration_refuses_an_edit_based_on_an_outdated_read() {
let dir = config_dir("concurrent");
let path = dir.join("config.json");
let backup = dir.join("config.json.bak");
std::fs::write(&backup, "previous backup").unwrap();
for (expected, current) in [(Some("old"), Some("new")), (Some("old"), None), (None, Some("new"))] {
if let Some(text) = current {
std::fs::write(&path, text).unwrap();
} else {
std::fs::remove_file(&path).unwrap();
}
let error = write_config(&path, expected, "stale edit").unwrap_err();
assert!(error.to_string().contains("configuration changed"), "{error}");
assert_eq!(read_config(&path).unwrap().as_deref(), current);
assert_eq!(std::fs::read_to_string(&backup).unwrap(), "previous backup");
}
std::fs::remove_dir_all(dir).unwrap();
}
#[cfg(unix)]
#[test]
fn configuration_replaces_a_complete_file_and_keeps_links_and_permissions() {
use std::io::Read;
use std::os::unix::fs::{PermissionsExt, symlink};
let dir = config_dir("atomic");
let real = dir.join("real.json");
let target = Target { client: "claude-code", file: dir.join("config.json"), shape: Shape::ClaudeCode };
let original = "{\"personal_setting\": true}\n";
std::fs::write(&real, original).unwrap();
std::fs::set_permissions(&real, std::fs::Permissions::from_mode(0o600)).unwrap();
symlink("real.json", &target.file).unwrap();
let mut reader = std::fs::File::open(&target.file).unwrap();
configure_file(&target, EXE, false, false, Mode::Add).unwrap();
let mut old = String::new();
reader.read_to_string(&mut old).unwrap();
assert_eq!(old, original, "an existing reader sees the complete old file");
assert!(std::fs::read_to_string(&target.file).unwrap().contains(EXE));
assert!(std::fs::symlink_metadata(&target.file).unwrap().file_type().is_symlink());
assert_eq!(std::fs::metadata(&real).unwrap().permissions().mode() & 0o777, 0o600);
assert_eq!(std::fs::read_to_string(dir.join("real.json.bak")).unwrap(), original);
std::fs::remove_dir_all(dir).unwrap();
}
#[test]
fn quiet_adds_only_the_plain_entry_and_names_new_clients_once() {
let h = std::env::temp_dir().join(format!("solidcraft-quiet-{}", std::process::id()));
+87 -1
View File
@@ -64,7 +64,7 @@ pub static COMMANDS: &[CommandSpec] = &[
or features?: [feature id or name] (the bodies they made; path?: [occurrence ids] for only that placement's); \
or folder?: bodies|sketches|construction|origin|joints|all (all of it; showing also shows its browser folders and groups, and `all` takes in the occurrence hides too); \
or tree_folders?: [browser folder or group key: c0/bodies, o:4/sketches, c0/g7, c0/joints, c0/canvases, c0/point_clouds] (the folder or group itself: its items keep their own state); \
or paths?: [[occurrence ids]] (exact placements and descendants), isolate?: bool (requires paths and visible:true). Saved with the design and undone like any other change (the camera is not)",
or paths?: [[occurrence ids]] (exact placements and descendants), isolate?: bool (with paths or items of bodies, and visible:true: everything else is hidden, other placements as placements). Saved with the design and undone like any other change (the camera is not)",
),
CommandSpec::new("browser.expand_all", "Expand All", expand_all).icon("folder").noundo().params(
"path?: [occurrence ids] (that placement and its descendants); component?: id (that component's own folders); \
@@ -436,6 +436,89 @@ fn tree_folder_key(k: &str) -> bool {
k.len() <= 2048 && scope_ok && last_ok
}
/// Isolate bodies (#7896): the picked bodies stay, and so do the placements that hold them, down
/// to their own; those placements' other bodies and the root's other bodies are hidden one by
/// one, and every other placement is hidden as a placement, so its Browser row shows it is off and
/// its eye brings it back.
fn isolate_bodies(s: &mut Session, p: &Value, visible: bool) -> Result<Value> {
let cmd = "browser.visibility";
if !visible {
return Err(bad(cmd, "isolate requires visible:true"));
}
if ["folder", "features", "joints"].iter().any(|k| p.get(*k).is_some()) {
return Err(bad(cmd, "isolate takes `paths` or `items` (bodies)"));
}
let keys = keys(p, "items", cmd)?;
if keys.is_empty() {
return Err(bad(cmd, "isolate needs `paths` or `items` (bodies)"));
}
let world = s.world_state()?;
let keep: Vec<String> = keys
.iter()
.map(|k| match shown_item(s, &world, k) {
Some(Shown::Body(name)) => Ok(name),
_ => Err(bad(cmd, format!("no body `{k}`"))),
})
.collect::<Result<_>>()?;
let mut hidden_bodies: Vec<String> =
s.model.state().bodies.iter().filter(|b| s.doc.model_body_component(b) == 0 && !keep.contains(&b.name)).map(|b| b.name.clone()).collect();
let mut hidden = Vec::new();
let mut stack = vec![Vec::<u64>::new()];
let mut count = 0;
while let Some(parent) = stack.pop() {
for child in s.occurrence_children(&parent)? {
count += 1;
if count > 100_000 {
return Err(bad(cmd, "isolate exceeds 100000 placements"));
}
if s.occurrence_bodies_shared(&child.path, true)?.iter().any(|b| keep.contains(b)) {
hidden_bodies.extend(child.bodies.into_iter().map(|b| b.world).filter(|b| !keep.contains(b)));
stack.push(child.path);
} else {
hidden.push(child.path);
}
}
}
// A hidden Bodies folder or group a picked body is in would keep it hidden: those show
// again. Their other bodies are hidden one by one above, as the root's are.
let shown_folders = folders_holding(s, &keep);
s.visibility.hidden_folders.retain(|k| !shown_folders.contains(k));
s.visibility.hidden_occurrences = hidden;
s.visibility.hidden_bodies = hidden_bodies;
s.refresh_display();
Ok(json!({"visible":true,"isolated":keep,"visibility":s.visibility}))
}
/// The tree keys of the Bodies folders and groups (with the groups they are in) that hold the
/// bodies named `world` in some placement.
fn folders_holding(s: &Session, world: &[String]) -> std::collections::BTreeSet<String> {
let mut keys = std::collections::BTreeSet::new();
if s.visibility.hidden_folders.is_empty() {
return keys;
}
let st = s.model.state();
let names = solidcraft_doc::WorldNames::new(&s.doc, &st);
// Each body's component, found once rather than once per placement.
let owned: Vec<(u64, &str)> = s.doc.model_body_components(&st).into_iter().zip(st.bodies.iter().map(|b| b.name.as_str())).collect();
for (component, path, _) in s.doc.placements() {
let scope = Session::folder_scope(&path);
for b in owned.iter().filter(|(c, _)| *c == component).map(|(_, name)| *name) {
if !world.contains(&names.name(b, component, &path)) {
continue;
}
keys.insert(format!("{scope}/bodies"));
for g in s.doc.browser_groups.iter().filter(|g| g.component == component && g.folder == "bodies" && g.has_item(b)) {
for id in std::iter::successors(Some(g.id), |id| s.doc.browser_group(*id).and_then(|g| g.parent))
.take(solidcraft_doc::MAX_GROUP_NESTING + 1)
{
keys.insert(format!("{scope}/g{id}"));
}
}
}
}
keys
}
fn visibility(s: &mut Session, p: &Value) -> Result<Value> {
let cmd = "browser.visibility";
let visible = bool_(p, "visible").ok_or_else(|| bad(cmd, "`visible` must be true or false"))?;
@@ -525,6 +608,9 @@ fn visibility(s: &mut Session, p: &Value) -> Result<Value> {
s.refresh_display();
return Ok(json!({"visible":visible,"changed":paths.len(),"visibility":s.visibility}));
}
if bool_(p, "isolate").unwrap_or(false) {
return isolate_bodies(s, p, visible);
}
let items: Vec<Shown> = match (str_(p, "folder"), p.get("items")) {
_ if p.get("features").is_some() => {
if ["items", "folder", "joints"].iter().any(|k| p.get(*k).is_some()) {
+53 -36
View File
@@ -9,7 +9,7 @@
use std::collections::{BTreeMap, HashMap};
use std::sync::Arc;
use serde_json::{Value, json};
use serde_json::Value;
use solidcraft_geom::mesh_distance::box_gap;
use solidcraft_geom::prelude::*;
use solidcraft_geom::{Aabb3, Mesh};
@@ -17,9 +17,20 @@ use solidcraft_kernel::{BodyDistance, DistanceShape};
use super::CommandSpec;
use crate::params::{bad, num, str_, string_list};
use crate::schema::clearance::{
Clearance as ClearanceReply, ClearanceParams, MAX_CLEARANCE, MAX_NEAREST, NearPair, Neighbour, Overlap, OverlapBounds, Unchecked,
};
use crate::schema::{TypedContract, output_schema_for};
use crate::{Result, Session};
pub static COMMANDS: &[CommandSpec] = &[CommandSpec::new("inspect.clearance", "Clearance", clearance).icon("interference").noundo().params(
const CONTRACT: TypedContract<ClearanceParams> = TypedContract::new();
pub static COMMANDS: &[CommandSpec] = &[CommandSpec::new("inspect.clearance", "Clearance", crate::checked!("inspect.clearance", clearance))
.icon("interference")
.noundo()
.contract(&CONTRACT)
.output(output_schema_for::<ClearanceReply>)
.params(
"bodies?: [names] (default: every solid body, in world placement, but those in `against`; mesh bodies are not measured); against?: [names] (only pairs with one body in `bodies` and the other here); \
min_volume?: mm³ (default 0.01: smaller overlaps count as contact); clearance?: mm (default 0: report pairs closer than this); \
nearest?: n (each body of `bodies` gets its n nearest others); skip_within?: \"occurrence\" (pairs of bodies of one occurrence) | \
@@ -34,10 +45,6 @@ pub static COMMANDS: &[CommandSpec] = &[CommandSpec::new("inspect.clearance", "C
const MAX_BODIES: usize = 20_000;
/// Most pairs whose grown boxes meet that one call measures.
const MAX_PAIRS: usize = 200_000;
/// Most neighbours a body's `nearest` list holds.
const MAX_NEAREST: usize = 1000;
/// Largest clearance (mm).
const MAX_CLEARANCE: f64 = 1e6;
#[derive(Clone, Copy, PartialEq, Eq)]
enum SkipWithin {
@@ -261,48 +268,56 @@ fn clearance(s: &mut Session, p: &Value) -> Result<Value> {
for k in ["bodies", "against"] {
asked.extend(string_list(cmd, p, k)?);
}
let mut unchecked: Vec<Value> = mesh_bodies
let mut unchecked: Vec<Unchecked> = mesh_bodies
.iter()
.filter(|b| p.get("bodies").is_none_or(Value::is_null) || asked.contains(&b.name))
.map(|b| json!({"a": b.name, "b": null, "reason": super::interference::MESH_NOT_CHECKED}))
.map(|b| Unchecked { a: b.name.clone(), b: None, reason: super::interference::MESH_NOT_CHECKED.to_string() })
.collect();
let name = |i: usize| solid.get(i).map_or("", |b| b.name.as_str());
let pair = |i: usize, j: usize, reason: String| Unchecked { a: name(i).to_string(), b: Some(name(j).to_string()), reason };
for (&(i, j), r) in close.iter().zip(results) {
let r = match r {
Ok(r) => r,
Err(e) => {
unchecked.push(json!({"a": name(i), "b": name(j), "reason": e.to_string()}));
unchecked.push(pair(i, j, e.to_string()));
continue;
}
};
if let Some(reason) = r.unchecked {
unchecked.push(json!({"a": name(i), "b": name(j), "reason": reason}));
unchecked.push(pair(i, j, reason));
continue;
}
if let Some((volume, area, bbox, center)) = r.overlap
&& volume >= min_volume
{
overlaps.push(json!({"a": name(i), "b": name(j), "volume_mm3": volume, "area_mm2": area,
"bbox": {"min": bbox.min, "max": bbox.max}, "center": center}));
overlaps.push(Overlap {
a: name(i).to_string(),
b: name(j).to_string(),
volume_mm3: volume,
area_mm2: area,
bbox: OverlapBounds { min: bbox.min.into(), max: bbox.max.into() },
center: center.into(),
});
known.insert((i, j), 0.0);
continue;
}
let Some(d) = r.distance else { continue };
known.insert((i, j), d.distance);
if d.distance < gap {
let mut e = json!({"a": name(i), "b": name(j), "distance_mm": d.distance, "from": d.from, "to": d.to});
if let Some((v, ..)) = r.overlap.filter(|o| o.0 > 0.0) {
e["overlap_mm3"] = json!(v);
}
if !d.exact {
e["exact"] = json!(false);
}
near.push(e);
near.push(NearPair {
a: name(i).to_string(),
b: name(j).to_string(),
distance_mm: d.distance,
from: d.from.into(),
to: d.to.into(),
overlap_mm3: r.overlap.filter(|o| o.0 > 0.0).map(|o| o.0),
exact: (!d.exact).then_some(false),
});
}
}
near.sort_by(|x, y| x["distance_mm"].as_f64().unwrap_or(0.0).total_cmp(&y["distance_mm"].as_f64().unwrap_or(0.0)));
near.sort_by(|x, y| x.distance_mm.total_cmp(&y.distance_mm));
let mut nearest_out = serde_json::Map::new();
let mut nearest_out = BTreeMap::new();
if nearest > 0 {
let lists = nearest_lists(&subjects, n, nearest, &boxes, &allowed, &mut known, |pairs| {
solidcraft_kernel::map_with_local_pools(pairs, usize::MAX, |&(i, j)| {
@@ -311,23 +326,25 @@ fn clearance(s: &mut Session, p: &Value) -> Result<Value> {
})
});
for (i, list) in lists {
let rows: Vec<Value> = list.iter().map(|&(j, d)| json!({"body": name(j), "distance_mm": d})).collect();
nearest_out.insert(name(i).to_string(), Value::Array(rows));
let rows = list.iter().map(|&(j, d)| Neighbour { body: name(j).to_string(), distance_mm: d }).collect();
nearest_out.insert(name(i).to_string(), rows);
}
}
Ok(json!({
"overlaps": overlaps,
"near": near,
"nearest": nearest_out,
"unchecked": unchecked,
"bodies": subjects.len(),
"pairs_checked": close.len(),
"pairs_reused": reused,
"pairs_pruned": total.saturating_sub(close.len()),
"truncated": truncated > 0,
"ms": started.elapsed().as_secs_f64() * 1000.0,
}))
let reply = ClearanceReply {
overlaps,
near,
nearest: nearest_out,
unchecked,
bodies: subjects.len(),
pairs_checked: close.len(),
pairs_reused: reused,
pairs_pruned: total.saturating_sub(close.len()),
truncated: truncated > 0,
ms: started.elapsed().as_secs_f64() * 1000.0,
param_warnings: Vec::new(),
};
serde_json::to_value(reply).map_err(|e| bad(cmd, e.to_string()))
}
/// One pair: its overlap when the meshes meet or one holds the other, otherwise its distance
+75 -56
View File
@@ -5,7 +5,7 @@
//! well as any; each place's volume, centre and box are then measured exactly, on the pieces of
//! the two cuts a − b and b − a that lie there, as `inspect.measure` measures a body.
use serde_json::{Value, json};
use serde_json::Value;
use solidcore_record::Vec3;
use solidcraft_geom::Aabb3;
use solidcraft_geom::compare::{self, CompareOptions, Side};
@@ -13,9 +13,19 @@ use solidcraft_geom::prelude::*;
use super::CommandSpec;
use crate::params::bad;
use crate::schema::compare::{
Bounds, CompareParams, CompareSide, Comparison, Deviation, Deviations, Difference, MeasuredBy, Region, Resolution, Sampling, SideTotal,
};
use crate::schema::{TypedContract, output_schema_for};
use crate::{Result, Sel, Session};
pub static COMMANDS: &[CommandSpec] = &[CommandSpec::new("inspect.compare", "Compare Bodies", compare_bodies).icon("compare").params(
const CONTRACT: TypedContract<CompareParams> = TypedContract::new();
pub static COMMANDS: &[CommandSpec] = &[CommandSpec::new("inspect.compare", "Compare Bodies", crate::checked!("inspect.compare", compare_bodies))
.icon("compare")
.contract(&CONTRACT)
.output(output_schema_for::<Comparison>)
.params(
"a, b: body names (default: the two selected bodies, or the design's only two), in world placement; tolerance?: mm (0.001 to 10, default 0.01): \
surfaces closer than this agree; spacing?: mm (default 0.5): the largest piece of a face sampled as one point, coarser for a body that would need \
more than max_points? (default 8 million, up to 50 million) samples; max_regions? (default 50); color?: true | {only_in_a?, only_in_b?: \"#rrggbb\"} \
@@ -32,10 +42,10 @@ pub static COMMANDS: &[CommandSpec] = &[CommandSpec::new("inspect.compare", "Com
const ONLY_IN_A: [u8; 3] = [0xe0, 0x31, 0x31];
const ONLY_IN_B: [u8; 3] = [0x2f, 0x9e, 0x44];
fn side_name(s: Side) -> &'static str {
fn side_of(s: Side) -> CompareSide {
match s {
Side::OnlyInA => "only_in_a",
Side::OnlyInB => "only_in_b",
Side::OnlyInA => CompareSide::OnlyInA,
Side::OnlyInB => CompareSide::OnlyInB,
}
}
@@ -105,21 +115,21 @@ fn v3(v: &Value) -> Option<Vec3> {
}
/// b − a of the two bodies' measures.
fn difference(ma: &Value, mb: &Value) -> Value {
fn difference(ma: &Value, mb: &Value) -> Difference {
let f = |m: &Value, k: &str| m.get(k).and_then(Value::as_f64);
let sub = |x: Option<f64>, y: Option<f64>| x.zip(y).map(|(x, y)| y - x);
let (va, vb) = (f(ma, "volume_mm3"), f(mb, "volume_mm3"));
let com = v3(&ma["center_of_mass"]).zip(v3(&mb["center_of_mass"])).map(|(a, b)| b - a);
let corner = |k: &str| v3(&ma["bbox"][k]).zip(v3(&mb["bbox"][k])).map(|(a, b)| b - a);
json!({
"volume_mm3": sub(va, vb),
"volume_percent": va.zip(vb).filter(|(a, _)| a.abs() > 0.0).map(|(a, b)| 100.0 * (b - a) / a),
"area_mm2": sub(f(ma, "area_mm2"), f(mb, "area_mm2")),
"center_of_mass": com,
"center_of_mass_distance_mm": com.map(Vec3::len),
"bbox_min": corner("min"),
"bbox_max": corner("max"),
})
let corner = |k: &str| v3(&ma["bbox"][k]).zip(v3(&mb["bbox"][k])).map(|(a, b)| (b - a).into());
Difference {
volume_mm3: sub(va, vb),
volume_percent: va.zip(vb).filter(|(a, _)| a.abs() > 0.0).map(|(a, b)| 100.0 * (b - a) / a),
area_mm2: sub(f(ma, "area_mm2"), f(mb, "area_mm2")),
center_of_mass: com.map(Into::into),
center_of_mass_distance_mm: com.map(Vec3::len),
bbox_min: corner("min"),
bbox_max: corner("max"),
}
}
/// The volume a closed mesh encloses (divergence theorem, about its box's centre).
@@ -245,8 +255,8 @@ fn exact_regions(
(measured, notes)
}
fn deviation_json(d: &compare::Deviation) -> Value {
json!({"max_mm": d.max, "mean_mm": d.mean, "at": d.at, "area_beyond_mm2": d.beyond_area, "area_mm2": d.area, "points": d.points})
fn deviation(d: &compare::Deviation) -> Deviation {
Deviation { max_mm: d.max, mean_mm: d.mean, at: d.at.into(), area_beyond_mm2: d.beyond_area, area_mm2: d.area, points: d.points }
}
fn compare_bodies(s: &mut Session, p: &Value) -> Result<Value> {
@@ -308,30 +318,36 @@ fn compare_bodies(s: &mut Session, p: &Value) -> Result<Value> {
exact_notes.iter().find(mine).or_else(|| exact_notes.last()).cloned().unwrap_or_else(|| "the exact cut gave no piece here".to_string())
};
let axis = |k: usize| ["X", "Y", "Z"].get(k).copied().unwrap_or("?");
let regions: Vec<Value> = order
let regions: Vec<Region> = order
.iter()
.enumerate()
.filter_map(|(i, &k)| c.regions.get(k).map(|r| (i, k, r)))
.map(|(i, k, r)| {
let m = measured(k);
json!({
"index": i + 1,
"side": side_name(r.side),
"material_of": if r.side == Side::OnlyInA { &na } else { &nb },
"volume_mm3": m.map(|m| m.volume),
"measured_by": if m.is_some() { "boolean" } else { "not measured" },
"not_measured": if m.is_some() { Value::Null } else { json!(reason(k)) },
"area_mm2": r.area_a + r.area_b,
"area_a_mm2": r.area_a,
"area_b_mm2": r.area_b,
"max_deviation_mm": r.max_deviation,
"at": r.at,
"center": m.map(|m| m.center),
"bbox": m.map(|m| json!({"min": m.bbox.min, "max": m.bbox.max})).unwrap_or_else(|| json!({"min": r.bbox.min, "max": r.bbox.max})),
"faces_a": r.faces_a.iter().map(|x| x.0).collect::<Vec<u32>>(),
"faces_b": r.faces_b.iter().map(|x| x.0).collect::<Vec<u32>>(),
"resolution": {"along": axis(r.lines.axis), "line_spacing_mm": r.lines.spacing, "lines": r.lines.count, "skipped_lines": r.lines.skipped},
})
let bbox = m.map_or(r.bbox, |m| m.bbox);
Region {
index: i + 1,
side: side_of(r.side),
material_of: if r.side == Side::OnlyInA { na.clone() } else { nb.clone() },
volume_mm3: m.map(|m| m.volume),
measured_by: if m.is_some() { MeasuredBy::Boolean } else { MeasuredBy::NotMeasured },
not_measured: if m.is_some() { None } else { Some(reason(k)) },
area_mm2: r.area_a + r.area_b,
area_a_mm2: r.area_a,
area_b_mm2: r.area_b,
max_deviation_mm: r.max_deviation,
at: r.at.into(),
center: m.map(|m| m.center.into()),
bbox: Bounds { min: bbox.min.into(), max: bbox.max.into() },
faces_a: r.faces_a.iter().map(|x| x.0).collect(),
faces_b: r.faces_b.iter().map(|x| x.0).collect(),
resolution: Resolution {
along: axis(r.lines.axis).to_string(),
line_spacing_mm: r.lines.spacing,
lines: r.lines.count,
skipped_lines: r.lines.skipped,
},
}
})
.collect();
// A side's total, or none when one of its regions is not measured.
@@ -361,25 +377,28 @@ fn compare_bodies(s: &mut Session, p: &Value) -> Result<Value> {
if !warnings.is_empty() {
verdict += &format!(" ({} warning{})", warnings.len(), if warnings.len() == 1 { "" } else { "s" });
}
let mut out = json!({
"a": measure_a,
"b": measure_b,
"difference": difference(&measure_a, &measure_b),
"tolerance_mm": tolerance,
"deviation": {"a_to_b": deviation_json(&c.a_to_b), "b_to_a": deviation_json(&c.b_to_a), "max_mm": worst},
"identical": identical,
"verdict": verdict,
"regions": regions,
"only_in_a": {"regions": ca, "volume_mm3": va},
"only_in_b": {"regions": cb, "volume_mm3": vb},
"unlisted_regions": c.unlisted,
"warnings": warnings,
"sampling": {"spacing_mm": c.spacing, "chord_mm": chord, "triangles_a": mesh_a.triangles.len(), "triangles_b": mesh_b.triangles.len()},
});
if let Some(colors) = colors {
out["colored_faces"] = json!(color_regions(s, &c, [&na, &nb], colors)?);
}
Ok(out)
let colored_faces = match colors {
Some(colors) => Some(color_regions(s, &c, [&na, &nb], colors)?),
None => None,
};
let out = Comparison {
difference: difference(&measure_a, &measure_b),
a: measure_a.as_object().cloned().unwrap_or_default(),
b: measure_b.as_object().cloned().unwrap_or_default(),
tolerance_mm: tolerance,
deviation: Deviations { a_to_b: deviation(&c.a_to_b), b_to_a: deviation(&c.b_to_a), max_mm: worst },
identical,
verdict,
regions,
only_in_a: SideTotal { regions: ca, volume_mm3: va },
only_in_b: SideTotal { regions: cb, volume_mm3: vb },
unlisted_regions: c.unlisted,
warnings,
sampling: Sampling { spacing_mm: c.spacing, chord_mm: chord, triangles_a: mesh_a.triangles.len(), triangles_b: mesh_b.triangles.len() },
colored_faces,
param_warnings: Vec::new(),
};
serde_json::to_value(out).map_err(|e| bad(cmd, e.to_string()))
}
/// A face is coloured for a region when at least this share of it deviates there.
+44 -1
View File
@@ -175,7 +175,7 @@ pub static COMMANDS: &[CommandSpec] = &[
.params("component (or occurrence): what to place again; path?: validates selected occurrence; parent?: component (default: the same parent); translate?: [x,y,z]; in_place?: bool (default false: the selected transform within the parent; true: where the selected placement is in the world, translate in world axes; a parent placed more than once is placed by parent_path?, else the active placement, and every instance gets the copy). Copies the selected effective transform, including pending moves"),
CommandSpec::new("component.paste_new", "Paste New", paste_new).icon("paste").params("component: independently copy its nested definition graph and history, materials and styles; occurrence?, path?: selected source placement; parent?: component the copy goes in (default: the source placement's; not the component or one inside it); in_place?, parent_path?: as occurrence.copy; translate?: [x,y,z]. Reassigned external bodies become base geometry; retained external links and omitted boundary joints are reported"),
CommandSpec::new("occurrence.move", "Move Occurrence", move_occurrence).icon("move")
.params("occurrence; path?: exact placement; space?: local|world (default local); translate?: [x,y,z]; axis?: [x,y,z], angle?: radians or \"30 deg\", origin?: [x,y,z]; matrix?: [12 or 16 numbers] (instead of translate/axis/angle/origin: a rigid move as a row-major 3x4 rotation-and-translation or 4x4 matrix, flat or as rows; one that is a rotation only up to rounding is orthonormalised, a scale, shear or mirror is refused); tolerance?: largest accepted |RᵀR − I| (default 1e-9, at most 1e-3); capture?: bool (default true; false keeps it pending until Capture Position); move_grounded?: bool (default false: a grounded occurrence refuses; true moves it and it stays grounded). Nested occurrence definitions remain shared"),
.params("occurrence; path?: exact placement; space?: local|world (default local); translate?: [x,y,z]; axis?: [x,y,z], angle?: radians or \"30 deg\", origin?: [x,y,z]; matrix?: [12 or 16 numbers] (instead of translate/axis/angle/origin: a rigid move as a row-major 3x4 rotation-and-translation or 4x4 matrix, flat or as rows; one that is a rotation only up to rounding is orthonormalised, a scale, shear or mirror is refused); tolerance?: largest accepted |RᵀR − I| (default 1e-9, at most 1e-3); capture?: bool (default true; false keeps it pending until Capture Position); move_grounded?: bool (default false: a grounded occurrence refuses; true moves it and it stays grounded). Nested occurrence definitions remain shared. Replies {occurrence, transform, pending}; when joints hold it to something fixed and put it back, transform is where it is and the reply adds reverted: true and a warning naming the joint"),
CommandSpec::new("occurrence.drag", "Drag Occurrence", drag::drag).icon("move").params(
"occurrence or path: exact placement; at: [x,y,z] world point on it; point: [x,y,z] where it goes. Moves the placement by \
point - at (with any chain of joints it is in that is joined to nothing grounded) and captures its position; other pending \
@@ -730,6 +730,9 @@ fn move_occurrence(s: &mut Session, p: &Value) -> Result<Value> {
if let Some(x) = s.doc_mut().occurrences.iter_mut().find(|x| x.id == id) {
x.transform = next;
}
if !s.doc.assembly.joints.is_empty() {
return Ok(after_joints(s, p, id, next, cmd));
}
} else {
s.pending_moves.insert(id, next);
s.revision += 1;
@@ -737,6 +740,46 @@ fn move_occurrence(s: &mut Session, p: &Value) -> Result<Value> {
Ok(json!({"occurrence": id, "transform": next, "pending": !bool_(p, "capture").unwrap_or(true)}))
}
/// The reply to a captured move once the joints are solved (#11723): a part its joints hold to
/// something fixed is put back by that solve, so the reply gives where it is now, says
/// `reverted`, and names the joint and what to change instead.
fn after_joints(s: &mut Session, p: &Value, id: u64, moved: Mat, cmd: &str) -> Value {
s.refresh();
let now = s.doc.occurrences.iter().find(|o| o.id == id).map_or(moved, |o| o.transform);
let same = now.iter().flatten().zip(moved.iter().flatten()).all(|(a, b)| (a - b).abs() <= 1e-6);
if same {
return json!({"occurrence": id, "transform": now, "pending": false});
}
let name = s.doc.occurrences.iter().find(|o| o.id == id).map(|o| o.name.clone()).unwrap_or_default();
// The placement the caller named, else the first one: a part in a component placed more
// than once has no path of its own, and its joints hold it alike in every placement.
let path = if p.get("path").is_some() {
occurrence_path(s, p, id, cmd).ok()
} else {
let parent = s.doc.occurrences.iter().find(|o| o.id == id).map_or(0, |o| o.parent);
let mut path = s.doc.first_path(parent);
path.push(id);
Some(path)
};
let why = path.and_then(|path| s.drag_group(&path).err()).map(|e| format!("{e}. ")).unwrap_or_else(|| {
// No one joint to blame (a hinge's stored value, say): name the joints on the part.
let on: Vec<&str> = s
.doc
.assembly
.joints
.iter()
.filter(|j| !j.suppressed && (j.a.occurrence == id || j.b.occurrence == id))
.map(|j| j.name.as_str())
.collect();
if on.is_empty() { String::new() } else { format!("Joints on {name}: {}. ", on.join(", ")) }
});
let warning = format!(
"{why}The joints put {name} back where they hold it. To move it, change the joint (joint.edit for its offset or angle, \
joint.drive for a hinge or slider value), move what it is held to, or use joint.reach"
);
json!({"occurrence": id, "transform": now, "pending": false, "reverted": true, "warning": warning})
}
fn ground(s: &mut Session, p: &Value) -> Result<Value> {
let cmd = "occurrence.ground";
let id = occurrence(s, p, cmd)?;
@@ -287,3 +287,66 @@ fn a_unique_part_can_drag_a_chain_through_a_shared_peer() {
run(&mut s, "joint.solve", json!({}));
assert_eq!(s.doc.to_json(), before);
}
/// #11723: Move Occurrence on a part that rigid joints hold to something grounded is put back by
/// the joint solve after it. The move still succeeds, but its reply says it was put back, gives
/// where the part is, and names the joint. A free chain follows the move, as before, and says
/// nothing.
#[test]
fn a_move_its_joints_undo_says_so() {
let setups: [(&str, fn(&mut Session, u64, u64, u64)); 4] = [
("free chain", |_, _, _, _| {}),
("plate held to base", |s, base, plate, _| {
run(s, "joint.as_built", json!({"type": "rigid", "a": base, "b": plate, "name": "Mount"}));
}),
("motor held to base", |s, base, _, motor| {
run(s, "joint.as_built", json!({"type": "rigid", "a": base, "b": motor, "name": "Mount"}));
}),
("motor grounded", |s, _, _, motor| {
run(s, "occurrence.ground", json!({"occurrence": motor, "grounded": true}));
}),
];
for (case, setup) in setups {
let mut s = Session::default();
let (_, base) = part(&mut s, "Base", [0.0, 0.0, 0.0]);
let (_, plate) = part(&mut s, "Plate", [20.0, 0.0, 0.0]);
let (_, motor) = part(&mut s, "Motor", [20.0, 0.0, 10.0]);
run(&mut s, "joint.as_built", json!({"type": "rigid", "a": plate, "b": motor, "name": "Bolted"}));
setup(&mut s, base, plate, motor);
let (plate_at, motor_at) = (origin(&s, &[plate]), origin(&s, &[motor]));
let r = run(&mut s, "occurrence.move", json!({"occurrence": plate, "space": "world", "translate": [0, 0, 30]}));
let reply_at = [r["transform"][3][0].as_f64().unwrap(), r["transform"][3][1].as_f64().unwrap(), r["transform"][3][2].as_f64().unwrap()];
near(reply_at, origin(&s, &[plate]));
if case == "free chain" {
near(origin(&s, &[plate]), [plate_at[0], plate_at[1], plate_at[2] + 30.0]);
near(origin(&s, &[motor]), [motor_at[0], motor_at[1], motor_at[2] + 30.0]);
assert!(r.get("reverted").is_none() && r.get("warning").is_none(), "{case}: {r}");
continue;
}
near(origin(&s, &[plate]), plate_at);
assert_eq!(r["reverted"], json!(true), "{case}: {r}");
let warning = r["warning"].as_str().unwrap_or_default();
let holder = if case == "motor grounded" { "Bolted" } else { "Mount" };
assert!(warning.contains(holder) && warning.contains("joint.reach") && warning.contains("joint.edit"), "{case}: {warning}");
}
}
/// #11723: a part inside an assembly placed twice has no path of its own. When its joints put it
/// back, the warning still names the joint that holds it.
#[test]
fn a_move_its_joints_undo_names_the_joint_in_a_repeated_assembly() {
let mut s = Session::default();
let (_, base) = part(&mut s, "Base", [0.0, 0.0, 0.0]);
let arm = run(&mut s, "component.create", json!({"name": "Arm"}));
let (arm_component, arm_at) = (arm["component"].as_u64().unwrap(), arm["occurrence"].as_u64().unwrap());
run(&mut s, "component.activate", json!({"component": arm_component}));
let plate = run(&mut s, "component.create", json!({"name": "Plate"}))["occurrence"].as_u64().unwrap();
run(&mut s, "solid.box", json!({"length": 10, "width": 10, "height": 10, "corner": [20, 0, 0]}));
run(&mut s, "component.activate", json!({"component": "root"}));
run(&mut s, "joint.as_built", json!({"type": "rigid", "a": base, "b": plate, "name": "Mount"}));
run(&mut s, "occurrence.copy", json!({"occurrence": arm_at, "translate": [0, 50, 0]}));
let r = run(&mut s, "occurrence.move", json!({"occurrence": plate, "translate": [0, 0, 30]}));
assert_eq!(r["reverted"], json!(true), "{r}");
let warning = r["warning"].as_str().unwrap_or_default();
assert!(warning.contains("Mount"), "the warning names the joint: {warning}");
}
+17 -2
View File
@@ -234,7 +234,12 @@ fn properties(s: &Session, doc: &Document, selected: &[u64], descendants: bool,
#[cfg(test)]
work::count(|w| w.spreads += spread_bodies.len());
let spreads = solidcraft_kernel::map_on_threads(&spread_bodies, 16, |&i| {
state.bodies.get(i).and_then(|b| solidcraft_io::mass_properties(&b.body).ok().flatten()).and_then(|m| m.gyration())
let body = state.bodies.get(i)?;
let mut measured = solidcraft_io::mass_properties(&body.body).ok().flatten()?;
if let Some(sheet) = state.sheets.iter().find(|sheet| sheet.body == body.definition_name()) {
sheet.correct_perforation_mass_properties(&mut measured, &solidcraft_doc::IDENTITY).ok()?;
}
measured.gyration()
});
let spread: BTreeMap<usize, Tensor3> = spread_bodies.into_iter().zip(spreads).filter_map(|(i, g)| Some((i, g.flatten()?))).collect();
// A window waiting for the result (the Properties window) sees how far it is and can stop it.
@@ -254,7 +259,17 @@ fn properties(s: &Session, doc: &Document, selected: &[u64], descendants: bool,
}
done += 1;
let transform: Mat = doc.model_body_offset(body).map(|offset| solidcraft_doc::mat_mul(&transform, offset)).unwrap_or(transform);
let measured = measure_placed(body, transform)?;
let mut measured = measure_placed(body, transform)?;
if let Some(sheet) = state.sheets.iter().find(|sheet| sheet.body == body.definition_name() && !sheet.perforations.is_empty()) {
let mut corrected = body.measure()?;
corrected.volume = measured.volume;
corrected.area = measured.area;
corrected.centroid = measured.centroid;
sheet.correct_perforation_properties(&mut corrected, &transform)?;
measured.volume = corrected.volume;
measured.area = corrected.area;
measured.centroid = corrected.centroid;
}
let density = doc.density(&body.name);
let body_mass = measured.volume * density / 1000.0;
let closed = measured.closed;
@@ -1,5 +1,6 @@
use crate::Session;
use serde_json::{Value, json};
use solidcore_record::Vec2;
use solidcraft_geom::prelude::*;
fn run(s: &mut Session, cmd: &str, params: Value) -> Value {
@@ -89,6 +90,252 @@ fn body_reassignment_offsets_preserve_world_properties() {
close(&r["total"]["center_of_mass"][0], 5.0);
}
fn panel_blank(s: &mut Session, width: f64, height: f64) {
run(s, "sheet.manage_rules", json!({"name": "Panel 0.8", "thickness": "0.8", "active": true}));
run(s, "sketch.create", json!({"plane": "XY", "name": "Blank"}));
run(s, "sketch.rectangle.two_point", json!({"p0": [0, 0], "p1": [width, height]}));
run(s, "sketch.finish", json!({}));
run(s, "sheet.flange", json!({"sketch": "Blank", "body_name": "Panel"}));
}
fn perforated_panel(s: &mut Session) {
panel_blank(s, 20.0, 10.0);
run(s, "sheet.perforate", json!({"diameter": "2", "pitch": "10", "margin": "1", "pattern": "square"}));
run(s, "material.assign", json!({"bodies": ["Panel"], "material": "Steel"}));
}
/// Two radius-1 holes centred at (2, 2) and (12, 2), through a 20 x 10 x 0.8 blank.
fn perforated_panel_expected() -> (f64, f64, [f64; 3]) {
let removed = 2.0 * std::f64::consts::PI * 0.8;
let volume = 160.0 - removed;
let area = 448.0 - 0.8 * std::f64::consts::PI;
(volume, area, [(160.0 * 10.0 - removed * 7.0) / volume, (160.0 * 5.0 - removed * 2.0) / volume, 0.4])
}
#[test]
fn perforated_sheet_properties_include_holes_and_their_off_centre_volume_moment() {
let mut s = Session::default();
perforated_panel(&mut s);
let (volume, area, center) = perforated_panel_expected();
let density = s.doc.density("Panel");
let doc = s.doc.clone();
let undo = s.undo.len();
for command in ["component.properties", "inspect.measure"] {
let result = run(&mut s, command, json!({}));
close(&result["total"]["volume_mm3"], volume);
close(&result["total"]["mass_g"], volume * density / 1000.0);
close(&result["total"]["area_mm2"], area);
for (axis, expected) in center.iter().enumerate() {
close(&result["bodies"][0]["center_of_mass"][axis], *expected);
}
}
let inspected = run(&mut s, "document.inspect", json!({"measure": true}));
close(&inspected["bodies"][0]["volume_mm3"], volume);
close(&inspected["bodies"][0]["area_mm2"], area);
for key in ["faces", "edges", "vertices"] {
assert_eq!(inspected["bodies"][0][key], inspected["bodies"][0]["kernel"][key], "document.inspect retains kernel {key}");
}
assert!(inspected["bodies"][0].get("sheet_metal").is_none());
let picked = run(&mut s, "inspect.measure", json!({"items": [{"type": "body", "name": "Panel"}]}));
close(&picked["items"][0]["volume_mm3"], volume);
assert!(std::sync::Arc::ptr_eq(&s.doc, &doc));
assert_eq!(s.undo.len(), undo, "measuring must not add an undo step");
}
#[test]
fn perforated_sheet_instances_keep_physical_properties_in_nested_world_placements() {
let mut s = Session::default();
let parent = run(&mut s, "component.create", json!({"name": "Subassembly", "grounded": false}));
let child = run(&mut s, "component.create", json!({"name": "Sheet", "grounded": false}));
perforated_panel(&mut s);
let sheet_density = s.doc.density("Panel");
run(&mut s, "component.activate", json!({"component": "root"}));
let copy = run(&mut s, "occurrence.copy", json!({"component": parent["component"], "translate": [40, 0, 0]}));
run(
&mut s,
"occurrence.move",
json!({"occurrence": parent["occurrence"], "translate": [20, 0, 10], "axis": [0, 0, 1], "angle": "90 deg", "capture": false}),
);
box_in(&mut s, "Ballast");
let ballast_body = s.model.state().bodies.last().unwrap().name.clone();
run(&mut s, "material.assign", json!({"bodies": [ballast_body], "material": "Aluminum"}));
let ballast_mass = s.doc.density(&ballast_body);
let (volume, area, center) = perforated_panel_expected();
let sheet_mass = volume * sheet_density / 1000.0;
let first = [20.0 - center[1], center[0], 10.0 + center[2]];
let second = [40.0 + center[0], center[1], center[2]];
let doc = s.doc.clone();
let moves = s.pending_moves.clone();
let undo = s.undo.len();
for (parent_occurrence, expected) in [(&parent["occurrence"], first), (&copy["occurrence"], second)] {
let properties =
run(&mut s, "occurrence.properties", json!({"occurrence": child["occurrence"], "path": [parent_occurrence, child["occurrence"]]}));
close(&properties["total"]["volume_mm3"], volume);
close(&properties["total"]["mass_g"], sheet_mass);
close(&properties["total"]["area_mm2"], area);
for (axis, coordinate) in expected.iter().enumerate() {
close(&properties["total"]["center_of_mass"][axis], *coordinate);
}
}
let properties = run(&mut s, "component.properties", json!({"component": "root"}));
let mass = 2.0 * sheet_mass + ballast_mass;
close(&properties["total"]["volume_mm3"], 2.0 * volume + 1000.0);
close(&properties["total"]["mass_g"], mass);
for axis in 0..3 {
close(&properties["total"]["center_of_mass"][axis], (sheet_mass * (first[axis] + second[axis]) + ballast_mass * 5.0) / mass);
}
let measured = run(&mut s, "inspect.measure", json!({}));
close(&measured["total"]["volume_mm3"], 2.0 * volume + 1000.0);
close(&measured["total"]["mass_g"], mass);
assert_eq!(measured["bodies"].as_array().unwrap().iter().filter(|b| b["sheet_metal"] == true).count(), 2);
assert!(std::sync::Arc::ptr_eq(&s.doc, &doc));
assert_eq!(s.pending_moves, moves);
assert_eq!(s.undo.len(), undo);
}
#[test]
fn perforated_sheet_centroid_follows_a_folded_panel_and_unfolds() {
use std::f64::consts::{FRAC_PI_2, PI};
let mut s = Session::default();
panel_blank(&mut s, 30.0, 10.0);
run(
&mut s,
"sheet.fold",
json!({"points": [[10, 0, 0], [10, 10, 0]], "angle": "90 deg", "radius": "0.8", "position": "centerline", "fixed": [2, 5, 0]}),
);
let before = run(&mut s, "component.properties", json!({"component": "root"}));
run(&mut s, "sheet.perforate", json!({"diameter": "2", "pitch": "10", "margin": "0", "pattern": "square"}));
let sheet = &s.model.state().sheets[0];
let holes = sheet.perforation_holes(&sheet.perforations[0]).unwrap();
assert_eq!(holes.len(), 2);
// Fold boundaries carry kernel roundoff; keep the analytic centres and the
// same sub-micrometre tolerance used by the property checks below.
for (hole, expected) in holes.iter().zip([Vec2::new(1.0, 1.0), Vec2::new(21.0, 1.0)]) {
assert!(hole.dist(expected) < 1e-6, "{hole:?} != {expected:?}");
}
// The right panel turns up by 90 degrees about a y-parallel bend axis at
// z = radius + thickness. Its mid-plane is radius + thickness/2 from that axis.
let allowance = FRAC_PI_2 * (0.8 + 0.44 * 0.8);
let bend_start = 10.0 - allowance / 2.0;
let right_hole = [bend_start + 1.2, 1.0, 1.6 + 21.0 - bend_start - allowance];
let old_volume = before["total"]["volume_mm3"].as_f64().unwrap();
let hole_volume = PI * 0.8;
let volume = old_volume - 2.0 * hole_volume;
let result = run(&mut s, "component.properties", json!({"component": "root"}));
close(&result["total"]["volume_mm3"], volume);
for (axis, left) in [1.0, 1.0, 0.4].iter().enumerate() {
let old = before["total"]["center_of_mass"][axis].as_f64().unwrap();
close(&result["total"]["center_of_mass"][axis], old + hole_volume * (2.0 * old - left - right_hole[axis]) / volume);
}
run(&mut s, "sheet.unfold", json!({}));
let result = run(&mut s, "component.properties", json!({"component": "root"}));
let volume = 240.0 - 2.0 * hole_volume;
close(&result["total"]["volume_mm3"], volume);
for (axis, expected) in [(240.0 * 15.0 - 2.0 * hole_volume * 11.0) / volume, (240.0 * 5.0 - 2.0 * hole_volume) / volume, 0.4].iter().enumerate() {
close(&result["total"]["center_of_mass"][axis], *expected);
}
}
#[test]
fn perforated_sheet_correction_rejects_invalid_metadata_without_partial_changes() {
let mut s = Session::default();
perforated_panel(&mut s);
let state = s.model.state();
let measured = solidcraft_kernel::measure(&state.bodies[0].body).unwrap();
for pitch in [0.0, -1.0, f64::NAN, f64::INFINITY] {
let mut sheet = state.sheets[0].clone();
sheet.perforations[0].pitch = pitch;
let mut actual = measured.clone();
assert!(sheet.correct_perforation_properties(&mut actual, &solidcraft_doc::IDENTITY).is_err());
assert_eq!(actual.volume, measured.volume);
assert_eq!(actual.area, measured.area);
assert_eq!(actual.centroid, measured.centroid);
}
let mut scaled = solidcraft_doc::IDENTITY;
scaled[0][0] = 2.0;
let mut sheared = solidcraft_doc::IDENTITY;
sheared[0][1] = 0.5;
for placement in [scaled, sheared] {
let mut actual = measured.clone();
assert!(state.sheets[0].correct_perforation_properties(&mut actual, &placement).is_err());
assert_eq!((actual.volume, actual.area, actual.centroid), (measured.volume, measured.area, measured.centroid));
}
}
#[test]
fn perforated_sheet_body_transfer_preserves_world_mass_and_centroid() {
let mut s = Session::default();
perforated_panel(&mut s);
let moved = run(&mut s, "component.create", json!({"name": "MovedSheet", "grounded": false}));
run(&mut s, "occurrence.move", json!({"occurrence": moved["occurrence"], "translate": [100, 0, 0]}));
run(&mut s, "component.move_bodies", json!({"bodies": ["Panel"], "component": moved["component"]}));
let (volume, _, center) = perforated_panel_expected();
let mass = volume * s.doc.density("Panel") / 1000.0;
for command in ["component.properties", "inspect.measure"] {
let result = run(&mut s, command, json!({"component": "root"}));
close(&result["total"]["volume_mm3"], volume);
close(&result["total"]["mass_g"], mass);
for (axis, expected) in center.iter().enumerate() {
close(&result["bodies"][0]["center_of_mass"][axis], *expected);
}
}
}
#[test]
fn perforated_sheet_inertia_removes_analytic_hole_cylinders_and_turns_with_the_sheet() {
let mut s = Session::default();
let c = run(&mut s, "component.create", json!({"name": "Sheet", "grounded": false}));
perforated_panel(&mut s);
let (volume, _, center) = perforated_panel_expected();
let old_center = [10.0, 5.0, 0.4];
let mut expected = [[0.0; 3]; 3];
let dimensions: [f64; 3] = [20.0, 10.0, 0.8];
for i in 0..3 {
expected[i][i] = 160.0 * (dimensions[(i + 1) % 3].powi(2) + dimensions[(i + 2) % 3].powi(2)) / 12.0;
}
let hole_volume = std::f64::consts::PI * 0.8;
let own = [hole_volume * (3.0 + 0.64) / 12.0, hole_volume * (3.0 + 0.64) / 12.0, hole_volume / 2.0];
for hole in [[2.0, 2.0, 0.4], [12.0, 2.0, 0.4]] {
let d = [0, 1, 2].map(|i| hole[i] - old_center[i]);
let d2: f64 = d.iter().map(|v| v * v).sum();
for i in 0..3 {
for j in 0..3 {
expected[i][j] -= if i == j { own[i] + hole_volume * d2 } else { 0.0 } - hole_volume * d[i] * d[j];
}
}
}
let d = [0, 1, 2].map(|i| center[i] - old_center[i]);
let d2: f64 = d.iter().map(|v| v * v).sum();
for i in 0..3 {
for j in 0..3 {
expected[i][j] = (expected[i][j] - volume * (if i == j { d2 } else { 0.0 } - d[i] * d[j])) * s.doc.density("Panel") / 1000.0;
}
}
let first = run(&mut s, "component.properties", json!({}));
tensor_close(&first["total"]["inertia_g_mm2"], expected, 1e-9);
let verify_assembly = |s: &mut Session, tensor: [[f64; 3]; 3], center: [f64; 3]| {
let assembly = run(s, "assembly.mass_properties", json!({}));
let occurrence = assembly["occurrences"].as_array().unwrap().iter().find(|o| o["occurrence"] == c["occurrence"]).unwrap();
let mass = &occurrence["mass"];
assert!((mass["mass_kg"].as_f64().unwrap() - volume * s.doc.density("Panel") * 1e-6).abs() < 1e-12);
for (axis, coordinate) in center.iter().enumerate() {
close(&mass["center_of_mass_mm"][axis], *coordinate);
}
tensor_close(&mass["inertia_world_kg_mm2"], tensor.map(|row| row.map(|value| value / 1000.0)), 1e-9);
};
verify_assembly(&mut s, expected, center);
run(
&mut s,
"occurrence.move",
json!({"occurrence": c["occurrence"], "translate": [100, 40, 10], "axis": [0, 0, 1], "angle": "90 deg", "capture": false}),
);
let turned = run(&mut s, "component.properties", json!({}));
let rotation = [[0.0, -1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 1.0]];
let rotated = solidcraft_geom::inertia::transformed(&expected, &rotation);
tensor_close(&turned["total"]["inertia_g_mm2"], rotated, 1e-9);
verify_assembly(&mut s, rotated, [100.0 - center[1], 40.0 + center[0], 10.0 + center[2]]);
}
#[test]
fn properties_reject_hostile_identifiers_and_options() {
let mut s = Session::default();
+106 -5
View File
@@ -7,15 +7,27 @@ use solidcraft_doc::config::{Column, ConfigRow, MAX_COLUMNS, MAX_ROWS};
use super::CommandSpec;
use crate::params::{bad, bool_, str_, string_list};
use crate::schema::config::{ConfigActivation, ConfigRowParams, ConfigTable, ConfigTableParams, ConfigTableReply, ConfigTableRow, ConfigTarget};
use crate::schema::config::{
ConfigActivation, ConfigColumnParams, ConfigConfigureParams, ConfigRowEditParams, ConfigRowParams, ConfigRuleParams, ConfigTable,
ConfigTableParams, ConfigTableReply, ConfigTableRow, ConfigTarget,
};
use crate::schema::{TypedContract, output_schema_for};
use crate::{Result, Session};
const TABLE_CONTRACT: TypedContract<ConfigTableParams> = TypedContract::new();
const ROW_CONTRACT: TypedContract<ConfigRowParams> = TypedContract::new();
const CONFIGURE_CONTRACT: TypedContract<ConfigConfigureParams> = TypedContract::new();
const COLUMN_CONTRACT: TypedContract<ConfigColumnParams> = TypedContract::new();
const ROW_EDIT_CONTRACT: TypedContract<ConfigRowEditParams> = TypedContract::new();
const RULE_CONTRACT: TypedContract<ConfigRuleParams> = TypedContract::new();
pub static COMMANDS: &[CommandSpec] = &[
CommandSpec::new("config.configure", "Configure", configure).at("SOLID", "CONFIGURE").icon("params").params(
CommandSpec::new("config.configure", "Configure", crate::checked!("config.configure", configure))
.at("SOLID", "CONFIGURE")
.icon("params")
.contract(&CONFIGURE_CONTRACT)
.output(output_schema_for::<ConfigTableReply>)
.params(
"params?: [parameter names]; features?: [feature names]; materials?: [body names]; appearances?: [body names] (columns to add; with no rows yet, a \"Default\" row takes the current values)",
),
CommandSpec::new("config.table", "Display Configuration Table", crate::checked!("config.table", show))
@@ -25,8 +37,16 @@ pub static COMMANDS: &[CommandSpec] = &[
.contract(&TABLE_CONTRACT)
.output(output_schema_for::<ConfigTableReply>)
.params("→ columns (param:<name> or suppress:<feature>), rows, the active row and whether the design still matches it"),
CommandSpec::new("config.column", "Configuration Column", column).icon("configuration_table").params("param? | feature? | material? | appearance? (target name); delete?: bool"),
CommandSpec::new("config.row", "Configuration Row", row).icon("configuration_table").params(
CommandSpec::new("config.column", "Configuration Column", crate::checked!("config.column", column))
.icon("configuration_table")
.contract(&COLUMN_CONTRACT)
.output(output_schema_for::<ConfigTableReply>)
.params("param? | feature? | material? | appearance? (target name); delete?: bool"),
CommandSpec::new("config.row", "Configuration Row", crate::checked!("config.row", row))
.icon("configuration_table")
.contract(&ROW_EDIT_CONTRACT)
.output(output_schema_for::<ConfigTableReply>)
.params(
"name; from? (row to copy; default current values); values?: {column key: expression, suppression, material name, appearance name or Look object}; rename?; delete?: bool",
),
CommandSpec::new("config.activate", "Activate Configuration", crate::checked!("config.activate", activate))
@@ -40,7 +60,11 @@ pub static COMMANDS: &[CommandSpec] = &[
.contract(&ROW_CONTRACT)
.output(output_schema_for::<ConfigActivation>)
.params("row: name — validates a rebuild without changing the design or history"),
CommandSpec::new("config.rule", "Configuration Rule", rule).icon("configuration_table").params(
CommandSpec::new("config.rule", "Configuration Rule", crate::checked!("config.rule", rule))
.icon("configuration_table")
.contract(&RULE_CONTRACT)
.output(output_schema_for::<ConfigTableReply>)
.params(
"rule?: {id,name,enabled,condition,effect}; rules?: [rule…] (added or replaced together, then the rows checked once); id? + delete?; id? + index? (ordered move)",
),
CommandSpec::new("config.rules", "Configuration Rules", crate::checked!("config.rules", show))
@@ -331,6 +355,11 @@ fn row(s: &mut Session, p: &Value) -> Result<Value> {
if rename.as_ref().is_some_and(|n| n != &name && s.doc.configs.rows.iter().any(|r| &r.name == n)) {
return Err(bad(cmd, "configuration name already exists"));
}
for (column, value) in s.doc.configs.columns.iter().zip(&cells) {
if matches!(column, Column::Suppress(_)) {
solidcraft_doc::config::suppression_cell(value).map_err(|e| bad(cmd, e.to_string()))?;
}
}
let changes: Vec<_> = s
.doc
.configs
@@ -743,6 +772,78 @@ mod tests {
}
}
#[test]
fn configuration_rows_reject_invalid_suppression_without_changes() {
let mut s = Session::default();
run(&mut s, "sketch.create", json!({"plane":"XY", "name":"TestSketch"}));
run(&mut s, "sketch.finish", json!({}));
run(&mut s, "config.configure", json!({"features":["TestSketch"]}));
let before = s.doc.clone();
let undo_len = s.undo.len();
for value in [json!("banana"), json!(""), json!(2), json!(-1)] {
for params in [
json!({"name":"Bad", "values":{"suppress:TestSketch":value}}),
json!({"name":"Copy", "from":"Default", "values":{"TestSketch":value}}),
json!({"name":"Default", "rename":"Renamed", "values":{"TestSketch":value}}),
] {
let error = s.execute("config.row", &params).expect_err("invalid suppression must be rejected when saving a row");
assert!(error.to_string().contains("suppression must be true or false"), "{params}: {error}");
assert_eq!(s.doc, before, "{params}");
assert_eq!(s.undo.len(), undo_len, "{params}");
}
}
}
#[test]
fn configuration_rows_validate_inherited_suppression_and_allow_repair() {
let mut s = Session::default();
run(&mut s, "sketch.create", json!({"plane":"XY", "name":"TestSketch"}));
run(&mut s, "sketch.finish", json!({}));
run(&mut s, "config.configure", json!({"features":["TestSketch"]}));
// A row saved by an older reader may already contain invalid suppression text.
s.doc_mut().configs.rows[0].cells[0] = "banana".into();
let before = s.doc.clone();
let undo_len = s.undo.len();
for params in [json!({"name":"Copy", "from":"Default"}), json!({"name":"Default", "rename":"Renamed"})] {
let error = s.execute("config.row", &params).expect_err("inherited invalid suppression must also be checked");
assert!(error.to_string().contains("suppression must be true or false"), "{params}: {error}");
assert_eq!(s.doc, before, "{params}");
assert_eq!(s.undo.len(), undo_len, "{params}");
}
run(&mut s, "config.row", json!({"name":"Default", "values":{"TestSketch":false}}));
assert_eq!(s.doc.configs.rows[0].cells[0], "false");
run(&mut s, "config.activate", json!({"row":"Default"}));
assert!(!s.doc.features[0].suppressed);
}
#[test]
fn configuration_rows_keep_supported_suppression_spellings() {
let mut s = Session::default();
run(&mut s, "sketch.create", json!({"plane":"XY", "name":"TestSketch"}));
run(&mut s, "sketch.finish", json!({}));
run(&mut s, "config.configure", json!({"features":["TestSketch"]}));
for (value, suppressed) in [
(json!(true), true),
(json!(false), false),
(json!(1), true),
(json!(0), false),
(json!("true"), true),
(json!("false"), false),
(json!(" YES "), true),
(json!(" No "), false),
(json!("1"), true),
(json!("0"), false),
] {
let before = s.doc.features.clone();
run(&mut s, "config.row", json!({"name":"Accepted", "values":{"suppress:TestSketch":value}}));
assert_eq!(s.doc.features, before, "saving a row does not activate it");
let text = value.as_str().map(str::to_owned).unwrap_or_else(|| value.to_string());
assert_eq!(s.doc.configs.rows[1].cells[0], text, "accepted spellings are preserved");
run(&mut s, "config.activate", json!({"row":"Accepted"}));
assert_eq!(s.doc.features[0].suppressed, suppressed, "{value}");
}
}
#[test]
fn configuration_rows_validate_the_final_parameter_graph_without_activating_it() {
let mut s = Session::default();
+44 -5
View File
@@ -105,7 +105,7 @@ pub static COMMANDS: &[CommandSpec] = &[
.at("SOLID", "CREATE")
.icon("hole")
.key("H")
.params("position: [x,y,z] on a face (numbers, or length expressions the hole follows) | sketch + points: [sketch point ids] (one hole each, perpendicular to the sketch, into the material on whichever side of the sketch plane it is) | sketch alone (every sketch point: standalone points and circle centres); flip?: bool (sketch points: drill to the other side); single?: bool (with one sketch point: a Single hole that follows the point, drilled into the face there); direction?: [x,y,z] (default: into the face, against its outward normal; one that leaves the face is mirrored into it; ignored with sketch points unless single); diameter | thread (a tapped hole, drilled with the tap maker's tabulated drill: ISO metric (a custom metric size: major minus pitch), UNC/UNF, G, Rp, Rc 1/16 to 4, NPT 1/16 to 3; a `diameter` given with it chooses another drill, from the thread's minor diameter to 5% over the tap maker's) | clearance: \"M6\" with fit?: close|normal|loose (ISO 273); depth? (default through all) | to?: [x,y,z] (To Object: drill to that face or point); references?: [{edge: [x,y,z] on a straight edge of the face, distance: expr}] (at most two; the centre goes that far from each edge's line, in the face's plane, and follows the edges; with a numeric position only); type?: simple|drilled|counterbore|countersink; tip_angle?; cb_diameter?, cb_depth?; cs_diameter?, cs_angle?; thread?: \"M6\", \"1/4-20 UNC\", \"G 1/4\", \"Rp 1/4\", \"Rc 1/4\" or \"1/4-18 NPT\" (cosmetic unless modeled); hand?: right|left (the tapped thread's hand; default right; needs thread); thread_depth?: positive length independent of drill depth (default: full useful cylindrical wall; must fit that wall); modeled?: bool (needs thread: the tapped thread cut into the wall, the groove between its teeth, as solid.thread's modelled one; default false: listed only); ease_out?: expr|standard|short (modelled tapped threads: the inner end, towards the bottom, fades out over this length, ISO 3508's runout, standard 2.5 P, short 1.25 P; without it the groove stops square at thread_depth, or clear of a blind hole's bottom); targets?: [body] (the bodies to drill; holes at the points of a sketch on a body's face default to that body, found along the holes' direction on it alone; explicit targets or participants override, [\"*\"] every body)"),
.params("position: [x,y,z] on a face (numbers, or length expressions the hole follows) | sketch + points: [sketch point ids] (one hole each, perpendicular to the sketch, into the material on whichever side of the sketch plane it is) | sketch alone (every sketch point: standalone points and circle centres); flip?: bool (sketch points: drill to the other side); single?: bool (with one sketch point: a Single hole that follows the point, drilled into the face there); direction?: [x,y,z] (default: into the face, against its outward normal; one that leaves the face is mirrored into it; ignored with sketch points unless single); diameter | thread (a tapped hole, drilled with the tap maker's tabulated drill: ISO metric (a custom metric size: major minus pitch), UNC/UNF, G, Rp, Rc 1/16 to 4, NPT 1/16 to 3; a `diameter` given with it chooses another drill, from the thread's minor diameter to 5% over the tap maker's) | clearance: \"M6\" with fit?: close|normal|loose (ISO 273); depth? (default through all) | to?: [x,y,z] (To Object: drill to that face or point); references?: [{edge: [x,y,z] on a straight edge of the face, distance: expr}] (at most two; the centre goes that far from each edge's line, in the face's plane, and follows the edges; with a numeric position only); type?: simple|drilled|counterbore|countersink; tip_angle?; cb_diameter?, cb_depth?, bridge?: length (counterbore: two 3D-printing bridge layers this thick below its floor, a slot along X then a square; e.g. 0.2 mm); cs_diameter?, cs_angle?; thread?: \"M6\", \"1/4-20 UNC\", \"G 1/4\", \"Rp 1/4\", \"Rc 1/4\" or \"1/4-18 NPT\" (cosmetic unless modeled); hand?: right|left (the tapped thread's hand; default right; needs thread); thread_depth?: positive length independent of drill depth (default: full useful cylindrical wall; must fit that wall); modeled?: bool (needs thread: the tapped thread cut into the wall, the groove between its teeth, as solid.thread's modelled one; default false: listed only); ease_out?: expr|standard|short (modelled tapped threads: the inner end, towards the bottom, fades out over this length, ISO 3508's runout, standard 2.5 P, short 1.25 P; without it the groove stops square at thread_depth, or clear of a blind hole's bottom); targets?: [body] (the bodies to drill; holes at the points of a sketch on a body's face default to that body, found along the holes' direction on it alone; explicit targets or participants override, [\"*\"] every body)"),
CommandSpec::new("solid.pipe", "Pipe", crate::checked!("solid.pipe", pipe))
.at("SOLID", "CREATE")
.icon("pipe")
@@ -2600,6 +2600,18 @@ fn split_body(s: &mut Session, p: &Value) -> Result<Value> {
add_feature(s, p, FeatureKind::Split { body: BodyName(body), plane, tool: None, sketch: None, line: None })
}
/// The fits [`clearance_diameter`] knows (close, normal, loose, and their older names).
const CLEARANCE_FITS: [&str; 6] = ["close", "fine", "normal", "medium", "loose", "coarse"];
/// A value typed by the user, cut short for a message.
fn brief(text: &str) -> String {
const MAX: usize = 32;
match text.char_indices().nth(MAX) {
Some((end, _)) => format!("{}…", &text[..end]),
None => text.to_string(),
}
}
/// ISO 273 clearance hole diameters (close, normal, loose fit) for metric bolts.
fn clearance_diameter(size: &str, fit: &str) -> Option<f64> {
const TABLE: [(f64, f64, f64, f64); 21] = [
@@ -2808,10 +2820,18 @@ fn hole(s: &mut Session, p: &Value) -> Result<Value> {
let position = if references.is_empty() { position } else { referenced_centre(s, cmd, &references, position, direction)? };
// The diameter: given, or a metric-estimate/Unified-table tap drill, or an ISO 273
// clearance hole for a bolt size (close, normal or loose fit).
// A diameter number out of range says so, rather than that none was given (#9625).
if matches!(p.get("diameter"), Some(Value::Number(_))) && expr(p, "diameter").is_none() {
return Err(bad(cmd, format!("`diameter` {}", expr_problem(p.get("diameter")))));
}
let diameter = match (expr(p, "diameter"), &thread, str_(p, "clearance")) {
(Some(d), _, _) => d,
(None, _, Some(c)) => {
let fit = str_(p, "fit").unwrap_or("normal").to_ascii_lowercase();
// An unknown fit is not an unknown bolt size (#9625).
if !CLEARANCE_FITS.contains(&fit.as_str()) {
return Err(bad(cmd, format!("`fit` must be close, normal or loose, not `{}`", brief(&fit))));
}
let d = clearance_diameter(c, &fit).ok_or_else(|| bad(cmd, format!("no clearance hole for `{c}` ({fit} fit): M1.6 to M64")))?;
Expr::new(format!("{d} mm"))
}
@@ -2838,22 +2858,41 @@ fn hole(s: &mut Session, p: &Value) -> Result<Value> {
let e = req_expr(cmd, p, k)?;
Ok(e)
};
// Given but unreadable (`true`, a list, an empty text): refused, never a plain counterbore.
let bridge = match (expr(p, "bridge"), p.get("bridge")) {
(Some(b), _) => Some(b),
(None, None | Some(Value::Null)) => None,
(None, v) => return Err(bad(cmd, format!("`bridge` {}", expr_problem(v)))),
};
let kind = match str_(p, "type").unwrap_or("simple") {
"simple" => match expr(p, "tip_angle") {
Some(t) if depth.is_some() => solidcraft_doc::HoleKind::Drilled { tip_angle: t },
_ => solidcraft_doc::HoleKind::Simple,
},
"drilled" => solidcraft_doc::HoleKind::Drilled { tip_angle: expr(p, "tip_angle").unwrap_or_else(|| "118 deg".into()) },
"counterbore" => {
solidcraft_doc::HoleKind::Counterbore { cb_diameter: get("cb_diameter")?, cb_depth: get("cb_depth")?, tip_angle: expr(p, "tip_angle") }
}
"counterbore" => solidcraft_doc::HoleKind::Counterbore {
cb_diameter: get("cb_diameter")?,
cb_depth: get("cb_depth")?,
tip_angle: expr(p, "tip_angle"),
bridge: bridge.clone(),
},
"countersink" => solidcraft_doc::HoleKind::Countersink {
cs_diameter: get("cs_diameter")?,
cs_angle: expr(p, "cs_angle").unwrap_or_else(|| "90 deg".into()),
// The default only when no angle is given: a supplied one out of range is refused (#9625).
cs_angle: match p.get("cs_angle") {
None | Some(Value::Null) => "90 deg".into(),
Some(Value::String(t)) if t.trim().is_empty() => "90 deg".into(),
Some(_) => req_expr(cmd, p, "cs_angle")?,
},
tip_angle: expr(p, "tip_angle"),
},
other => return Err(bad(cmd, format!("unknown hole type `{other}`"))),
};
match (&kind, &bridge) {
(solidcraft_doc::HoleKind::Counterbore { .. }, Some(b)) => check_expr(s, b, Kind::Length, cmd, "bridge")?,
(_, Some(_)) => return Err(bad(cmd, "`bridge` needs `type: counterbore`")),
_ => {}
}
let to = match p.get("to") {
Some(v) => Some(vec3(v).ok_or_else(|| bad(cmd, "`to` must be a point [x, y, z] on the face to drill to"))?),
None => None,
+75 -2
View File
@@ -31,7 +31,7 @@ pub static COMMANDS: &[CommandSpec] = &[
.icon("open")
.key("Ctrl+O")
.noundo()
.params("path: .sc design (or a .solidcraft design from an earlier release), .dxf/.svg drawing (opens as a new, unsaved design with an XY sketch, using sketch.insert_dxf/sketch.insert_svg units and defaults), or a .step/.stp/.igs/.fcstd/.3dm/.3mf/.stl/.obj/.glb/.gltf file (STEP, IGES, FreeCAD, Rhino, 3MF, STL, OBJ or glTF; opens as a new design holding the file as a component named after it, as file.insert_step and file.insert_mesh make), or a .ply/.xyz/.pts point cloud (opens as a new design holding it, as pointcloud.insert makes; its `units` and `max_points` as there); up?: z|y for a STEP, IGES, FreeCAD, Rhino or glTF file (see file.insert_step and file.insert_mesh); names?: auto|solid|product|instance for a STEP, IGES, FreeCAD or Rhino file (see file.insert_step); read_only?: bool (a design: saving to its own file is refused, file.save_as keeps the changes elsewhere) → open_elsewhere: {host, user, app, opened} when another SolidCraft has the design open (its lock file is fresh)"),
.params("path: .sc design (or a .solidcraft design from an earlier release), .dxf/.svg drawing (opens as a new, unsaved design with an XY sketch, using sketch.insert_dxf/sketch.insert_svg units and defaults), or a .step/.stp/.igs/.fcstd/.3dm/.3mf/.stl/.obj/.glb/.gltf file (STEP, IGES, FreeCAD, Rhino, 3MF, STL, OBJ or glTF; opens as a new design holding the file as a component named after it, as file.insert_step and file.insert_mesh make), or a .ply/.xyz/.pts point cloud (opens as a new design holding it, as pointcloud.insert makes; its `units` and `max_points` as there); up?: z|y for a STEP, IGES, FreeCAD, Rhino or glTF file (see file.insert_step and file.insert_mesh); names?: auto|solid|product|instance for a STEP, IGES, FreeCAD or Rhino file (see file.insert_step); read_only?: bool (a design: saving to its own file is refused, file.save_as keeps the changes elsewhere) → open_elsewhere: {host, user, app, opened} when another SolidCraft has the design open (its lock file is fresh); newer_file: {format, reads_up_to, unknown_changes, not_understood, notice} and warnings when a newer SolidCraft saved it: it opens all the same, and what this version can't read is named there and kept by saving"),
CommandSpec::new("file.insert_step", "Insert STEP", insert_step)
.at("SOLID", "INSERT")
.icon("import")
@@ -427,6 +427,11 @@ fn opened_design(
if read_only {
out["read_only"] = json!(true);
}
// A newer SolidCraft saved it: opened all the same, and the reply says so.
if let Some(file) = &s.doc.newer_file {
out["newer_file"] = file.report();
out["warnings"] = json!(file.warnings());
}
let now = solidcraft_io::design_lock::now_secs();
if let Some(lock) = solidcraft_io::design_lock::held_elsewhere(std::path::Path::new(path), now) {
out["open_elsewhere"] = json!({"host": lock.host, "user": lock.user, "app": lock.app, "opened": lock.opened});
@@ -573,7 +578,21 @@ fn write_bytes(
s.disk = solidcraft_io::design_lock::stamp(path);
s.read_only = false;
s.mark_saved();
Ok(json!({"path": path, "bytes": bytes.len(), "name": s.doc.name}))
let mut out = json!({"path": path, "bytes": bytes.len(), "name": s.doc.name});
// A newer SolidCraft's file keeps what this version can't read, and its format number. What
// couldn't go back, because the design was changed around it, is said.
if s.doc.newer_file.is_some() {
let mut lost = solidcraft_doc::newer_file::not_kept(&s.doc);
if format == "json" && s.doc.newer_file.as_ref().is_some_and(|file| file.needs_container()) {
lost.push("the parts of the file beside the design, which plain JSON has no room for: save as .sc to keep them".to_string());
}
out["kept_format"] = json!(s.doc.format);
if !lost.is_empty() {
out["warnings"] = json!(lost.iter().map(|what| format!("Not kept: {what}. The previous file is `{path}.bak`.")).collect::<Vec<_>>());
out["not_kept"] = json!(lost);
}
}
Ok(out)
}
impl Session {
@@ -1392,6 +1411,60 @@ mod tests {
let _ = std::fs::remove_dir_all(&dir);
}
/// A design a newer SolidCraft saved opens through the command agents and the app use: the
/// reply warns, what it can't read shows as that feature's error, work goes on around it, and
/// saving keeps the feature and the file's number in both encodings.
#[test]
fn a_newer_design_opens_and_saving_keeps_what_it_cant_read() {
let dir = std::env::temp_dir().join(format!("sc_newer_design_{}", std::process::id()));
std::fs::create_dir_all(&dir).unwrap();
let mut s = Session::default();
s.execute("solid.box", &json!({"length": 2, "width": 3, "height": 4})).unwrap();
let mut file: Value = serde_json::from_str(&s.doc.to_json()).unwrap();
let newer = solidcraft_doc::format::format_string(solidcraft_doc::format::FORMAT + 1);
file["format"] = json!(newer);
let future = json!({"id": 900, "name": "Lattice1", "type": "gyroid_lattice", "cell": 2.5});
file["features"].as_array_mut().unwrap().push(future.clone());
file["future_section"] = json!([1, 2]);
for name in ["newer.json", "newer.sc"] {
let path = dir.join(name);
let source = solidcraft_doc::Document::from_json(&file.to_string()).unwrap();
let bytes = if name.ends_with(".sc") { solidcraft_io::write_design_container(&source).unwrap() } else { file.to_string().into_bytes() };
std::fs::write(&path, bytes).unwrap();
let path = path.to_string_lossy().to_string();
let mut opened = Session::default();
let reply = opened.execute("doc.open", &json!({"path": path})).unwrap();
assert_eq!(reply["errors"], 1, "{reply}");
assert_eq!(reply["features"], 2, "{reply}");
assert!(reply["newer_file"]["not_understood"].to_string().contains("gyroid_lattice"), "{reply}");
let first = reply["warnings"][0].as_str().unwrap();
assert_eq!(
first,
format!(
"Saved by a newer SolidCraft (format {}, this version reads up to {}). If something's missing, update.",
solidcraft_doc::format::FORMAT + 1,
solidcraft_doc::format::FORMAT
)
);
assert_eq!(opened.model.state().bodies.len(), 1, "the box still builds");
let lattice = opened.doc.features.iter().position(|f| f.name == "Lattice1").unwrap();
assert!(opened.model.results[lattice].error.as_deref().unwrap().contains("gyroid_lattice"));
opened.execute("solid.box", &json!({"length": 1, "width": 1, "height": 1})).unwrap();
let saved = opened.execute("file.save", &json!({})).unwrap();
assert_eq!(saved["kept_format"], json!(newer), "{saved}");
assert!(saved.get("not_kept").is_none(), "{saved}");
let mut again = Session::default();
again.execute("doc.open", &json!({"path": path})).unwrap();
assert_eq!(again.doc.features.len(), 3);
assert_eq!(again.model.state().bodies.len(), 2);
let written: Value = serde_json::from_str(&again.doc.to_json()).unwrap();
assert_eq!(written["format"], json!(newer));
assert_eq!(written["future_section"], json!([1, 2]));
assert!(written["features"].as_array().unwrap().contains(&future));
}
let _ = std::fs::remove_dir_all(&dir);
}
/// #5467: a script, the CLI or the control channel never gets a prompt. A Save over a file
/// another program or computer changed since it was opened is refused with an error naming
/// `overwrite`, which replaces it; a design opened read-only only saves to another file.
+35 -30
View File
@@ -128,7 +128,30 @@ pub(crate) fn encloses_volume(body: &solidcraft_kernel::Body) -> bool {
}
pub fn measure_json(b: &solidcraft_doc::ModelBody) -> Value {
match b.measure() {
measure_sheet_json(b, None)
}
pub(super) fn measure_body(
b: &solidcraft_doc::ModelBody,
definitions: Option<&solidcraft_doc::ModelState>,
) -> Result<solidcraft_kernel::BodyMeasure> {
let mut measured = b.measure()?;
if let Some(state) = definitions
&& let Some(sheet) = state.sheets.iter().find(|sheet| sheet.body == b.definition_name() && !sheet.perforations.is_empty())
{
let definition = state.body(b.definition_name()).ok_or_else(|| EngineError::Other(format!("missing sheet body `{}`", sheet.body)))?;
// A body transfer moves the geometry and sheet metadata together. Apply only
// the placement relative to the current definition, so holes move once.
let inverse = solidcraft_doc::mat_inverse(&definition.source_transform)
.ok_or_else(|| EngineError::Other(format!("invalid sheet placement for `{}`", sheet.body)))?;
let placement = solidcraft_doc::mat_mul(&b.source_transform, &inverse);
sheet.correct_perforation_properties(&mut measured, &placement)?;
}
Ok(measured)
}
fn measure_sheet_json(b: &solidcraft_doc::ModelBody, definitions: Option<&solidcraft_doc::ModelState>) -> Value {
match measure_body(b, definitions) {
Ok(m) => {
let closed = encloses_volume(&b.body);
json!({
@@ -157,6 +180,7 @@ fn measure(s: &mut Session, p: &Value) -> Result<Value> {
return super::measure_sel::measure_items(s, items);
}
let want = string_list(cmd, p, "bodies")?;
let definitions = s.model.state();
let st = s.world_state()?;
let selected: Vec<_> = st.bodies.iter().filter(|b| want.is_empty() || want.contains(&b.name)).collect();
if !want.is_empty() && selected.len() != want.len() {
@@ -167,7 +191,7 @@ fn measure(s: &mut Session, p: &Value) -> Result<Value> {
return Ok(json!({"body_count": bodies.len(), "bodies": bodies}));
}
// Each body is measured on its own: on all cores, in body order.
let mut bodies: Vec<Value> = solidcraft_kernel::map_on_threads(&selected, 16, |b| measure_json(b))
let mut bodies: Vec<Value> = solidcraft_kernel::map_on_threads(&selected, 16, |b| measure_sheet_json(b, Some(&definitions)))
.into_iter()
.zip(&selected)
.map(|(m, b)| m.unwrap_or_else(|| json!({"name": b.name, "error": "measuring this body failed"})))
@@ -182,35 +206,13 @@ fn measure(s: &mut Session, p: &Value) -> Result<Value> {
b["density_g_cm3"] = json!(rho);
b["mass_g"] = json!(v * rho / 1000.0);
}
}
// Sheet metal keeps the edges where bends meet flat faces (so bends stay visible): count its
// B-rep faces as they are, without merging coplanar neighbours.
let sheets = s.model.state().sheets.clone();
for b in &mut bodies {
if let Some(sh) = sheets.iter().find(|x| b["name"].as_str() == Some(x.body.as_str())) {
let (df, de, dv) = sh.round_hole_correction();
for (k, d) in [("faces", df), ("edges", de), ("vertices", dv)] {
b[k] = json!(b["kernel"][k].as_i64().unwrap_or(0) + d);
// Only Measure exposes sheet boundary counts; document.inspect keeps kernel counts.
if let Some(sheet) = definitions.sheets.iter().find(|sheet| sheet.body == source) {
let (df, de, dv) = sheet.round_hole_correction();
for (key, delta) in [("faces", df), ("edges", de), ("vertices", dv)] {
b[key] = json!(b["kernel"][key].as_i64().unwrap_or(0) + delta);
}
b["sheet_metal"] = json!(true);
// A perforation field (#732) is not cut into the B-rep: take its open area out of the volume, the mass
// and the area (both faces minus the holes, plus the bores).
let open = sh.perforated_area();
if open > 0.0 {
if let Some(v) = b["volume_mm3"].as_f64() {
let nv = v - open * sh.t;
if let Some(m) = b["mass_g"].as_f64().filter(|_| v > 0.0) {
b["mass_g"] = json!(m * nv / v);
}
b["volume_mm3"] = json!(nv);
}
let bores: f64 = sh
.perforations
.iter()
.map(|p| sh.perforation_holes(p).map_or(0.0, |h| h.len() as f64) * std::f64::consts::PI * p.diameter * sh.t)
.sum();
b["area_mm2"] = json!(b["area_mm2"].as_f64().unwrap_or(0.0) - 2.0 * open + bores);
}
}
}
let skipped = bodies.iter().filter(|b| b["closed"] == false).count();
@@ -395,9 +397,12 @@ fn inspect(s: &mut Session, p: &Value) -> Result<Value> {
})
})
.collect();
let definitions = s.model.state();
let with_measure = bool_(p, "measure").unwrap_or(false);
// Each body is measured on its own: on all cores, in body order (as `inspect.measure`).
let mut measured = if with_measure { solidcraft_kernel::map_on_threads(&st.bodies, 16, measure_json) } else { Vec::new() }.into_iter();
let mut measured =
if with_measure { solidcraft_kernel::map_on_threads(&st.bodies, 16, |b| measure_sheet_json(b, Some(&definitions))) } else { Vec::new() }
.into_iter();
let bodies: Vec<Value> = st
.bodies
.iter()
+2 -1
View File
@@ -620,12 +620,13 @@ pub(crate) fn joint_id(s: &Session, v: Option<&Value>, cmd: &str) -> Result<u64>
/// A joint value: numbers are degrees for angles and mm for distances; text is an expression.
pub(crate) fn value(s: &Session, v: &Value, angle: bool, cmd: &str) -> Result<f64> {
let kind = if angle { Kind::Angle } else { Kind::Length };
// A number out of range says so, rather than that it is not a number (#9625).
let e = match v {
Value::Number(n) => n.as_f64().filter(|x| x.is_finite() && x.abs() < 1e9).map(|x| x.to_string()),
Value::String(t) => Some(t.clone()),
_ => None,
}
.ok_or_else(|| bad(cmd, "values must be numbers or expressions"))?;
.ok_or_else(|| bad(cmd, format!("a joint value {}", crate::params::expr_problem(Some(v)))))?;
s.doc.eval(&e, kind).map_err(|e| bad(cmd, e.to_string()))
}
@@ -408,3 +408,24 @@ fn a_motion_link_takes_its_driven_joints_freedom_with_nothing_grounded() {
}
}
}
/// Rolling the marker back works a gear's ratio out from the faces as they were then, so the
/// editor's pinned model and its source differ in the link's ratio, and the edit still goes
/// through.
#[test]
fn an_editor_accepts_the_ratios_rolling_the_marker_works_out() {
let mut s = gear_train();
let before = s.doc.features.len();
// G1's wall moves out to a radius of 12, so the link's ratio goes from -0.5 to -0.6.
run(&mut s, "solid.offset_face", json!({"faces": [[10, 0, 2.5]], "distance": 2}));
let ratio = |s: &Session| s.doc.assembly.links.first().map(|l| l.ratio).unwrap_or(f64::NAN);
assert!(close_to(ratio(&s), -0.6), "{}", ratio(&s));
let original = s.scratch();
run(&mut s, "timeline.roll_to", json!({"position": before}));
let source = s.scratch();
assert!(close_to(ratio(&source), -0.5), "before the offset, the pitch radius is 10: {}", ratio(&source));
let prepared = s.scratch().compute_editor_commands(&[], &source, original).unwrap();
s.accept_commands(prepared).unwrap();
assert_eq!(s.doc.marker, None);
assert!(close_to(ratio(&s), -0.6), "{}", ratio(&s));
}
+21
View File
@@ -124,6 +124,27 @@ fn revolute_hinge_turns_about_the_knuckle() {
assert!(near(place(&s, "LeafB", p), Vec3::new(20.0, 29.0, 37.0)));
}
/// A joint value too large says so, rather than that it is not a number (#9625).
#[test]
fn a_joint_value_out_of_range_says_so() {
let mut s = Session::default();
leaf(&mut s, "LeafA");
leaf(&mut s, "LeafB");
let o = occ(&s, "LeafA");
run(&mut s, "occurrence.ground", json!({"occurrence": o, "grounded": true}));
let hinge = json!({"type": "revolute", "a": {"occurrence": "LeafA", "circle": [1, 37, 4]}, "b": {"occurrence": "LeafB", "circle": [1, 37, 4]}, "flip": true, "name": "Hinge"});
run(&mut s, "joint.create", hinge);
for value in [json!(1e9), json!(-5e15)] {
let e = s.execute("joint.drive", &json!({"joint": "Hinge", "value": value})).err().map(|e| e.to_string()).unwrap_or_default();
assert!(
e.contains("a joint value must be a number between -1e9 and 1e9") && !e.contains("a joint value must be a number or"),
"{value}: {e}"
);
}
let e = s.execute("joint.drive", &json!({"joint": "Hinge", "value": true})).err().map(|e| e.to_string()).unwrap_or_default();
assert!(e.contains("a joint value must be a number or an expression") && !e.contains("between"), "{e}");
}
/// Two 10 mm cubes in components A (grounded) and B.
fn two_cubes() -> Session {
let mut s = Session::default();
+14 -3
View File
@@ -242,9 +242,20 @@ pub fn assembly(doc: &Document, state: &ModelState) -> Result<AssemblyMassResult
if !closed {
return Ok(Shape { closed, volume: 0.0, centroid: Vec3::ZERO, gyration: None });
}
let m = solidcraft_kernel::measure_mass(&body.body)?;
let gyration = solidcraft_io::mass_properties(&body.body)?.and_then(|p| p.gyration());
Ok(Shape { closed, volume: m.volume, centroid: m.centroid, gyration })
let sheet = state.sheets.iter().find(|sheet| sheet.body == body.definition_name() && !sheet.perforations.is_empty());
let (volume, centroid) = if sheet.is_some() {
let measured = super::inspect::measure_body(body, Some(state))?;
(measured.volume, measured.centroid)
} else {
let measured = solidcraft_kernel::measure_mass(&body.body)?;
(measured.volume, measured.centroid)
};
let mut moments = solidcraft_io::mass_properties(&body.body)?;
if let (Some(sheet), Some(moments)) = (sheet, moments.as_mut()) {
sheet.correct_perforation_mass_properties(moments, &IDENTITY)?;
}
let gyration = moments.and_then(|p| p.gyration());
Ok(Shape { closed, volume, centroid, gyration })
});
let mut shape: BTreeMap<usize, Shape> = BTreeMap::new();
for (i, s) in measured.into_iter().zip(shapes) {
+16 -5
View File
@@ -1,15 +1,24 @@
//! Read-only validation of candidate engineering data; no assignment or simulation.
use super::CommandSpec;
use crate::params::bad;
use crate::schema::material_properties::{CardModulus, CardValidated, DirectionalModulusParams, ValidateCardParams};
use crate::schema::{TypedContract, output_schema_for};
use crate::{Result, Session};
use serde_json::{Value, json};
use serde_json::Value;
pub static COMMANDS: &[CommandSpec] = &[CommandSpec::new("material.properties.validate", "Validate Physical Material Data", validate)
const VALIDATE_CONTRACT: TypedContract<ValidateCardParams> = TypedContract::new();
const DIRECTIONAL_CONTRACT: TypedContract<DirectionalModulusParams> = TypedContract::new();
pub static COMMANDS: &[CommandSpec] = &[CommandSpec::new("material.properties.validate", "Validate Physical Material Data", crate::checked!("material.properties.validate", validate))
.icon("material")
.noundo()
.doc_only()
.contract(&VALIDATE_CONTRACT)
.output(output_schema_for::<CardValidated>)
.params("card: schema_version 1 engineering material card in SI units. Returns numerical consistency, derived isotropic moduli, missing conditions and sources needing review. Read-only; does not assign/save properties or provide an analysis solver. See docs/physical-material-cards.md"),
CommandSpec::new("material.properties.directional", "Directional Elastic Modulus", directional).icon("material").noundo().doc_only()
CommandSpec::new("material.properties.directional", "Directional Elastic Modulus", crate::checked!("material.properties.directional", directional)).icon("material").noundo().doc_only()
.contract(&DIRECTIONAL_CONTRACT)
.output(output_schema_for::<CardModulus>)
.params("card: schema_version 1 engineering material card; direction: three finite nonzero-vector components in the card's material-local axes. Returns normalized direction, Young modulus in Pa and source/condition review. Read-only constitutive query; no structural solver, persistence or body-axis assignment. See docs/physical-material-cards.md")];
fn directional(_: &mut Session, params: &Value) -> Result<Value> {
@@ -28,7 +37,7 @@ fn directional(_: &mut Session, params: &Value) -> Result<Value> {
let direction = [component(0)?, component(1)?, component(2)?];
let card = solidcraft_doc::physical_material::admit_card(value).map_err(|e| bad(cmd, e.to_string()))?;
let response = card.directional_modulus(direction).map_err(|e| bad(cmd, e.to_string()))?;
serde_json::to_value(response).map_err(|e| bad(cmd, e.to_string()))
serde_json::to_value(CardModulus::from(response)).map_err(|e| bad(cmd, e.to_string()))
}
fn validate(_: &mut Session, params: &Value) -> Result<Value> {
@@ -38,13 +47,15 @@ fn validate(_: &mut Session, params: &Value) -> Result<Value> {
.ok_or_else(|| bad("material.properties.validate", "expected {card: ...}"))?;
let card = object.get("card").ok_or_else(|| bad("material.properties.validate", "missing card"))?;
let result = solidcraft_doc::physical_material::validate_card(card).map_err(|e| bad("material.properties.validate", e.to_string()))?;
Ok(json!({"valid":true,"validation":result}))
let reply = CardValidated { valid: true, validation: result.into(), param_warnings: Vec::new() };
serde_json::to_value(reply).map_err(|e| bad("material.properties.validate", e.to_string()))
}
#[cfg(test)]
mod tests {
use super::*;
use crate::doc::Document;
use serde_json::json;
use std::sync::Arc;
fn card() -> Value {
+6 -1
View File
@@ -380,7 +380,12 @@ fn describe(s: &Session, st: &solidcraft_doc::ModelState, sel: &Sel) -> Option<I
let closed = crate::cmd::inspect::encloses_volume(&body.body);
let m = body.mesh();
let tris: Vec<[Vec3; 3]> = m.triangles.iter().filter_map(|t| m.tri(t)).collect();
let v = m.measure().volume;
let definitions = s.model.state();
let v = if definitions.sheets.iter().any(|sheet| sheet.body == body.definition_name() && !sheet.perforations.is_empty()) {
super::inspect::measure_body(body, Some(&definitions)).ok()?.volume
} else {
m.measure().volume
};
plain(Geo::Tris(tris), None, json!({"type": "body", "name": name, "closed": closed, "volume_mm3": closed.then_some(v)}))
}
Sel::SketchCurve { id, sketch } => sketch_curve(sketch_of(s, st, *sketch, |sk| sk.curve_index(id).is_some())?, id),
+38 -13
View File
@@ -10,28 +10,52 @@ use solidcraft_doc::metadata::{self, BOM_TYPE, MAX_KEYS, Owner};
use super::CommandSpec;
use crate::params::{bad, str_};
use crate::schema::metadata::{MetadataParams, MetadataRemoveParams, MetadataRemoveResult, MetadataResult, MetadataSetParams, MetadataSetResult};
use crate::schema::{TypedContract, output_schema_for};
use crate::{Result, Session};
const READ_CONTRACT: TypedContract<MetadataParams> = TypedContract::new();
const SET_CONTRACT: TypedContract<MetadataSetParams> = TypedContract::new();
const REMOVE_CONTRACT: TypedContract<MetadataRemoveParams> = TypedContract::new();
pub static COMMANDS: &[CommandSpec] = &[
CommandSpec::new("document.metadata", "Design Properties", read).icon("settings").noundo().doc_only().params(
"→ metadata: the design's metadata object as saved (other tools' keys too); properties: each of SolidCraft's design \
properties (project, part number, revision…), its text or null (absent, or not text)",
),
CommandSpec::new("document.metadata.set", "Change Design Properties", set).icon("settings").doc_only().params(
"key and value, or values: {key: value, …} (all or nothing, one undo step). SolidCraft's keys, the ones document.metadata's \
properties lists, take text (\"\" or null removes); another tool's data goes under its reverse-DNS key such as \
com.example.tool (an object; null removes) → metadata, changed: [keys]",
),
CommandSpec::new("document.metadata.remove", "Remove Design Property", remove)
CommandSpec::new("document.metadata", "Design Properties", crate::checked!("document.metadata", read))
.icon("settings")
.noundo()
.doc_only()
.contract(&READ_CONTRACT)
.output(output_schema_for::<MetadataResult>)
.params(
"→ metadata: the design's metadata object as saved (other tools' keys too); properties: each of SolidCraft's design \
properties (project, part number, revision…), its text or null (absent, or not text)",
),
CommandSpec::new("document.metadata.set", "Change Design Properties", crate::checked!("document.metadata.set", set))
.icon("settings")
.doc_only()
.contract(&SET_CONTRACT)
.output(output_schema_for::<MetadataSetResult>)
.params(
"key and value, or values: {key: value, …} (all or nothing, one undo step). SolidCraft's keys, the ones document.metadata's \
properties lists, take text (\"\" or null removes); another tool's data goes under its reverse-DNS key such as \
com.example.tool (an object; null removes) → metadata, changed: [keys]",
),
CommandSpec::new("document.metadata.remove", "Remove Design Property", crate::checked!("document.metadata.remove", remove))
.icon("delete")
.doc_only()
.contract(&REMOVE_CONTRACT)
.output(output_schema_for::<MetadataRemoveResult>)
.params("key, or keys: [keys] (any key, also one another tool wrote) → metadata, removed: [keys that were there]"),
];
/// A reply built from its schema's type, so the two can't drift apart.
fn reply(cmd: &str, r: impl serde::Serialize) -> Result<Value> {
serde_json::to_value(r).map_err(|e| bad(cmd, e.to_string()))
}
fn read(s: &mut Session, _: &Value) -> Result<Value> {
let m = &s.doc.metadata;
let properties: Map<String, Value> = metadata::keys(Owner::Design).map(|k| (k.name.to_string(), json!(m.text(k.name)))).collect();
Ok(json!({"metadata": m, "properties": properties}))
reply("document.metadata", MetadataResult { metadata: m.0.clone(), properties })
}
fn set(s: &mut Session, p: &Value) -> Result<Value> {
@@ -60,7 +84,7 @@ fn set(s: &mut Session, p: &Value) -> Result<Value> {
if next != s.doc.metadata {
s.doc_mut().metadata = next;
}
Ok(json!({"metadata": s.doc.metadata, "changed": changed}))
reply(cmd, MetadataSetResult { metadata: s.doc.metadata.0.clone(), changed, param_warnings: Vec::new() })
}
fn remove(s: &mut Session, p: &Value) -> Result<Value> {
@@ -84,7 +108,8 @@ fn remove(s: &mut Session, p: &Value) -> Result<Value> {
m.remove(k);
}
}
Ok(json!({"metadata": s.doc.metadata, "removed": removed}))
let removed = removed.into_iter().map(str::to_string).collect();
reply(cmd, MetadataRemoveResult { metadata: s.doc.metadata.0.clone(), removed, param_warnings: Vec::new() })
}
#[cfg(test)]
+1
View File
@@ -46,6 +46,7 @@ pub(crate) use features::profiles as feature_profiles;
pub(crate) use features::{EdgeRefForm, PLANE_FORMS, axis_dir_form, axis_line_object, edge_ref_form, explicit_plane, plane_name_problem, sketch_key};
pub use features::{auto_operation, extrude_reach, shown_scope};
pub use file::open_steps::OpenSteps;
pub(crate) use inspect::color_param;
pub use join_pieces::{Addition, addition};
pub use parts::part_length_label;
pub use sketch::dimension_roles;
+78
View File
@@ -541,6 +541,84 @@ fn isolate_nested_child_hides_ancestor_material_and_sibling() {
}
}
/// #7896: isolating a body hides its own component's other bodies one by one and every other
/// placement as a placement, so the Browser row of a component shows it is off and its eye
/// brings it back. A second placement of the body's own component is another placement.
/// #7896: isolating a body inside a hidden Bodies folder or group shows that folder and group
/// again, so the body is visible; the folder's other bodies stay hidden.
#[test]
fn isolate_shows_the_hidden_folder_and_group_a_picked_body_is_in() {
let mut s = Session::default();
run(&mut s, "solid.box", json!({"length":10,"width":10,"height":10,"body_name":"Kept"}));
run(&mut s, "solid.box", json!({"length":10,"width":10,"height":10,"corner":[20,0,0],"body_name":"Other","operation":"new"}));
let group = run(&mut s, "browser.group", json!({"folder": "bodies", "items": ["Kept"], "name": "Held"}));
let group = group["group"].as_u64().or_else(|| group["id"].as_u64()).expect("the group's id");
run(&mut s, "browser.visibility", json!({"tree_folders": ["c0/bodies", format!("c0/g{group}")], "visible": false}));
assert!(!s.body_visible("Kept") && !s.body_visible("Other"));
run(&mut s, "browser.visibility", json!({"items": ["Kept"], "visible": true, "isolate": true}));
assert!(s.body_visible("Kept"), "the picked body shows: {:?}", s.visibility.hidden_folders);
assert!(!s.body_visible("Other"), "the folder's other body stays hidden");
assert!(s.visibility.hidden_folders.is_empty(), "{:?}", s.visibility.hidden_folders);
}
#[test]
fn isolate_bodies_hides_other_components_as_components() {
let mut s = Session::default();
run(&mut s, "solid.box", json!({"length":10,"width":10,"height":10,"corner":[-20,0,0],"body_name":"Root"}));
let comp = |s: &mut Session, name: &str| {
let c = run(s, "component.create", json!({"name": name, "parent": "root", "grounded": false}));
c["occurrence"].as_u64().unwrap()
};
let a = comp(&mut s, "CompA");
run(&mut s, "solid.box", json!({"length":10,"width":10,"height":10,"body_name":"BoxA"}));
run(&mut s, "solid.box", json!({"length":2,"width":2,"height":2,"corner":[0,0,20],"body_name":"BoxA2"}));
let b = comp(&mut s, "CompB");
run(&mut s, "solid.box", json!({"length":10,"width":10,"height":10,"corner":[20,0,0],"body_name":"BoxB1"}));
run(&mut s, "solid.box", json!({"length":5,"width":5,"height":5,"corner":[40,0,0],"body_name":"BoxB2"}));
let a2 = run(&mut s, "occurrence.copy", json!({"occurrence":a,"translate":[0,40,0]}))["occurrence"].as_u64().unwrap();
let in_a = s.occurrence_bodies(&[a], false).unwrap();
let (box_a, box_a2) = (in_a.iter().find(|n| !n.contains("BoxA2")).unwrap().clone(), in_a.iter().find(|n| n.contains("BoxA2")).unwrap().clone());
let out = run(&mut s, "browser.visibility", json!({"visible":true,"items":[box_a],"isolate":true}));
assert_eq!(out["isolated"], json!([box_a]));
let mut occurrences = s.visibility.hidden_occurrences.clone();
occurrences.sort();
let mut others = vec![vec![b], vec![a2]];
others.sort();
assert_eq!(occurrences, others, "CompB and CompA's other placement go as placements");
let mut bodies = s.visibility.hidden_bodies.clone();
bodies.sort();
assert_eq!(bodies, vec![box_a2.clone(), "Root".to_string()], "only bodies beside BoxA go one by one");
assert!(s.body_visible(&box_a) && !s.body_visible(&box_a2) && !s.body_visible("Root"));
for name in s.occurrence_bodies(&[b], false).unwrap().iter().chain(&s.occurrence_bodies(&[a2], false).unwrap()) {
assert!(!s.body_visible(name), "{name}");
}
// CompB's eye brings it back whole.
run(&mut s, "browser.visibility", json!({"visible":true,"paths":[[b]]}));
assert!(s.occurrence_bodies(&[b], false).unwrap().iter().all(|n| s.body_visible(n)));
// Isolating a root body hides every placement as a placement and no body one by one.
run(&mut s, "browser.visibility", json!({"visible":true,"items":["Root"],"isolate":true}));
let mut occurrences = s.visibility.hidden_occurrences.clone();
occurrences.sort();
let mut all = vec![vec![a], vec![b], vec![a2]];
all.sort();
assert_eq!(occurrences, all);
assert!(s.visibility.hidden_bodies.is_empty() && s.body_visible("Root"), "{:?}", s.visibility.hidden_bodies);
// Only bodies isolate, and only shown; a refusal changes nothing.
let before = s.visibility.clone();
for p in [
json!({"visible":false,"items":["Root"],"isolate":true}),
json!({"visible":true,"items":["XY"],"isolate":true}),
json!({"visible":true,"items":["Nope"],"isolate":true}),
json!({"visible":true,"folder":"bodies","isolate":true}),
] {
assert!(s.execute("browser.visibility", &p).is_err(), "{p}");
}
assert_eq!(s.visibility, before);
}
#[test]
fn context_new_child_uses_inactive_parent_placement() {
let mut s = Session::default();
+51 -45
View File
@@ -12,9 +12,21 @@ use solidcore_record::Vec3;
use super::CommandSpec;
use crate::params::{bad, num, str_};
use crate::schema::parameter_sweep::{
FeatureFailed, FeatureWarned, JointFlipped, JointLost, JointSide, MAX_VALUES, ParameterSweep, ParameterSweepParams, SketchFailed, SketchFlipped,
SweepChanges, SweepResult, SweepSummary,
};
use crate::schema::{TypedContract, output_schema_for};
use crate::{Result, Session};
pub static COMMANDS: &[CommandSpec] = &[CommandSpec::new("inspect.parameter_sweep", "Parameter Sweep", sweep).icon("params").noundo().params(
const CONTRACT: TypedContract<ParameterSweepParams> = TypedContract::new();
pub static COMMANDS: &[CommandSpec] = &[CommandSpec::new("inspect.parameter_sweep", "Parameter Sweep", crate::checked!("inspect.parameter_sweep", sweep))
.icon("params")
.noundo()
.contract(&CONTRACT)
.output(output_schema_for::<ParameterSweep>)
.params(
"parameter: name; values: [number | expression] (at most 200) | from, to: numbers, steps? (default 10, at most 199: steps + 1 values) → \
for each value, in a copy of the design (the design itself is not changed): {value, ms (the rebuild), ok, failed: [{feature, name, error}], warned: [{feature, name, warning}] \
(features that build at the current value and fail or warn at this one), joints_lost: [{joint, name, origin?: a|b, why}], joints_flipped: [{joint, name, origin: a|b, degrees}] \
@@ -24,9 +36,6 @@ pub static COMMANDS: &[CommandSpec] = &[CommandSpec::new("inspect.parameter_swee
summary: {values, ok, slowest_ms, failed, joints_lost, joints_flipped, sketches_flipped, sketches_failed} (how many values show each)",
)];
/// Values swept by one command, at most.
const MAX_VALUES: usize = 200;
/// A frame's origin and z axis, in its occurrence's coordinates.
type Frame = (Vec3, Vec3);
@@ -85,29 +94,29 @@ fn degrees(a: Vec3, b: Vec3) -> Option<f64> {
}
/// What changed from `base` (the design as it is) to `at` (at one value).
fn compare(base: &Look, at: &Look) -> Value {
let failed: Vec<Value> = at
fn compare(base: &Look, at: &Look) -> SweepChanges {
let failed = at
.errors
.iter()
.filter(|(id, _)| !base.errors.contains_key(id))
.map(|(id, (name, e))| json!({"feature": id, "name": name, "error": e}))
.map(|(id, (name, e))| FeatureFailed { feature: *id, name: name.clone(), error: e.clone() })
.collect();
let warned: Vec<Value> = at
let warned = at
.warnings
.iter()
.filter(|(id, (_, w))| base.warnings.get(id).is_none_or(|(_, b)| b != w) && !at.errors.contains_key(id))
.map(|(id, (name, w))| json!({"feature": id, "name": name, "warning": w}))
.map(|(id, (name, w))| FeatureWarned { feature: *id, name: name.clone(), warning: w.clone() })
.collect();
let mut lost = Vec::new();
let mut flipped = Vec::new();
let mut joints_lost = Vec::new();
let mut joints_flipped = Vec::new();
for (id, (name, a, b)) in &at.joints {
let Some((_, a0, b0)) = base.joints.get(id) else { continue };
for (side, now, was) in [("a", a, a0), ("b", b, b0)] {
for (side, now, was) in [(JointSide::A, a, a0), (JointSide::B, b, b0)] {
match (now, was) {
(Err(why), Ok(_)) => lost.push(json!({"joint": id, "name": name, "origin": side, "why": why})),
(Err(why), Ok(_)) => joints_lost.push(JointLost { joint: *id, name: name.clone(), origin: Some(side), why: why.clone() }),
(Ok(f), Ok(f0)) => {
if let Some(d) = degrees(f.1, f0.1).filter(|d| *d > 90.0) {
flipped.push(json!({"joint": id, "name": name, "origin": side, "degrees": (d * 10.0).round() / 10.0}));
joints_flipped.push(JointFlipped { joint: *id, name: name.clone(), origin: side, degrees: (d * 10.0).round() / 10.0 });
}
}
_ => {}
@@ -117,7 +126,7 @@ fn compare(base: &Look, at: &Look) -> Value {
&& a.is_ok()
&& b.is_ok()
{
lost.push(json!({"joint": id, "name": name, "why": why}));
joints_lost.push(JointLost { joint: *id, name: name.clone(), origin: None, why: why.clone() });
}
}
let mut sketches_flipped = Vec::new();
@@ -125,15 +134,13 @@ fn compare(base: &Look, at: &Look) -> Value {
for (id, (name, n, failing, folded)) in &at.sketches {
let Some((_, n0, failing0, folded0)) = base.sketches.get(id) else { continue };
if let Some(d) = degrees(*n, *n0).filter(|d| *d > 90.0) {
sketches_flipped.push(json!({"sketch": id, "name": name, "degrees": (d * 10.0).round() / 10.0}));
sketches_flipped.push(SketchFlipped { sketch: *id, name: name.clone(), degrees: (d * 10.0).round() / 10.0 });
}
if (!failing.is_empty() && failing0.is_empty()) || (!folded.is_empty() && folded0.is_empty()) {
sketches_failed.push(json!({"sketch": id, "name": name, "failing": failing, "folded": folded}));
sketches_failed.push(SketchFailed { sketch: *id, name: name.clone(), failing: failing.clone(), folded: folded.clone() });
}
}
let ok = failed.is_empty() && lost.is_empty() && flipped.is_empty() && sketches_flipped.is_empty() && sketches_failed.is_empty();
json!({"ok": ok, "failed": failed, "warned": warned, "joints_lost": lost, "joints_flipped": flipped,
"sketches_flipped": sketches_flipped, "sketches_failed": sketches_failed})
SweepChanges { failed, warned, joints_lost, joints_flipped, sketches_flipped, sketches_failed }
}
/// The values to sweep.
@@ -175,37 +182,36 @@ fn sweep(s: &mut Session, p: &Value) -> Result<Value> {
let values = values(p, cmd)?;
let base = look(s);
let mut results = Vec::new();
let mut count: BTreeMap<&str, usize> = BTreeMap::new();
let mut slowest: f64 = 0.0;
for v in values {
let mut summary =
SweepSummary { values: 0, ok: 0, slowest_ms: 0.0, failed: 0, joints_lost: 0, joints_flipped: 0, sketches_flipped: 0, sketches_failed: 0 };
for value in values {
let mut x = s.scratch();
let t0 = std::time::Instant::now();
let changed = x.execute("parameters.change", &json!({"name": name, "expression": v}));
let changed = x.execute("parameters.change", &json!({"name": name, "expression": value}));
let ms = (t0.elapsed().as_secs_f64() * 1e4).round() / 10.0;
slowest = slowest.max(ms);
let mut r = match changed {
Ok(_) => compare(&base, &look(&x)),
Err(e) => json!({"ok": false, "error": e.to_string()}),
};
for key in ["failed", "joints_lost", "joints_flipped", "sketches_flipped", "sketches_failed"] {
if r[key].as_array().is_some_and(|a| !a.is_empty()) {
*count.entry(key).or_default() += 1;
summary.slowest_ms = summary.slowest_ms.max(ms);
let r = match changed {
Ok(_) => {
let c = compare(&base, &look(&x));
summary.failed += usize::from(!c.failed.is_empty());
summary.joints_lost += usize::from(!c.joints_lost.is_empty());
summary.joints_flipped += usize::from(!c.joints_flipped.is_empty());
summary.sketches_flipped += usize::from(!c.sketches_flipped.is_empty());
summary.sketches_failed += usize::from(!c.sketches_failed.is_empty());
let ok = c.failed.is_empty()
&& c.joints_lost.is_empty()
&& c.joints_flipped.is_empty()
&& c.sketches_flipped.is_empty()
&& c.sketches_failed.is_empty();
SweepResult { value, ms, ok, error: None, changes: Some(c) }
}
}
if r["ok"] == json!(true) {
*count.entry("ok").or_default() += 1;
}
r["value"] = v;
r["ms"] = json!(ms);
Err(e) => SweepResult { value, ms, ok: false, error: Some(e.to_string()), changes: None },
};
summary.ok += usize::from(r.ok);
results.push(r);
}
let get = |k: &str| count.get(k).copied().unwrap_or(0);
Ok(json!({
"parameter": name,
"results": results,
"summary": {"values": results.len(), "ok": get("ok"), "slowest_ms": slowest, "failed": get("failed"), "joints_lost": get("joints_lost"),
"joints_flipped": get("joints_flipped"), "sketches_flipped": get("sketches_flipped"), "sketches_failed": get("sketches_failed")},
}))
summary.values = results.len();
serde_json::to_value(ParameterSweep { parameter: name, results, summary, param_warnings: Vec::new() }).map_err(|e| bad(cmd, e.to_string()))
}
#[cfg(test)]
+56 -19
View File
@@ -15,27 +15,43 @@ use solidcraft_geom::prelude::*;
use super::CommandSpec;
use crate::params::{bad, num, str_, vec3};
use crate::schema::parts::{InsertedPart, PartFamily, PartsInsertParams, PartsLibrary, PartsLibraryParams, PartsResizeParams, ResizedPart};
use crate::schema::{TypedContract, output_schema_for};
use crate::{EngineError, Result, Session};
const LIBRARY_CONTRACT: TypedContract<PartsLibraryParams> = TypedContract::new();
const INSERT_CONTRACT: TypedContract<PartsInsertParams> = TypedContract::new();
const RESIZE_CONTRACT: TypedContract<PartsResizeParams> = TypedContract::new();
pub static COMMANDS: &[CommandSpec] = &[
CommandSpec::new("parts.library", "Standard Parts", library)
CommandSpec::new("parts.library", "Standard Parts", crate::checked!("parts.library", library))
.icon("library")
.noundo()
.contract(&LIBRARY_CONTRACT)
.output(output_schema_for::<PartsLibrary>)
.params("family? → families (name, standard, system: metric|inch, sizes, lengths) and, with family, each size's dimensions (mm)"),
CommandSpec::new("parts.fastener", "Insert Fastener", insert_atomic)
CommandSpec::new("parts.fastener", "Insert Fastener", crate::checked!("parts.fastener", insert_atomic))
.at("SOLID", "INSERT")
.icon("fastener")
.contract(&INSERT_CONTRACT)
.output(output_schema_for::<InsertedPart>)
.params("the Insert Part dialog's command (same as parts.insert): family, size, length?, at?|point?+direction?, name?"),
CommandSpec::new("parts.insert", "Insert Part", insert_atomic).icon("fastener").params(
"family (socket_head_cap_screw | button_head_cap_screw | hex_bolt | hex_nut | washer | set_screw | dowel_pin | bearing | \
CommandSpec::new("parts.insert", "Insert Part", crate::checked!("parts.insert", insert_atomic))
.icon("fastener")
.contract(&INSERT_CONTRACT)
.output(output_schema_for::<InsertedPart>)
.params(
"family (socket_head_cap_screw | button_head_cap_screw | hex_bolt | hex_nut | washer | set_screw | dowel_pin | bearing | \
hex_cap_screw_inch | hex_nut_inch | washer_sae | washer_uss); size (\"M6\", \"608\" for bearings, \"1/2-13 UNC\" for inch screws and nuts, \
\"1/2\" for inch washers); length? (mm, inch parts too; screws, bolts, set screws, pins; default a standard length near 2.5 d); \
at?: [x,y,z] on a hole's rim or wall (the part seats on the hole's face with a rigid joint), or a list of them (one component, \
placed and seated once per hole) | point?: [x,y,z] with direction?: [x,y,z] (no joint); name? → component, occurrence, joint?, \
and with at: occurrences, joints (one per hole, in pick order)",
),
CommandSpec::new("parts.resize", "Change Part Size", resize_atomic)
),
CommandSpec::new("parts.resize", "Change Part Size", crate::checked!("parts.resize", resize_atomic))
.icon("scale")
.contract(&RESIZE_CONTRACT)
.output(output_schema_for::<ResizedPart>)
.params("component: id|name of an inserted part; size?; length? — rebuilds it (joints keep it seated)"),
];
@@ -572,7 +588,7 @@ fn build(s: &mut Session, sh: &Shape) -> Result<()> {
}
fn library(_s: &mut Session, p: &Value) -> Result<Value> {
let fam = |id: &str| -> Value {
let fam = |id: &str| -> PartFamily {
let mut sizes: Vec<Value> = match id {
"socket_head_cap_screw" => SHCS.iter().map(|r| json!({"size": r.0, "d": metric(r.0).map(|m| m.0), "pitch": metric(r.0).map(|m| m.1), "head_diameter": r.1, "head_height": r.2, "socket": r.3, "socket_depth": r.4})).collect(),
"button_head_cap_screw" => BHCS.iter().map(|r| json!({"size": r.0, "d": metric(r.0).map(|m| m.0), "pitch": metric(r.0).map(|m| m.1), "head_diameter": r.1, "head_height": r.2, "socket": r.3, "socket_depth": r.4})).collect(),
@@ -612,15 +628,24 @@ fn library(_s: &mut Session, p: &Value) -> Result<Value> {
}
}
let system = if is_inch(id) { "inch" } else { "metric" };
json!({"family": id, "name": name, "standard": standard, "system": system, "sizes": sizes, "lengths": lengths})
PartFamily { family: id.into(), name: name.into(), standard: standard.into(), system: system.into(), sizes, lengths }
};
match str_(p, "family") {
Some(f) if FAMILIES.iter().any(|x| x.0 == f) => Ok(fam(f)),
Some(f) if FAMILIES.iter().any(|x| x.0 == f) => {
reply("parts.library", PartsLibrary { families: None, family: Some(fam(f)), param_warnings: Vec::new() })
}
Some(f) => Err(bad("parts.library", format!("unknown part family `{f}`"))),
None => Ok(json!({"families": FAMILIES.iter().map(|f| fam(f.0)).collect::<Vec<_>>()})),
None => reply(
"parts.library",
PartsLibrary { families: Some(FAMILIES.iter().map(|f| fam(f.0)).collect()), family: None, param_warnings: Vec::new() },
),
}
}
fn reply(cmd: &str, reply: impl serde::Serialize) -> Result<Value> {
serde_json::to_value(reply).map_err(|e| bad(cmd, e.to_string()))
}
fn part_name(family: &str, size: &str, sh: &Shape) -> String {
match sh {
Shape::Screw { len, .. } | Shape::Rod { len, .. } => format!("{} {}", label(family), size_with_length(family, size, *len)),
@@ -747,14 +772,26 @@ fn insert(s: &mut Session, p: &Value) -> Result<Value> {
s.doc_mut().parts.insert(comp, solidcraft_doc::StandardPart { family: family.clone(), size: size.clone(), length: shape_len(&sh) });
set_identity(s, comp, identity(&family, &size, &sh), None);
run(s, "component.activate", json!({"component": active}))?;
let mut out = json!({"component": comp, "occurrence": occ, "name": name});
let mut out = InsertedPart {
component: comp,
occurrence: occ,
name: name.clone(),
joint: None,
occurrences: None,
joints: None,
param_warnings: Vec::new(),
};
if !holes.is_empty() {
// The first hole has the placement the component came with; each further hole places the
// same part again. All are made before any is seated, while each is still at the part's
// own origin, where the joint below takes the part's seating point to be.
let mut occurrences = vec![json!(occ)];
let mut occurrences = vec![occ];
for _ in 1..holes.len() {
occurrences.push(run(s, "occurrence.copy", json!({"component": comp}))?["occurrence"].clone());
occurrences.push(
run(s, "occurrence.copy", json!({"component": comp}))?["occurrence"]
.as_u64()
.ok_or_else(|| bad(cmd, "the copy has no occurrence"))?,
);
}
let mut joints = Vec::new();
for (i, ((a, h), o)) in holes.into_iter().zip(&occurrences).enumerate() {
@@ -766,11 +803,11 @@ fn insert(s: &mut Session, p: &Value) -> Result<Value> {
"joint.create",
json!({"type": "rigid", "a": {"occurrence": h, "circle": a}, "b": {"occurrence": o, "point": [0, 0, 0], "z": [0, 0, -1]}, "name": seat}),
)?;
joints.push(j["joint"].clone());
joints.push(j["joint"].as_u64().ok_or_else(|| bad(cmd, "the joint has no id"))?);
}
out["joint"] = joints.first().cloned().unwrap_or(Value::Null);
out["occurrences"] = Value::Array(occurrences);
out["joints"] = Value::Array(joints);
out.joint = joints.first().copied();
out.occurrences = Some(occurrences);
out.joints = Some(joints);
} else if let Some(pt) = p.get("point").and_then(vec3) {
// Placed at a point, its +z along `direction`.
let dir = p.get("direction").and_then(vec3).and_then(|d| d.normalized()).unwrap_or(Vec3::Z);
@@ -789,7 +826,7 @@ fn insert(s: &mut Session, p: &Value) -> Result<Value> {
o.transform = m;
}
}
Ok(out)
reply(cmd, out)
}
/// The most holes one insert seats a part in.
@@ -887,7 +924,7 @@ fn resize(s: &mut Session, p: &Value) -> Result<Value> {
if let Some(e) = s.model.results.iter().find_map(|r| r.error.clone()) {
return Err(EngineError::Other(e));
}
Ok(json!({"component": comp, "name": name, "size": size, "length": shape_len(&sh)}))
reply(cmd, ResizedPart { component: comp, name, size, length: shape_len(&sh), param_warnings: Vec::new() })
}
#[cfg(test)]
@@ -61,7 +61,10 @@ fn format20_scalar_looks_upgrade_and_format21_setups_keep_their_meaning() {
assert_eq!(d.render.setups["Studio"].width, 320);
for version in [crate::doc::format::FORMAT + 1, crate::doc::format::FORMAT + 2] {
saved["format"] = json!(format!("solidcraft/{version}"));
assert!(crate::doc::Document::from_json(&saved.to_string()).is_err());
// A newer build's file opens, says so, and keeps its number.
let newer = crate::doc::Document::from_json(&saved.to_string()).unwrap();
assert_eq!(newer.newer_file.as_ref().unwrap().format, version);
assert_eq!(newer.format, format!("solidcraft/{version}"));
}
}
+1 -1
View File
@@ -404,7 +404,7 @@ mod tests {
s.run_script(&crate::sample::script()).unwrap();
let lip = json!({"body": "Plate", "face": [51.89, 45.2, 8.0], "width": "1.5 mm", "height": "3.5 mm", "side": "inside", "type": "lip"});
let e = s.execute("plastic.lip", &lip).unwrap_err().to_string();
assert!(e.contains("rim face") && e.contains("2 openings alike"), "{e}");
assert!(e.contains("one clear opening") && e.contains("2 openings alike"), "{e}");
// The boss alone, no holes: its foot is not an opening either.
let mut b = Session::default();
run(&mut b, "solid.box", json!({"length": 80, "width": 50, "height": 8, "body_name": "Plate"}));
+30 -10
View File
@@ -81,21 +81,35 @@ CommandSpec::new("render.preset.apply", "Apply Native Studio", studio_presets::a
.params("Same reviewed input as render.preset.resolve, expected_revision required, replace_lighting_and_environment:true and replace_stage:true when an existing stage would change. Re-resolves the complete candidate and publishes one undo or no mutation; camera, optical bindings, geometry and engineering materials are preserved."),
CommandSpec::new("render.quality.prepare", "Review Fixed Sampling Budget", studio_presets::quality).icon("settings").noundo().doc_only()
.params("id: Q-*; variant:fixed_samples_png; acknowledge_omissions:true. Read-only bounded GPU still-budget projection, not full adaptive/convergence/linear-master quality acceptance. Returns dimensions/samples/depth/seed/denoise and explicit omissions. Never switches executor or mutates a shot."),
CommandSpec::new("render.shot.duplicate", "Duplicate Render Shot", shots::duplicate).icon("copy").doc_only()
CommandSpec::new("render.shot.duplicate", "Duplicate Render Shot", crate::checked!("render.shot.duplicate", shots::duplicate)).icon("copy").doc_only()
.contract(&shots::CONTRACT)
.output(crate::schema::output_schema_for::<crate::schema::render_shots::ShotChange>)
.params("name, new_name, expected_revision:u64. Copies exact saved setup and resource references in one undo. Existing destinations refuse; captured jobs and camera navigation are unchanged."),
CommandSpec::new("render.shot.rename", "Rename Render Shot", shots::rename).icon("settings").doc_only()
CommandSpec::new("render.shot.rename", "Rename Render Shot", crate::checked!("render.shot.rename", shots::rename)).icon("settings").doc_only()
.contract(&shots::CONTRACT)
.output(crate::schema::output_schema_for::<crate::schema::render_shots::ShotChange>)
.params("name, new_name, expected_revision:u64. Renames exact saved setup in one undo; an existing destination or stale review refuses."),
CommandSpec::new("render.shot.remove", "Remove Render Shot", shots::remove).icon("delete").doc_only()
CommandSpec::new("render.shot.remove", "Remove Render Shot", crate::checked!("render.shot.remove", shots::remove)).icon("delete").doc_only()
.contract(&shots::CONTRACT)
.output(crate::schema::output_schema_for::<crate::schema::render_shots::ShotChange>)
.params("name, expected_revision:u64. Removes only that saved setup in one undo; retains resources, geometry and captured results."),
CommandSpec::new("render.library.preview", "Inspect Original Surface Map", library::preview).icon("appearance").noundo().doc_only()
CommandSpec::new("render.library.preview", "Inspect Original Surface Map", crate::checked!("render.library.preview", library::preview)).icon("appearance").noundo().doc_only()
.contract(&library::PREVIEW_CONTRACT)
.output(crate::schema::output_schema_for::<crate::schema::render_library::LibraryPreview>)
.params("id: SURF-*. Returns bounded hash-verified original base-color PNG bytes and source-map fidelity label, not a rendered material thumbnail. No external paths, rendering or document edits."),
CommandSpec::new("render.library.physical.prepare", "Prepare Physical Reference", physical_library::prepare).icon("inspect").noundo().doc_only()
.params("id: named built-in physical profile, name: proposed new material label, acknowledge_reference:true. Read-only loss-aware creation plan using native ValidatedCard admission and one point density; returns source receipts, extended fields and omissions. Does not execute material.create, assign bodies or infer effective-part physics."),
CommandSpec::new("render.stage.ground", "Save Render Ground", staging::ground).icon("render_scene")
CommandSpec::new("render.stage.ground", "Save Render Ground", crate::checked!("render.stage.ground", staging::ground)).icon("render_scene")
.contract(&staging::GROUND_CONTRACT)
.output(crate::schema::output_schema_for::<crate::schema::render_stage::StageSaved>)
.params("name: typed raytrace setup, set?: setup patch, margin_fraction?:0.25, gap_mm?:0.1, reflectance_linear?:[0.18,0.18,0.18], replace_stage?:false. Fits one finite passive ground below the visible product once and saves its physical transforms in one undo. Product AABB separation is rechecked on every render."),
CommandSpec::new("render.stage.backdrop", "Save Physical Render Background", staging::backdrop).icon("render_scene").doc_only()
CommandSpec::new("render.stage.backdrop", "Save Physical Render Background", crate::checked!("render.stage.backdrop", staging::backdrop)).icon("render_scene").doc_only()
.contract(&staging::BACKDROP_CONTRACT)
.output(crate::schema::output_schema_for::<crate::schema::render_stage::StageSaved>)
.params("name: typed raytrace setup, set?: setup patch, kind: floor_wall or cyclorama, reflectance_linear?: [0.18,0.18,0.18], expected_revision: reviewed revision, replace_stage?:false. Fits a finite floor/wall or a 24-strip polygonal cyclorama behind the visible subject using the saved camera azimuth; world +Z up and a minimum one-mm stage envelope. Preserves subject geometry, lighting, output, pose and engineering materials; one undo and rechecked product separation. Not an infinite/analytically smooth/terrain background."),
CommandSpec::new("render.stage.clear", "Remove Render Stage", staging::clear).icon("render_scene").doc_only()
CommandSpec::new("render.stage.clear", "Remove Render Stage", crate::checked!("render.stage.clear", staging::clear)).icon("render_scene").doc_only()
.contract(&staging::CLEAR_CONTRACT)
.output(crate::schema::output_schema_for::<crate::schema::render_stage::StageSaved>)
.params("name: setup, set?: setup patch. Removes saved render-only panels atomically; CAD geometry and lighting are unchanged."),
CommandSpec::new("render.library.surface.bind", "Save Surface Binding", surface_bindings::bind).icon("appearance")
.params("name: GPU setup; set?: setup patch; surface: same input as render.library.surface.prepare; replace?: false. Pins exact source hashes and definition/feature/occurrence identity with local-mm mapping in one undo. No paths, mesh ordinals or physical material changes."),
@@ -103,11 +117,17 @@ CommandSpec::new("render.library.surface.unbind", "Remove Surface Binding", surf
.params("name: setup, target: saved definition/feature/component/occurrence_path, set?: setup patch. Removes only that explicit binding in one undo; no device or current geometry required."),
CommandSpec::new("render.result.pin", "Retain Displayed Render Result", jobs::pin).icon("inspect").noundo().doc_only()
.params("job?: completed JobId (default selected result), or null to clear selection. Selects within the eight retained completed results; oldest is evicted first. Preserves exact export bytes and original host memory accounting. No design/undo change; preview or foreign jobs refuse."),
CommandSpec::new("render.library.targets", "Find Render Library Targets", library::targets).icon("list").noundo()
CommandSpec::new("render.library.targets", "Find Render Library Targets", crate::checked!("render.library.targets", library::targets)).icon("list").noundo()
.contract(&library::TARGETS_CONTRACT)
.output(crate::schema::output_schema_for::<crate::schema::render_library::LibraryTargets>)
.params("query?: exact-name substring; offset?:0; limit?:128 (1..128). Returns a bounded page of captured body ordinals/names, revision and scene bounds. Settles the model through ordinary command handling; never returns a large mesh payload."),
CommandSpec::new("render.library.list", "Browse Render Library", library::list).icon("list").noundo().doc_only()
CommandSpec::new("render.library.list", "Browse Render Library", crate::checked!("render.library.list", library::list)).icon("list").noundo().doc_only()
.contract(&library::LIST_CONTRACT)
.output(crate::schema::output_schema_for::<crate::schema::render_library::LibraryPage>)
.params("kind?: surfaces, selene_appearances, hdr, rigs, scenes, materials, lighting, environments, quality, native_scenes, selene_shots or capabilities; query?: bounded search; availability?: all/usable/specification/blocked; offset?:0; limit?:48 (1..128). Returns source status and explicit implemented projections separately. No device, file IO or design change."),
CommandSpec::new("render.library.describe", "Inspect Render Library Resource", library::describe).icon("inspect").noundo().doc_only()
CommandSpec::new("render.library.describe", "Inspect Render Library Resource", crate::checked!("render.library.describe", library::describe)).icon("inspect").noundo().doc_only()
.contract(&library::DESCRIBE_CONTRACT)
.output(crate::schema::output_schema_for::<crate::schema::render_library::LibraryDescription>)
.params("kind, id: exact authored resource. Returns original specification, runtime projection variants and explicit omissions. A concept is not an executable preset."),
CommandSpec::new("render.library.appearance.apply", "Apply Library Opaque Appearance", library::apply_appearance).icon("appearance")
.params("id: SURF-* or SELENE-AP-*; variant: uniform_opaque (required); bodies: 1..256 exact body names. Applies the original scalar baseline through ordinary appearance assignment in one undo, preserving physical properties. Spatial maps and advanced target effects are explicitly excluded."),
+95 -41
View File
@@ -16,8 +16,22 @@ use solidcraft_render::{
texture_input::MapRole,
};
use crate::schema::TypedContract;
use crate::schema::render_library::{
LibraryDescribeParams, LibraryListParams, LibraryPage, LibraryPreview, LibraryPreviewParams, LibraryResource, LibraryTargets,
LibraryTargetsParams, Pbr, RenderTarget, ResourceSummary, SceneBounds,
};
use crate::{Result, Session, params::bad};
pub(super) const LIST_CONTRACT: TypedContract<LibraryListParams> = TypedContract::new();
pub(super) const DESCRIBE_CONTRACT: TypedContract<LibraryDescribeParams> = TypedContract::new();
pub(super) const TARGETS_CONTRACT: TypedContract<LibraryTargetsParams> = TypedContract::new();
pub(super) const PREVIEW_CONTRACT: TypedContract<LibraryPreviewParams> = TypedContract::new();
fn reply(command: &str, reply: impl serde::Serialize) -> Result<Value> {
serde_json::to_value(reply).map_err(|e| bad(command, e.to_string()))
}
const KINDS: &[&str] = &[
"materials",
"lighting",
@@ -162,28 +176,47 @@ pub(super) fn list(_s: &mut Session, params: &Value) -> Result<Value> {
};
let values = catalog(&input.kind, command)?;
let count = values.iter().filter(matches).count();
let items: Vec<_> = values.iter().filter(matches).skip(input.offset).take(input.limit).map(|v| {
json!({"id":v["id"],"name":v["name"],"domains":v["domains"],"family":v["family"],"source_status":v.get("status").or_else(|| v.get("state")),"projection":projection(&input.kind,v)})
}).collect();
let items = values
.iter()
.filter(matches)
.skip(input.offset)
.take(input.limit)
.map(|v| {
let listed = Listed::deserialize(v).map_err(|e| bad(command, format!("built-in catalog {}: {e}", input.kind)))?;
Ok(ResourceSummary {
id: listed.id,
name: listed.name,
domains: listed.domains,
family: listed.family,
source_status: listed.status.or(listed.state),
projection: projection(&input.kind, v),
})
})
.collect::<Result<Vec<_>>>()?;
let end = input.offset.saturating_add(items.len());
Ok(json!({"kind":input.kind,"total":count,"offset":input.offset,"next_offset":(end < count).then_some(end),"items":items}))
let next_offset = (end < count).then_some(end);
reply(command, LibraryPage { kind: input.kind, total: count, offset: input.offset, next_offset, items, param_warnings: Vec::new() })
}
/// The fields of a catalog's resource a page lists. Every catalog gives an id and a name; the
/// source's status is `status`, or a rig's `state`.
#[derive(Deserialize)]
#[serde(default, deny_unknown_fields)]
struct TargetQuery {
query: String,
offset: usize,
limit: usize,
}
impl Default for TargetQuery {
fn default() -> Self {
Self { query: String::new(), offset: 0, limit: 128 }
}
struct Listed {
id: String,
name: String,
#[serde(default)]
domains: Option<Vec<String>>,
#[serde(default)]
family: Option<String>,
#[serde(default)]
status: Option<String>,
#[serde(default)]
state: Option<String>,
}
pub(super) fn targets(s: &mut Session, params: &Value) -> Result<Value> {
let command = "render.library.targets";
let input: TargetQuery = serde_json::from_value(params.clone()).map_err(|e| bad(command, e.to_string()))?;
let input: LibraryTargetsParams = serde_json::from_value(params.clone()).map_err(|e| bad(command, e.to_string()))?;
if input.query.len() > 256
|| input.query.chars().any(char::is_control)
|| input.limit == 0
@@ -202,49 +235,70 @@ pub(super) fn targets(s: &mut Session, params: &Value) -> Result<Value> {
.filter(|(_, body)| body.name.to_lowercase().contains(&query))
.skip(input.offset)
.take(input.limit)
.map(|(ordinal, body)| {
json!({"ordinal":ordinal,"name":body.name,"color":body.color,"opacity":body.opacity,
"pbr":body.surface.map(|v|json!({"metallic":v.metallic(),"roughness":v.roughness(),"dielectric_ior":v.dielectric_ior()}))})
.map(|(ordinal, body)| RenderTarget {
ordinal,
name: body.name.clone(),
color: body.color,
opacity: body.opacity,
pbr: body.surface.map(|v| Pbr { metallic: v.metallic(), roughness: v.roughness(), dielectric_ior: v.dielectric_ior() }),
})
.collect();
let end = input.offset.saturating_add(items.len());
Ok(json!({"items":items,"total":count,"offset":input.offset,"next_offset":(end<count).then_some(end),"revision":s.revision,
"bounds":if scene.bounds.is_empty(){Value::Null}else{json!({"min":scene.bounds.min,"max":scene.bounds.max})}}))
}
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
struct Identify {
kind: String,
id: String,
let bounds = (!scene.bounds.is_empty()).then(|| SceneBounds { min: scene.bounds.min.into(), max: scene.bounds.max.into() });
reply(
command,
LibraryTargets {
items,
total: count,
offset: input.offset,
next_offset: (end < count).then_some(end),
revision: s.revision,
bounds,
param_warnings: Vec::new(),
},
)
}
pub(super) fn describe(_s: &mut Session, params: &Value) -> Result<Value> {
let command = "render.library.describe";
let input: Identify = serde_json::from_value(params.clone()).map_err(|e| bad(command, e.to_string()))?;
let input: LibraryDescribeParams = serde_json::from_value(params.clone()).map_err(|e| bad(command, e.to_string()))?;
if input.kind == "physical_profiles" {
return super::physical_library::describe(&input.id);
}
let value = item(&input.kind, &input.id, command)?;
let mut reply = json!({"kind":input.kind,"resource":value,"projection":projection(&input.kind,value),"source_manifest_unchanged":true});
if matches!(input.kind.as_str(), "materials" | "surfaces") {
reply["physical_references"] = super::physical_library::associations(&input.id)?;
}
Ok(reply)
let physical_references =
if matches!(input.kind.as_str(), "materials" | "surfaces") { Some(super::physical_library::associations(&input.id)?) } else { None };
let projection = projection(&input.kind, value);
reply(
command,
LibraryResource {
kind: input.kind,
resource: value.as_object().cloned().unwrap_or_default(),
projection,
source_manifest_unchanged: true,
physical_references,
param_warnings: Vec::new(),
},
)
}
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
struct Preview {
id: String,
}
pub(super) fn preview(_s: &mut Session, params: &Value) -> Result<Value> {
let command = "render.library.preview";
let input: Preview = serde_json::from_value(params.clone()).map_err(|e| bad(command, e.to_string()))?;
let input: LibraryPreviewParams = serde_json::from_value(params.clone()).map_err(|e| bad(command, e.to_string()))?;
item("surfaces", &input.id, command)?;
let bytes = asset_bytes(&format!("{}/base_color", input.id), 2 * 1024 * 1024, command)?;
Ok(json!({"id":input.id,"mime":"image/png","sha256":HdrId::of(&bytes),"bytes":bytes,
"fidelity":"authored_base_color_source_map_not_a_render","document_changed":false}))
reply(
command,
LibraryPreview {
id: input.id,
mime: "image/png".into(),
sha256: HdrId::of(&bytes).to_string(),
bytes,
fidelity: "authored_base_color_source_map_not_a_render".into(),
document_changed: false,
param_warnings: Vec::new(),
},
)
}
/// The key is matched against generated constants, never joined to a filesystem path.
+31 -27
View File
@@ -1,61 +1,65 @@
//! Named saved-shot management through the existing RenderSettings authority.
//! No captured jobs, camera navigation, external files or engineering data are edited.
use crate::schema::TypedContract;
use crate::schema::render_shots::{ShotChange, ShotOperation, ShotParams};
use crate::{Result, Session, params::bad};
use serde::Deserialize;
use serde_json::{Value, json};
use serde_json::Value;
use solidcraft_doc::render_settings::RenderSettings;
use std::sync::Arc;
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
struct Named {
name: String,
#[serde(default)]
new_name: Option<String>,
expected_revision: u64,
}
fn change(s: &mut Session, params: &Value, operation: &str) -> Result<Value> {
pub(super) const CONTRACT: TypedContract<ShotParams> = TypedContract::new();
fn change(s: &mut Session, params: &Value, operation: ShotOperation) -> Result<Value> {
let command = match operation {
"duplicate" => "render.shot.duplicate",
"rename" => "render.shot.rename",
_ => "render.shot.remove",
ShotOperation::Duplicate => "render.shot.duplicate",
ShotOperation::Rename => "render.shot.rename",
ShotOperation::Remove => "render.shot.remove",
};
let input: Named = serde_json::from_value(params.clone()).map_err(|e| bad(command, e.to_string()))?;
let input: ShotParams = serde_json::from_value(params.clone()).map_err(|e| bad(command, e.to_string()))?;
if input.expected_revision != s.revision {
return Err(bad(command, "saved shot changed after review; refresh before editing"));
}
RenderSettings::validate_name(&input.name).map_err(|e| bad(command, e.to_string()))?;
let source = s.doc.render.setups.get(&input.name).cloned().ok_or_else(|| bad(command, "no saved shot with that name"))?;
let mut settings = (*s.doc.render).clone();
let output = if operation == "remove" {
let output = if operation == ShotOperation::Remove {
if input.new_name.is_some() {
return Err(bad(command, "remove does not accept a destination name"));
}
settings.setups.remove(&input.name);
Value::Null
None
} else {
let destination = input.new_name.as_ref().ok_or_else(|| bad(command, "new_name is required"))?;
RenderSettings::validate_name(destination).map_err(|e| bad(command, e.to_string()))?;
if settings.setups.contains_key(destination) {
let destination = input.new_name.ok_or_else(|| bad(command, "new_name is required"))?;
RenderSettings::validate_name(&destination).map_err(|e| bad(command, e.to_string()))?;
if settings.setups.contains_key(&destination) {
return Err(bad(command, "destination already exists; saved shots are never overwritten"));
}
settings.setups.insert(destination.clone(), source);
if operation == "rename" {
if operation == ShotOperation::Rename {
settings.setups.remove(&input.name);
}
json!(destination)
Some(destination)
};
settings.validate().map_err(|e| bad(command, e.to_string()))?;
s.doc_mut().render = Arc::new(settings);
Ok(json!({"operation":operation,"source":input.name,"name":output,"resources_preserved":true,
"camera_navigation_unchanged":true,"engineering_properties_unchanged":true,"captured_jobs_unchanged":true}))
let reply = ShotChange {
operation,
source: input.name,
name: output,
resources_preserved: true,
camera_navigation_unchanged: true,
engineering_properties_unchanged: true,
captured_jobs_unchanged: true,
param_warnings: Vec::new(),
};
serde_json::to_value(reply).map_err(|e| bad(command, e.to_string()))
}
pub(super) fn duplicate(s: &mut Session, params: &Value) -> Result<Value> {
change(s, params, "duplicate")
change(s, params, ShotOperation::Duplicate)
}
pub(super) fn rename(s: &mut Session, params: &Value) -> Result<Value> {
change(s, params, "rename")
change(s, params, ShotOperation::Rename)
}
pub(super) fn remove(s: &mut Session, params: &Value) -> Result<Value> {
change(s, params, "remove")
change(s, params, ShotOperation::Remove)
}

Some files were not shown because too many files have changed in this diff Show More