OpenSite/Reference/Commands/Set a quantity: Difference between revisions

From BathAfrica Documentation
Jump to navigation Jump to search
Use BathAfrica sidebar contents without duplicate inline contents box
Reorganize OpenSite help: learning paths, examples and chapter navigation
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{OpenSite scope}}
{{BathAfrica Command
{{BathAfrica Command
|review=Development documentation for OpenSite 0.0.1, source snapshot 77c3fee (Phase 13C). Reviewed against implementation on 29 October 2026. Tests and the Windows desktop were not rerun for this publication; this is not a released-product support claim.
|id=cli.document.set
|id=cli.document.set
|summary=Change one quantity through <code>opensite.document.set_quantity</code>, recompute, and save.
|summary=Change one quantity through <code>opensite.document.set_quantity</code>, recompute, and save.
Line 14: Line 14:
}}
}}


== Try this workflow ==
[[OpenSite/Guides/Quantities and profiles|Quantities and profiles]] — a worked lesson with expected results.


== Documentation basis ==
== Documentation basis ==
Line 25: Line 28:
[[OpenSite|OpenSite overview]] · [[OpenSite/Reference|Reference]] · [[OpenSite/Guides|Guides]]
[[OpenSite|OpenSite overview]] · [[OpenSite/Reference|Reference]] · [[OpenSite/Guides|Guides]]
[[Category:OpenSite documentation]]
[[Category:OpenSite documentation]]
<div class="os-page-nav">{{Docnav|OpenSite/Getting started|OpenSite/Guides|OpenSite/Guides|All guides}}</div>

Revision as of 13:59, 29 October 2026

OpenSite 0.0.1 · DevelopmentSource scope and availability


Change one quantity through opensite.document.set_quantity, recompute, and save.

Stable identifier
cli.document.set

Implementation milestone

Roadmap phase 1 (historical Phase 1).

Units

The command interprets --value in --unit and stores the canonical SI quantity. The unit id must already be registered.

Terminal example

opensite-cli document set section.osdoc --property width --value 0.25 --unit m

Python access

examples/python/document_edit.py calls document.set_quantity with a QuantityArgument built from parse_quantity('250 mm').

Output

Stdout is the inspected document after the save. Width 0.25 m and height 0.60 m give area 0.15 m².

Errors

A --value or --object that does not consume the whole argument exits 2 and reports that an argument is not a valid number. That includes a trailing suffix, a negative or out-of-range object id, and a non-finite quantity such as inf or nan. Decimal and scientific forms such as 4e-1 are accepted. The decimal mark is .. The check does not use the machine locale. Exit 2 does not modify the file. A missing required flag exits 2. A rejected edit exits 1 with the status message. An allocation or execution failure exits 1 with its own message.

Limitations

If the file has exactly one object, --object may be omitted. An object id is an integer from 1 through 9007199254740991. Derived properties cannot be edited. This does not switch the unit-preference profile.

Verification evidence

Repository evidence references (not rerun for this publication): CTest cli.document, including --value abc, 0.25m, inf, a negative object id, an oversized object id, an unchanged file after those rejections, and --value 4e-1.


Try this workflow

Quantities and profiles — a worked lesson with expected results.

Documentation basis

Source-reviewed against development commit 77c3fee13944bcc4b5d487c77eb1f82fbe4c6ea7, branch feature/phase-13c-properties-python-expressions. This review inspected the implementation and repository evidence; it did not run the Windows application or repeat CTest.

  • src/cli/main.cpp
  • src/cli/document_commands.cpp
  • src/cli/preference_commands.cpp
  • src/application/builtins.cpp

OpenSite overview · Reference · Guides