> ## 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.

# Free-Body Diagram

> Plot free-body diagrams with all factored loads and reactions for specific load combinations

The Free-Body Diagram is used throughout the modern platform to plot a free-body diagram with all factored loads and reactions for a specific load combination. It uses diagram widget type `"beamFreeBody"`.

## Implementation

<CodeBlock title="Basic Free-Body Diagram">
  ```json theme={null}
  {
      "type": "sheetTemplateWidgets",
      "attributes": {
          "type": "diagram",
          "diagram": [
              {
                  "type": "beamFreeBody"
              }
          ],
          "equation": [
              {
                  "result": "{PARAMETERS}",
                  "condition": "CONDITIONS"
              }
          ],
          "referenceId": "free_body_diagram"
      }
  }
  ```
</CodeBlock>

## Plot Parameters

| Parameter  | Format           | Example             | Description                                                                                                                    |
| ---------- | ---------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| xData      | array of numbers | `remote.plot.x`     | X coordinates along the beam                                                                                                   |
| PL         | array of dicts   | `remote.plot.fbPL`  | Point load locations and magnitudes                                                                                            |
| DL         | array of numbers | `remote.plot.fbDL`  | Distributed load values at each X-coordinate                                                                                   |
| ML         | array of dicts   | `remote.plot.fbML`  | Moment load locations and magnitudes                                                                                           |
| AL         | array of dicts   | `remote.plot.fbAL`  | Axial load locations and magnitudes                                                                                            |
| ADL        | array of numbers | `remote.plot.fbADL` | Axial distributed load values at each X-coordinate                                                                             |
| R          | array of dicts   | `remote.plot.fbR`   | Reaction magnitudes and locations                                                                                              |
| lenConvert | number           | `0.001`             | (defaults to `0.001`) Conversion factor for lengths                                                                            |
| lenUnit    | string           | `"m"`               | (defaults to `"m"`) Unit for lengths                                                                                           |
| plUnit     | string           | `"kN"`              | (defaults to `"kN"`) Unit for point loads                                                                                      |
| mlUnit     | string           | `"kNm"`             | (defaults to `"kNm"`) Unit for moment loads                                                                                    |
| dlUnit     | string           | `"kN/m"`            | (defaults to `"kN/m"`) Unit for distributed loads                                                                              |
| column     | boolean          | `false`             | (defaults to `false`) Whether to plot free body diagram vertically, adjusting text locations appropriately                     |
| allFactor  | number           | `1`                 | (defaults to `1`) Factor by which to adjust all load and reaction values. Useful to display FBD including k1 factors in timber |
| wall       | number           | `0`                 | (defaults to `0`) Height of the wall to display                                                                                |

## Load Data Formats

### Point Loads (PL)

The point loads array contains dictionaries with load information:

<CodeBlock title="Point Loads Format">
  ```javascript theme={null}
  PL: [
      {
          x: 2.5,        // Location along beam
          P: 150,        // Load magnitude
          label: "P1"    // Optional label
      },
      // ... more point loads
  ]
  ```
</CodeBlock>

### Distributed Loads (DL)

Distributed loads are provided as an array of values corresponding to the x-coordinates:

<CodeBlock title="Distributed Loads Format">
  ```javascript theme={null}
  xData: [0, 1, 2, 3, 4, 5],     // X coordinates
  DL: [0, 10, 10, 15, 15, 0]     // Load values at each x coordinate
  ```
</CodeBlock>

### Moment Loads (ML)

Moment loads follow a similar format to point loads:

<CodeBlock title="Moment Loads Format">
  ```javascript theme={null}
  ML: [
      {
          x: 1.8,        // Location along beam
          M: 50,         // Moment magnitude
          label: "M1"    // Optional label
      }
  ]
  ```
</CodeBlock>

### Reactions (R)

Reactions include support information and magnitudes:

<CodeBlock title="Reactions Format">
  ```javascript theme={null}
  R: [
      {
          x: 0,          // Support location
          Ry: 125,       // Vertical reaction
          Rx: 0,         // Horizontal reaction (if any)
          Mz: 0,         // Moment reaction (if any)
          type: "pin"    // Support type
      }
  ]
  ```
</CodeBlock>

## Example Implementation

<CodeBlock title="Complete Free-Body Diagram Example">
  ```json theme={null}
  {
      "type": "sheetTemplateWidgets",
      "attributes": {
          "type": "diagram",
          "diagram": [
              {
                  "type": "beamFreeBody"
              }
          ],
          "equation": [
              {
                  "result": "{
                      xData: remote.plot.x,
                      PL: remote.plot.fbPL,
                      DL: remote.plot.fbDL,
                      ML: remote.plot.fbML,
                      R: remote.plot.fbR,
                      lenUnit: \"m\",
                      plUnit: \"kN\",
                      dlUnit: \"kN/m\",
                      mlUnit: \"kNm\"
                  }",
                  "condition": "@default"
              }
          ],
          "referenceId": "load_combination_fbd",
          "label": "Free Body Diagram - Ultimate Limit State",
          "showInSuperSummary": true
      }
  }
  ```
</CodeBlock>

## Special Features

### Column Mode

Set `column: true` to display the free-body diagram vertically, which is useful for column analysis:

<CodeBlock title="Vertical Free-Body Diagram">
  ```javascript theme={null}
  {
      column: true,
      wall: 3000,  // Height of wall/column in mm
      // ... other parameters
  }
  ```
</CodeBlock>

### Load Factoring

Use `allFactor` to apply additional factors to all loads and reactions:

<CodeBlock title="Load Factoring Example">
  ```javascript theme={null}
  {
      allFactor: 1.2,  // Apply 20% additional factor
      // ... other parameters
  }
  ```
</CodeBlock>

<Note>
  This is particularly useful in timber design where k1 factors need to be displayed in the free-body diagram.
</Note>

## Integration with Beam Solvers

Free-body diagrams are typically used with beam solver results:

<CodeBlock title="Beam Solver Integration">
  ```json theme={null}
  {
      "type": "sheetTemplateWidgets",
      "attributes": {
          "type": "remote",
          "solver": "beam",
          "equation": [
              {
                  "condition": "@default",
                  "result": "{
                      L: beam_length,
                      r: support_data,
                      PL: point_loads,
                      DL: distributed_loads,
                      // ... other beam parameters
                  }"
              }
          ],
          "referenceId": "beam_analysis"
      }
  }
  ```
</CodeBlock>

## Best Practices

1. **Units**: Ensure consistent units throughout all load and dimension parameters
2. **Load Combinations**: Create separate diagrams for different load combinations
3. **Labels**: Use clear, descriptive labels for loads and reactions
4. **Visibility**: Use `visibleIf` conditions to show diagrams only when relevant
5. **Solver Integration**: Always source data from beam solvers for accuracy

<Tip>
  Free-body diagrams are excellent for verification and presentation. They help engineers quickly verify that loads and reactions are properly balanced and correctly applied.
</Tip>

<Warning>
  The free-body diagram shows factored loads for the specified load combination. Ensure that the load factors applied in the beam solver match what you want to display in the diagram.
</Warning>
