> ## Documentation Index
> Fetch the complete documentation index at: https://calcs.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Template UX Rules and Functionality

> Guidelines for template user experience, load combinations, material changes, and unit handling

This guide covers important rules and functionality considerations for creating templates with excellent user experience.

## Material Changes

Calcs.com offers users the ability to change from one material to another. This functionality allows engineers to swap between different materials (e.g., timber to steel) while preserving appropriate data.

<Note>
  A public article on how users can change materials is available at [support.calcs.com](https://support.calcs.com/article/25-how-to-change-materials-for-example-swap-templates-between-timber-and-steel).
</Note>

### Widget Support for Material Changes

<Accordion title="Widget Type Compatibility">
  | Widget Type | Supported? | Comments                               |
  | ----------- | ---------- | -------------------------------------- |
  | **Input**   | ✅ Yes      | Full support for material changes      |
  | **Table**   | ✅ Yes      | Same table shape maintained            |
  | **Lookup**  | ❌ No       | Not transferred during material change |
</Accordion>

### Frequently Asked Questions

**Q: Can you change between ASD & LRFD standards?**

**A:** Yes, however, lookups are not supported so the member selector will not be transferred.

## Load Combinations

### Philosophy

The way load combinations are implemented follows these key principles:

<CardGroup cols={2}>
  <Card title="Project-Level Consistency" icon="building">
    The set of load combinations used is the same for an entire project. Load combinations can only be set in Project Defaults, not overridden in individual sheets.
  </Card>

  <Card title="Flexible Selection" icon="list">
    We provide reasonably common load combination sets that users can select from, but also allow completely custom load combinations.
  </Card>

  <Card title="Solver-Based Factoring" icon="calculator">
    All factoring of loads per load combinations happens in the solver, regardless of whether FEA is needed in a given template.
  </Card>

  <Card title="Split Factor Levels" icon="layout-columns">
    Load factors are split between project and template levels - how to apply factors is defined at project level, but the values are defined at template level.
  </Card>
</CardGroup>

### Implementation Structure

Working from project level downwards, here's how load combinations are implemented:

#### Project Defaults

**1. Hard-coding Load Types: `loadTypesBase2`**

We hard-code the load types in Project Defaults and pass them through. When we eventually allow user customization of load types, the structure is already in place.

<img src="https://mintcdn.com/clearcalcs/wCKMGQrVqWo51C47/images/migrated/9e69e939dd1f-image.png?fit=max&auto=format&n=wCKMGQrVqWo51C47&q=85&s=ed357f4b30bdec58c831d5b96565ebdf" alt="Load Types Base" width="836" height="273" data-path="images/migrated/9e69e939dd1f-image.png" />

* `combConc2`: Hard-coded load types that should always be combined into a single load type
* Currently used in Australia and New Zealand for distributed vs concentrated live loads
* Example: `["Q_dist", "Q_conc"]`

**2. Setting Load Combinations and Factor Application: `LCs_str_type`**

<img src="https://mintcdn.com/clearcalcs/0BKfHfJWdoXOtU8o/images/migrated/d59ee8629ef9-image.png?fit=max&auto=format&n=0BKfHfJWdoXOtU8o&q=85&s=5db36ae60b4b7e3139f457f13e7ae815" alt="Load Combinations" width="645" height="163" data-path="images/migrated/d59ee8629ef9-image.png" />

This sets both:

* `LCs_str2`: The load combinations to be passed to the solver in every sheet
* `LCFact_str2`: The set of mappings for how to apply load combination factors

**3. Default Factor Values: `LCFact_type`**

The set of load combination factors to use (e.g., various ψ factors in Eurocode that can be customized in National Annexes).

<img src="https://mintcdn.com/clearcalcs/-3TA4BOzcQ3BrOZT/images/migrated/9a21da385130-image.png?fit=max&auto=format&n=-3TA4BOzcQ3BrOZT&q=85&s=ad06ba5f57888bc510f2a3023c24e0a4" alt="Load Combination Factors" width="650" height="101" data-path="images/migrated/9a21da385130-image.png" />

**4. Default Factor Selections**

The default category of imposed load to use - this can be overridden by individual templates but provides sensible defaults for most users.

<img src="https://mintcdn.com/clearcalcs/E_1kb1vSSHohKQJH/images/migrated/5db1838b0d42-image.png?fit=max&auto=format&n=E_1kb1vSSHohKQJH&q=85&s=542b1d148e23b9e75e014a4c5221a71c" alt="Default Categories" width="646" height="336" data-path="images/migrated/5db1838b0d42-image.png" />

#### Template Level Implementation

**1. Pass-Through Values**

Templates pass through these values from Project Defaults unchanged:

* Load types: `loadTypesBase2`
* Concurrent load types: `combConc2`
* Load combinations: `LCs_str2`
* Factor application instructions: `LCFact_str2`

**2. Template-Specific Values: `LCFact_DB`**

Load combination factor values can be passed through or modified within individual templates.

<img src="https://mintcdn.com/clearcalcs/7GJyORIkCuwKrW7N/images/migrated/3439e127423b-image.png?fit=max&auto=format&n=7GJyORIkCuwKrW7N&q=85&s=506f3a09f39dc550017b7b5eed900511" alt="Template Factors" width="833" height="495" data-path="images/migrated/3439e127423b-image.png" />

### Load Combination Factors: `LCFact_*`

#### Structure

The instructions on **how to apply** load combination factors are separate from the **values** of the factors.

#### Values of Load Combination Factors: `LCFact_DB`

<Warning>
  Factor values MUST be an array with at least 2 items. The first item is always ignored and should be set to `0`.
</Warning>

Two types of load combination factors:

1. **Load-type specific factors**: Set as `load_type: [array]`
2. **Universal factors**: Set as `all_x: [array]` (applied to all load types)

#### How to Apply Factors: `LCFact_str`

Instructions on factor application passed in `LCFact_str` parameter:

* MUST be an array of length equal to the number of load combinations
* Values are indices for corresponding values in `LCFact_DB` (first item is index=0)

#### Example: Snow Load Combination Factor

**Setting up factor values in `LCFact_DB`:**

```
S: [0, 0.7, 0.5, 0.3]
```

**Applying factors in `LCFact_str`:**

```
S: [1, 0, 1, 1, 3, 0]
```

This applies:

* 0.7 factor to load combinations 1, 3, and 4
* 0.3 factor to load combination 5
* No factor to load combinations 2 and 6

### Load Combinations FAQ

<Accordion title="Common Questions">
  **Why is this so complicated?**

  We used to have separate solvers for each building standard with hard-coded load combinations. This was unwieldy and required dev deploys for bug fixes. We unified everything into one solver, but the price is increased parameter complexity.

  **Why use `LCFact_*` instead of multiplying factors directly into `LCs_*`?**

  For most load factors, whether to apply them and what specific value to use can vary within a building. Load combinations are set at project level, but factors can be adjusted in each sheet. For example:

  * Most of a house might have 'residential/domestic' character of imposed load
  * The roof will have a different character of imposed load
  * Stairs might be different for duplex houses
</Accordion>

## Units System

### Unit Field Conventions

<Note>
  [This video](https://drive.google.com/file/d/1ToiaO9k8fie0xR7-fctVXXaTdS0-kRx0/view?ts=63b60463) explains the main differences between unit fields: `units`, `units2`, `unitsMks`, `unitsFps`.
</Note>

In the US, we use the following convention:

<Tabs>
  <Tab title="units2">
    Forces in **kips**
  </Tab>

  <Tab title="unitsMks">
    * Forces in **kN**
    * Length in **mm**
    * Stress in **MPa**
    * Loads in **kPa**
  </Tab>

  <Tab title="unitsFps">
    Forces in **lb**
  </Tab>
</Tabs>

<img src="https://mintcdn.com/clearcalcs/-3TA4BOzcQ3BrOZT/images/migrated/959aab4d7f46-image.png?fit=max&auto=format&n=-3TA4BOzcQ3BrOZT&q=85&s=006a5f236979eb42317c7a935f3a3f2b" alt="Units Convention" width="671" height="443" data-path="images/migrated/959aab4d7f46-image.png" />

## Best Practices

<Tip>
  * Design load combinations at the project level for consistency across all sheets
  * Use template-level factor customization only when values truly vary by calculation type
  * Test material change functionality early in template development
  * Follow established unit conventions for your region
  * Document any deviations from standard approaches
</Tip>
