FCS Scripting Language - Knowledge Base for LLM Agents
This folder contains documentation and examples for training AI coding agents (Golem) to write FemCAD Script (FCS) code.
Purpose
Enable LLM agents to:
- Understand and write FCS scripts without access to interpreter source code
- Generate valid geometry, mesh, and analysis definitions
- Work with the FLI command-line interface
- Create structural engineering models programmatically
Documentation Files
| File | Description |
|---|---|
| 01-LANGUAGE-BASICS.md | Syntax, types, operators, functions, control flow |
| 02-GEOMETRY-PRIMITIVES.md | Vertices, curves, areas, volumes, layers |
| 03-ANALYSIS-FEM-KEYWORDS.md | Materials, mesh, members, supports, loads |
| 04-CLASSES-DISTRIBUTIONS.md | GClass, GBlock, distributions, tractions |
| 05-FLI-CLI-USAGE.md | FLI command-line interpreter reference |
| 06-WORKED-EXAMPLES.md | Annotated complete FCS scripts |
| 07-PITFALLS-GOTCHAS.md | Common mistakes and confusing aspects |
| 08-AI-GEOMETRY-VALIDATION.md | Numeric validation methods for AI agents |
| 09-HISCENE-FORMAT.md | HiScene JSON scene format for geometry validation |
| 10-FEMCAD5-GUI-TESTCASES.md | FemCAD 5 GUI interactive test cases |
| 11-HBC2-ARCHITECTURE.md | HBC-2 Building Configurator project architecture, component mapping, and Golem test guide |
| 12-BOOLEAN-AND-CSG.md | CSG volume operations (csg, subtract/union/intersection), debug_boolean, 2-D area islands |
| 13-ADVANCED-GEOMETRY.md | filletedpoly, high-order spline curves, pointlcs/curvelcs, revolution, curved tractions |
| 14-BEAM-ADVANCED.md | MirrorCssZ/Y, eccentricity, hinges (Fcs.Beam.Hinges), CharacteristicsSolver, angle cuts |
| 15-MESH-CONNECTIVITY.md | HangingNodes, Fcs.Assembly.AllBeams/AllShells/ShellsInLayer, WeldNodes, AutoConnect |
| 16-SLABS-RIBS-ORTHOTROPIC.md | ThicknessOrthotropic, orthotropic panel JSON library, rib-Z on slab, model_shell3d options |
| 17-LOADS-ADVANCED.md | VariableSymbol engineering quantities, EN snow/wind, gridValues, silo pressure, vertex loads |
| 18-STEEL-DESIGN-LIBRARY.md | Fcs.SteelLib sections, materials, connections, ULS design checks, CharacteristicsSolver |
| 19-CONFIGURATOR-PATTERNS.md | gblock if(), distribution ithparameters, constraint triggers, _updated.fcs deep paths |
| 20-API-REFERENCE.md | Fcm, Fcs.Assembly, VariableSymbol, Unit constants, RestClient, Mesh.* settings |
| 21-OUTPUT-AND-REPORTING.md | FCS.Reporting Chapter/Paragraph/Formula, rw.SVu/SEVu/SD/M/Eu, ImageRenderer, DXF export |
| 22-FCC-PLATFORM-INTEGRATION.md | FCC folder structure, Fcs.Parameter.Item* types, PVC lifecycle, ProjectSpace types, REST API |
| 23-LOADGROUPS-AND-COMBINATIONS.md | FitLoadGroup/Case/Envelope hierarchy and combinatorial framework (Eurocode) |
| 24-IMAGE-RENDERING-AND-SETTINGS.md | Fcs.Presentation.ImageRenderer, .fcsdrs draw settings, .fcsdrv view settings |
| 25-ANALYSIS-DESIGN-PIPELINE.md | AnalysisCase → MeshConnect → BeamsFemResults → StructureCheck pipeline |
| 26-MATERIAL-VISUALIZATION.md | Layer material { ... } properties for beautiful WebGL/HiScene visualization without .fcsdrs |
| 27-FCC-INPUT-ITEM-ARRAY.md | res.fit.InputItemArray, PVC array schemas, count assumptions, and InputPage registration |
Example Projects
| Folder | Description |
|---|---|
| examples/parametric-chair/ | Multi-file parametric model demonstrating component reuse |
| examples/parametric-warehouse/ | 6-file steel warehouse with distributions, ithparameters, LCS transforms |
| examples/helix-spring/ | Parametric coil spring using zero-spacing distribution and per-segment trig coordinates |
| examples/snowwhite-dining/ | Box/Chair/Table assembly with Rz directional placement (Snow White and 7 Dwarfs) |
| examples/cantilever-x-beam/ | X-section cruciform profile, per-index parameter arrays, tapered truss tower |
| examples/warehouse-v2/ | Full steel portal-frame building: HEA columns, Z-purlins, wall/roof cladding LCS rotations |
| examples/material-rich-scene/ | Inline layer material palette: concrete, metals, timber, glass, ghost, emissive, and overlay materials |
| golem-tests/ | AI agent test cases and validation scripts |
Learning Path
- Start with basics: Read
01-LANGUAGE-BASICS.mdfor syntax and types - Learn geometry: Read
02-GEOMETRY-PRIMITIVES.mdfor creating shapes - Understand analysis: Read
03-ANALYSIS-FEM-KEYWORDS.mdfor FEM setup - Master components: Read
04-CLASSES-DISTRIBUTIONS.mdfor parametric design - Make models visually clear: Read
26-MATERIAL-VISUALIZATION.mdfor layer material presets, one-sided surfaces, glass, metal, and highlight materials - Practice with CLI: Read
05-FLI-CLI-USAGE.mdfor running scripts - Study examples: Read
06-WORKED-EXAMPLES.mdfor complete models - Build configurator input pages: Read
22-FCC-PLATFORM-INTEGRATION.mdand27-FCC-INPUT-ITEM-ARRAY.mdfor PVC-backed parameter schemas
Quick Start for AI Agents
Running FCS Scripts
# Evaluate an expression
fli.exe model.fcs "expression"
# Interactive mode
fli.exe model.fcs
# Generate output
fli.exe model.fcs expression --t PNG --o output.png
# Visual 3D model viewer (fliw = fli + WebView viewer)
fliw.exe model.fcs
Basic Syntax
# Variable assignment (value binding)
x := 10
y := x * 2
# Geometry definition
vertex {v1} xyz 0 0 0
vertex {v2} xyz 1 0 0
curve {line1} vertex {v1} {v2}
# Class instantiation
myObj := ClassName{ property1 = value1, property2 = value2 }
# Lambda function
add := a, b => a + b
FCS Language Overview
FCS is a domain-specific scripting language for structural engineering and finite element analysis. Key characteristics:
- Declarative with lazy evaluation
- Expression-oriented - everything returns a value
- Domain keywords for geometry, mesh, materials, loads
- Python-like syntax for expressions
- .fcs file extension
File Dependencies
- Scripts use
gclass {name} filename "path/to/file.fcs"for loading components - Relative paths resolve from the current script's directory
Key Concepts
Domain Objects
vertex,curve,area,volume- Geometry primitivesmaterial,thickness,cross_section- Section propertiesbeam,planestress,shell- Structural memberssupport,load- Boundary conditionsmesharea,meshcurve- Mesh control
Coordinate Systems
GCS- Global Coordinate SystemGCS.Tx(d),GCS.Ty(d),GCS.Tz(d)- TranslationGCS.Rx(a),GCS.Ry(a),GCS.Rz(a)- Rotation
Common Patterns
# Parametric model
span := 10
gblock {member} gclass {memberClass} lcs GCS parameters {length := span}
# Conditional geometry
gblock {opt} gclass {gc} lcs GCS if (hasOptionalPart)
# Array iteration
values := [1, 2, 3]
sum := values.Sum
Testing Scripts
Use FLI to validate scripts:
# Quick syntax check
fli.exe model.fcs "True" --td Warning
# Evaluate specific expression
fli.exe model.fcs "vertex1.X + vertex1.Y"
gclass {Name} filename "path.fcs"declares reusable classes- Package structure via
.fcsconfig.json