<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://kfdani-001-site10.gtempurl.com/index.php?action=history&amp;feed=atom&amp;title=OpenSite%2FGuides%2FFirst_document</id>
	<title>OpenSite/Guides/First document - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://kfdani-001-site10.gtempurl.com/index.php?action=history&amp;feed=atom&amp;title=OpenSite%2FGuides%2FFirst_document"/>
	<link rel="alternate" type="text/html" href="https://kfdani-001-site10.gtempurl.com/index.php?title=OpenSite/Guides/First_document&amp;action=history"/>
	<updated>2026-10-30T02:06:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.2</generator>
	<entry>
		<id>https://kfdani-001-site10.gtempurl.com/index.php?title=OpenSite/Guides/First_document&amp;diff=825&amp;oldid=prev</id>
		<title>BathAfrica: Publish rewritten step-by-step OpenSite lesson with checked results</title>
		<link rel="alternate" type="text/html" href="https://kfdani-001-site10.gtempurl.com/index.php?title=OpenSite/Guides/First_document&amp;diff=825&amp;oldid=prev"/>
		<updated>2026-10-29T20:58:54Z</updated>

		<summary type="html">&lt;p&gt;Publish rewritten step-by-step OpenSite lesson with checked results&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
{{OpenSite scope}}&lt;br /&gt;
{{OpenSite lesson&lt;br /&gt;
|id=opensite.help.first-document&lt;br /&gt;
|summary=Create a small rectangular-section document, change one dimension, undo and redo, then save and reopen it.&lt;br /&gt;
|prerequisites=A matching OpenSite development build. Run the complete example with the explicit development host because &amp;lt;code&amp;gt;document.create_section&amp;lt;/code&amp;gt; uses &amp;lt;code&amp;gt;document.edit&amp;lt;/code&amp;gt;. Use a practice document, not a live project.&lt;br /&gt;
|steps==== Create the practice section ===&lt;br /&gt;
The example starts at 250 mm wide and 500 mm high. The stored lengths are 0.25 m and 0.50 m. This rectangle is a document-engine example, not a section-design or FEM workflow.&lt;br /&gt;
[[File:OpenSite_Rectangle_Lesson.svg|720px|center]]&lt;br /&gt;
&lt;br /&gt;
=== Change width and inspect the result ===&lt;br /&gt;
Change width to 300 mm using &amp;lt;code&amp;gt;document.set_quantity&amp;lt;/code&amp;gt;. The height remains 500 mm and area changes from 0.125 to 0.15 m². Derived values are recomputed by the transaction.&lt;br /&gt;
&lt;br /&gt;
=== Undo and redo ===&lt;br /&gt;
Undo restores the 250 mm width. Redo reapplies 300 mm. Compare values after each operation instead of relying on a visual redraw.&lt;br /&gt;
&lt;br /&gt;
=== Save to a new location and reopen ===&lt;br /&gt;
The complete example creates a fresh temporary folder, prints its path, saves an &amp;lt;code&amp;gt;.osdoc&amp;lt;/code&amp;gt; and opens it again. The filename extension is conventional; the writer format is version 4. Undo history is not stored.&lt;br /&gt;
&lt;br /&gt;
|result=Area is 0.125 m² initially and 0.15 m² after the edit; undo restores width 0.25 m. The saved document reopens with area 0.15 m².&lt;br /&gt;
|limitations=This teaches document transactions and persistence. It does not validate a structural member or perform a design-code check.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Complete example ==&lt;br /&gt;
{{Code|lang=python|code=&amp;lt;nowiki&amp;gt;from pathlib import Path&lt;br /&gt;
from tempfile import mkdtemp&lt;br /&gt;
import opensite&lt;br /&gt;
&lt;br /&gt;
created = opensite.execute(&amp;quot;document.create_section&amp;quot;, {&lt;br /&gt;
    &amp;quot;label&amp;quot;: &amp;quot;PracticeBeam&amp;quot;,&lt;br /&gt;
    &amp;quot;width&amp;quot;: opensite.QuantityArgument(opensite.Q(&amp;quot;250 mm&amp;quot;), &amp;quot;mm&amp;quot;),&lt;br /&gt;
    &amp;quot;height&amp;quot;: opensite.QuantityArgument(opensite.Q(&amp;quot;500 mm&amp;quot;), &amp;quot;mm&amp;quot;),&lt;br /&gt;
})&lt;br /&gt;
doc, beam_id = created[&amp;quot;document&amp;quot;], created[&amp;quot;object&amp;quot;]&lt;br /&gt;
assert abs(doc.property(beam_id, &amp;quot;area&amp;quot;).si_value - 0.125) &amp;lt; 1e-12&lt;br /&gt;
&lt;br /&gt;
opensite.execute(&amp;quot;document.set_quantity&amp;quot;, {&lt;br /&gt;
    &amp;quot;document&amp;quot;: doc, &amp;quot;object&amp;quot;: beam_id, &amp;quot;property&amp;quot;: &amp;quot;width&amp;quot;,&lt;br /&gt;
    &amp;quot;value&amp;quot;: opensite.QuantityArgument(opensite.Q(&amp;quot;300 mm&amp;quot;), &amp;quot;mm&amp;quot;),&lt;br /&gt;
})&lt;br /&gt;
assert abs(doc.property(beam_id, &amp;quot;area&amp;quot;).si_value - 0.15) &amp;lt; 1e-12&lt;br /&gt;
opensite.execute(&amp;quot;document.undo&amp;quot;, {&amp;quot;document&amp;quot;: doc})&lt;br /&gt;
assert abs(doc.property(beam_id, &amp;quot;width&amp;quot;).si_value - 0.25) &amp;lt; 1e-12&lt;br /&gt;
opensite.execute(&amp;quot;document.redo&amp;quot;, {&amp;quot;document&amp;quot;: doc})&lt;br /&gt;
&lt;br /&gt;
path = Path(mkdtemp(prefix=&amp;quot;opensite-lesson-&amp;quot;)) / &amp;quot;practice-beam.osdoc&amp;quot;&lt;br /&gt;
opensite.execute(&amp;quot;document.save&amp;quot;, {&amp;quot;document&amp;quot;: doc, &amp;quot;path&amp;quot;: str(path)})&lt;br /&gt;
reopened = opensite.execute(&amp;quot;document.open&amp;quot;, {&amp;quot;path&amp;quot;: str(path)})[&amp;quot;document&amp;quot;]&lt;br /&gt;
assert abs(reopened.property(beam_id, &amp;quot;area&amp;quot;).si_value - 0.15) &amp;lt; 1e-12&lt;br /&gt;
print(&amp;quot;Saved and reopened:&amp;quot;, path)&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;os-page-nav&amp;quot;&amp;gt;{{Docnav|OpenSite/Getting started|OpenSite/Guides/Quantities and profiles|OpenSite/Guides|All guides}}&amp;lt;/div&amp;gt;&lt;br /&gt;
[[Category:OpenSite documentation]]&lt;/div&gt;</summary>
		<author><name>BathAfrica</name></author>
	</entry>
</feed>