---
url: /dyad/dev/stdlib/MultibodyComponents/components/ShapefileVisualizer.md
description: >-
  Dyad ShapefileVisualizer docs.  Frame-connected mesh visualizer with no mass
  or inertia.
---

# `ShapefileVisualizer` {#ShapefileVisualizer}

Frame-connected mesh visualizer with no mass or inertia.

Renders an external mesh file (STL/OBJ/GLTF/...) attached to `frame_a`, optionally repositioned by `shape_transform` and uniformly scaled by `shape_scale`. Use this to give a frame a non-primitive visual without introducing dynamics — for static decor (attach to `Fixed.frame_b`) or to dress up moving frames (attach to a joint's `frame_b`).

The mesh is loaded by `FileIO.load`, so `shapefile` must be a path resolvable at render time. A path of `""` disables rendering.

## Usage {#Usage}

`MultibodyComponents.ShapefileVisualizer(render=true, color=[0.5, 0.5, 0.5, 1.0], shapefile="", shape_transform=[[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], shape_scale=1, specular_coefficient=0.7)`

## Parameters: {#Parameters:}

|                   Name |                                          Description | Units |             Default value |
| ----------------------:| ----------------------------------------------------:| -----:| -------------------------:|
|               `render` |                                    Whether to render |     – |                      true |
|                `color` |                                           RGBA color |     – |      \[0.5, 0.5, 0.5, 1.0] |
|            `shapefile` |                Path to mesh file (empty = no render) |     – |                        "" |
|      `shape_transform` | 4x4 homogeneous transform from mesh-local to frame_a |     – | \[1 0 0 0; 0...0; 0 0 0 1] |
|          `shape_scale` |                    Uniform scale applied to the mesh |     – |                         1 |
| `specular_coefficient` |  Specular reflection coefficient (0 = fully diffuse) |     – |                       0.7 |

## Connectors {#Connectors}

* `frame_a` - Frame3D is the fundamental 3D connector used for 6DOF motion. Most components have one or several `Frame`

connectors that can be connected together ([`Frame3D`](/stdlib/Dyad/connectors/Frame3D#Frame3D))

## Behavior {#Behavior}

$$ \begin{align}
\mathtt{frame_a.f}\_{1}\left( t \right) &= 0 \\
\mathtt{frame_a.f}\_{2}\left( t \right) &= 0 \\
\mathtt{frame_a.f}\_{3}\left( t \right) &= 0 \\
\mathtt{frame_a.tau}\_{1}\left( t \right) &= 0 \\
\mathtt{frame_a.tau}\_{2}\left( t \right) &= 0 \\
\mathtt{frame_a.tau}\_{3}\left( t \right) &= 0
\end{align}
$$

## Source {#Source}

```dyad
"""
Frame-connected mesh visualizer with no mass or inertia.

Renders an external mesh file (STL/OBJ/GLTF/...) attached to `frame_a`,
optionally repositioned by `shape_transform` and uniformly scaled by
`shape_scale`. Use this to give a frame a non-primitive visual without
introducing dynamics — for static decor (attach to `Fixed.frame_b`) or to
dress up moving frames (attach to a joint's `frame_b`).

The mesh is loaded by `FileIO.load`, so `shapefile` must be a path resolvable
at render time. A path of `""` disables rendering.
"""
component ShapefileVisualizer
  frame_a = Frame3D() {
    "Dyad": {"placement": {"diagram": {"x1": 50, "x2": 150, "y1": 450, "y2": 550}}}
  }
  "Whether to render"
  parameter render::Boolean = true
  "RGBA color"
  parameter color::Real[4] = [0.5, 0.5, 0.5, 1.0]
  "Path to mesh file (empty = no render)"
  parameter shapefile::String = ""
  "4x4 homogeneous transform from mesh-local to frame_a"
  parameter shape_transform::Real[4, 4] = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]
  "Uniform scale applied to the mesh"
  parameter shape_scale::Real = 1
  "Specular reflection coefficient (0 = fully diffuse)"
  parameter specular_coefficient::Real = 0.7
relations
  frame_a.f = [0, 0, 0]
  frame_a.tau = [0, 0, 0]
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/ShapefileVisualizer.svg"},
    "labels": [
      {
        "label": "a",
        "x": 110,
        "y": 410,
        "rot": 0,
        "layer": "icon",
        "attrs": {
          "fill": "#333",
          "font-size": "80",
          "font-weight": "bold",
          "text-anchor": "middle",
          "dominant-baseline": "central"
        }
      }
    ]
  }
}
end
```

```dyad
"""
Frame-connected mesh visualizer with no mass or inertia.

Renders an external mesh file (STL/OBJ/GLTF/...) attached to `frame_a`,
optionally repositioned by `shape_transform` and uniformly scaled by
`shape_scale`. Use this to give a frame a non-primitive visual without
introducing dynamics — for static decor (attach to `Fixed.frame_b`) or to
dress up moving frames (attach to a joint's `frame_b`).

The mesh is loaded by `FileIO.load`, so `shapefile` must be a path resolvable
at render time. A path of `""` disables rendering.
"""
component ShapefileVisualizer
  frame_a = Frame3D() {
    "Dyad": {"placement": {"diagram": {"x1": 50, "x2": 150, "y1": 450, "y2": 550}}}
  }
  "Whether to render"
  parameter render::Boolean = true
  "RGBA color"
  parameter color::Real[4] = [0.5, 0.5, 0.5, 1.0]
  "Path to mesh file (empty = no render)"
  parameter shapefile::String = ""
  "4x4 homogeneous transform from mesh-local to frame_a"
  parameter shape_transform::Real[4, 4] = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]
  "Uniform scale applied to the mesh"
  parameter shape_scale::Real = 1
  "Specular reflection coefficient (0 = fully diffuse)"
  parameter specular_coefficient::Real = 0.7
relations
  frame_a.f = [0, 0, 0]
  frame_a.tau = [0, 0, 0]
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/ShapefileVisualizer.svg"},
    "labels": [
      {
        "label": "a",
        "x": 110,
        "y": 410,
        "rot": 0,
        "layer": "icon",
        "attrs": {
          "fill": "#333",
          "font-size": "80",
          "font-weight": "bold",
          "text-anchor": "middle",
          "dominant-baseline": "central"
        }
      }
    ]
  }
}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses
