Plot Blade Cross-Sections in 3D#

Problem Description#

A blade is described by a layout CSV listing (spanwise_location, section_name) pairs, with each section stored as a VABS input (.sg) plus its homogenization result (.sg.K). We want to view all sections together in 3D, positioned along the span, and interact with the result smoothly even for dense meshes.

Solution#

sgio.plot_sg_3d_beam_plotly() reads the layout CSV, loads each section and its analysis result, and renders them as an interactive plotly figure written to a standalone HTML file. Open the HTML in a browser to rotate, zoom, and pan.

"""Example: 3D Plot of Multiple Cross-Sections Along a Blade Span (HTML).

Reads a layout CSV listing (spanwise_location, section_name) pairs, loads
each section's VABS input (.sg) and analysis result (.sg.K), then renders
them as an interactive 3D plotly figure written to an HTML file. Open the
HTML in a browser to rotate / zoom / pan smoothly even for dense meshes.
"""
import logging
import webbrowser
from pathlib import Path

from sgio import plot_sg_3d_beam_plotly

logging.basicConfig(level=logging.INFO)

output_html = Path('blade_3d.html').resolve()

plot_sg_3d_beam_plotly(
    csv_file='blade.csv',
    section_dir='cs',
    input_format='vabs',
    model_type='BM2',
    aspect_mode='data',
    output_html=str(output_html),
    title='Blade cross-sections',
)

print(f'Wrote {output_html}')
webbrowser.open(output_html.as_uri())

Key arguments:

  • csv_file / section_dir — the layout table and where the section files live

  • input_format / model_type — how to read each section (vabs, BM2 here)

  • aspect_mode='data' — preserve true relative proportions of span vs. chord

  • output_html — write a self-contained interactive HTML file

sgio.plot_sg_3d_beam() is the matplotlib equivalent, useful for static figures; the plotly version is preferable for interactive inspection of large meshes.

Result#

blade_3d.html is written and opened in the default browser, showing every cross-section placed at its spanwise station.

uv run python examples/plot_css/run_plot_3d.py

File List#

  • run_plot_3d.py: Main Python script

  • blade.csv: Blade cross-section layout file

  • cs/: Directory of per-section VABS inputs and results