sgio.plot_model_2d_plotly#

sgio.plot_model_2d_plotly(model, sg=None, pba_length: float | None = None, pba_scale: float = 0.6, show_principal_axes: bool = True, show_centers: bool = True, fig=None, output_html: str | Path | None = None, title: str = '')#

Plot the constitutive-model overlays of a 2D beam section using plotly.

Plotly counterpart of plot_model_2d(). Renders the principal bending axes and the feature centers (mass / tension / shear). Intended to be combined with plot_sg_2d_plotly() by sharing the fig, but can be used on its own.

Because the principal-axis segments are drawn with a finite length, their size is taken from pba_length if given, otherwise from the section in-plane extent (when sg is provided), otherwise a unit length.

Parameters:
  • model (object) – Constitutive model with get_center / get_axis_angle methods.

  • sg (StructureGene, optional) – Structure gene whose mesh sets the principal-axis segment length when pba_length is not given. Default None.

  • pba_length (float, optional) – Explicit half-length of the principal-axis segments. Overrides the value derived from sg. Default None.

  • pba_scale (float, optional) – Principal-axis segment length as a fraction of half the section’s in-plane bounding-box diagonal (used only when the length is derived from sg). Default 0.6.

  • show_principal_axes (bool, optional) – Whether to draw the principal bending axes. Default True.

  • show_centers (bool, optional) – Whether to draw mass / tension / shear centers. Default True.

  • fig (plotly.graph_objects.Figure, optional) – Existing figure to add the overlay traces to. If None a new figure is created. Default None.

  • output_html (str or Path, optional) – If given, the figure is written to this HTML file.

  • title (str, optional) – Optional figure title (used only when creating a new figure).

Returns:

The figure the overlays were added to.

Return type:

plotly.graph_objects.Figure