FOUNDATION DESIGN r5 — EXTENDED PYTHON-LIKE APP SYNTAX ====================================================== The website retains the original, easy-to-author model script format: # ~~~Input~~~ ... simple name = value declarations ... # ~~~Selector~~~:Choice A,Choice B ... selector_name = "Choice A" ... # ~~~Calculation~~~ ... named arithmetic calculations and outputs ... The source file has the .py extension for continuity. IMPORTANT: Foundation Design does not invoke Python at all. A restricted, auditable interpreter implemented in Node.js evaluates only the supported numerical language. Code CANNOT read files, import arbitrary packages, access the OS, call APIs, spawn processes, open network connections, or execute dynamic programs. COMPLETE USER APP EXAMPLE ------------------------- # @field B | Footing width | m | 0.1 | 100 # @field L | Footing length | m | 0.1 | 100 # @field P | Applied vertical load | kN | 0.01 | 1000000 # @field qa | Allowable soil pressure | kPa | 0.1 | 1000000 # @field SF_req | Required demand/capacity reserve | - | 1 | 8 # ~~~Input~~~ B = 3 L = 4 P = 1800 qa = 200 SF_req = 1.3 # ~~~Calculation~~~ area = B * L pressure = P / area reserve = qa / pressure result("Average bearing pressure", pressure, "kPa") result("Available bearing pressure", qa, "kPa") result("Allowable / applied ratio", reserve, "-") if reserve >= SF_req: result("Design check", "Meets specified target", "-") else: result("Design check", "Below target", "-") print("Applied pressure:", round(pressure, 2), "kPa") plot("Footing width sensitivity", "B", "Average bearing pressure", 1, 10) SYNTAX / COMPATIBILITY ----------------------- * Input block: one named variable per line, numeric, quoted string, or boolean. Optional # @field name | label | unit | minimum | maximum controls forms. Without metadata, numeric fields have a very broad default bound. * Selector block: # ~~~Selector~~~:Option A,Option B immediately BEFORE the variable. A text default such as "Option A" uses the chosen text value; numeric 0/1 defaults use the index for existing reviewed methods. * Calculation: numeric/string assignments; + - * / // % **; comparisons == != < > <= >=; and/or/not; if/elif/else blocks (indent 4 spaces); and approved math functions (sin, cos, tan, asin, acos, atan, atan2, exp, sqrt, log, log10, ln, min, max, round, abs, pow, floor, ceil, radians, degrees, hypot, clamp, choose). * pi is the mathematical constant. The names np.sin, np.pi, math.sqrt, math.pi, m.tan, mt.exp, etc. work for scalar operations. Statements such as "import numpy as np" and "import math as mt" are ignored safely; they never load or execute Python libraries. * print("description", value, "unit") or older print "description", value displays readable narrative lines exactly where the app requests them. * result("Quantity label", numeric_or_text_value, "unit") displays a structured calculation output. The app controls both values and order. * plot("Plot title", "input_name", "result_label", lower, upper) generates a sensitivity plot of a structured result produced by this same script. A maximum of 2 plots with 25 points each can be requested. * choose(condition, true_value, false_value) selects a branch lazily. * Code execution has bounds for source bytes, lines, nesting, outputs and arithmetic magnitude. Unsupported constructs return a clear error. * Bounded scalar programs are supported. Arbitrary for/while loops, def, array indexing, NumPy arrays, scipy optimizers, matplotlib scripts, files, OS access, and network calls ARE NOT supported in this version. * A pre-reviewed multi-input engineering kernel can be invoked using: # ~~~ReviewedMethod~~~:design-gravity-wall ... @field declarations ... # ~~~Input~~~ ... declared exact trusted-method inputs ... # ~~~Calculation~~~ reviewed_method() The method must exist in the built-in, whitelisted Node.js engineering method library. Arbitrary user-provided implementations cannot be loaded. FILE PAIR FOR EACH APP ---------------------- Method file: .py Engineering input/algorithm/output/plot language. Theory file: .tex Introduction, equations, parameter units, assumptions, design checks, and references. Figure: .svg/png Diagram showing geometry and key parameters. The .tex renderer handles section headings, paragraphs, bullet lists, and TeX math delimiters ($...$, \[ ... \], and equation environments) through DOM-safe formatting and optional MathJax. It is NOT a full TeX compiler. For developers: see docs/SCRIPT_INTERPRETER_R5.md and catalog/apps/r5-mc-shear.py for an illustrative independent method.