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:

  1. Understand and write FCS scripts without access to interpreter source code
  2. Generate valid geometry, mesh, and analysis definitions
  3. Work with the FLI command-line interface
  4. 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

  1. Start with basics: Read 01-LANGUAGE-BASICS.md for syntax and types
  2. Learn geometry: Read 02-GEOMETRY-PRIMITIVES.md for creating shapes
  3. Understand analysis: Read 03-ANALYSIS-FEM-KEYWORDS.md for FEM setup
  4. Master components: Read 04-CLASSES-DISTRIBUTIONS.md for parametric design
  5. Make models visually clear: Read 26-MATERIAL-VISUALIZATION.md for layer material presets, one-sided surfaces, glass, metal, and highlight materials
  6. Practice with CLI: Read 05-FLI-CLI-USAGE.md for running scripts
  7. Study examples: Read 06-WORKED-EXAMPLES.md for complete models
  8. Build configurator input pages: Read 22-FCC-PLATFORM-INTEGRATION.md and 27-FCC-INPUT-ITEM-ARRAY.md for 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:

File Dependencies

Key Concepts

Domain Objects

Coordinate Systems

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"