Skip to content

Sasmodels shape visualization#708

Draft
wpotrzebowski wants to merge 8 commits intomasterfrom
simple_visualizer
Draft

Sasmodels shape visualization#708
wpotrzebowski wants to merge 8 commits intomasterfrom
simple_visualizer

Conversation

@wpotrzebowski
Copy link
Copy Markdown
Contributor

Summary

This PR adds 3D shape visualization for sasmodels: models can declare support, build meshes from form-factor parameters, and callers can render figures for docs and reports.

Relation to SASBDB

This work supports SASBDB report functionality on SasView (SasView/sasview#3912)

Changes

  • ModelInfo: add has_shape_visualization, read from each model module (sasmodels/modelinfo.py).
  • Form-factor models: set has_shape_visualization and implement create_mesh where a 3D shape exists; other models set has_shape_visualization = False.
  • explore/shape_visualizer.py: shape detection, 3D plots (optional cross-sections), and generate_shape_image for non-interactive PNG output (API for host apps).
  • explore/sasmodels_shape_gui.py: small GUI to browse models and preview visualizations.
  • explore/add_visualization_to_models.py: helper to batch visualization code into model files.

Dependencies

Visualization uses matplotlib and numpy; suitable for optional explore tooling and opt-in image generation in applications.

@pkienzle
Copy link
Copy Markdown
Contributor

pkienzle commented Apr 2, 2026

This is a lot of code to maintain. Can you instead create a 3d model representation for each shape and use other tools for meshing and cross sections?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants