Skip to content

Fix report generation for models with quads and plates (fixes #268)#321

Merged
JWock82 merged 1 commit into
JWock82:mainfrom
gaoflow:fix/report-quad-plate-combo
Jun 6, 2026
Merged

Fix report generation for models with quads and plates (fixes #268)#321
JWock82 merged 1 commit into
JWock82:mainfrom
gaoflow:fix/report-quad-plate-combo

Conversation

@gaoflow

@gaoflow gaoflow commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Fixes the remaining reporting breakage from #268 (the quad/plate case @boustrephon reported, which was never addressed).

Problem

Reporting.create_report() raises KeyError: 'Combo 1' for any model containing quads or plates — e.g. Examples/Shear Wall - Advanced.py:

from Pynite import Reporting
Reporting.create_report(model, format='html', output_filepath='./ModelReport.html')
# KeyError: 'Combo 1'  (in Quad3D.D -> self.i_node.DX[combo_name])

Root cause

Quad3D/Plate3D shear(), moment() and membrane() all have the signature

def shear(self, xi=0.0, eta=0.0, local=True, combo_name='Combo 1'): ...

The report template called them as quad.shear(-1, -1, combo.name) — so the combo name was bound to local, and combo_name kept its default 'Combo 1'. Since most models never analyze the default 'Combo 1', the subsequent node.DX['Combo 1'] lookup raised KeyError. (The member.* calls are unaffected — their third positional arg genuinely is combo_name.)

A second, latent template bug was masked behind the first: membrane() returns a (3, 1) column vector, but several cells indexed it as [n] instead of [n][0], leaving a 1-element array that the "%.3g" | format(...) filter cannot render (TypeError: only 0-dimensional arrays can be converted to Python scalars).

Fix

  • Pass combo_name=combo.name as a keyword on every plate/quad shear/moment/membrane call (80 sites) so local keeps its intended default.
  • Normalize membrane result indexing to [n][0] (24 sites), matching shear/moment and the already-correct membrane cells.

Template-only change — no solver code touched.

Verification

  • Examples/Shear Wall - Advanced.py + create_report(...) now renders a complete 8 MB HTML report (previously raised immediately).
  • New Testing/test_reporting.py: builds a supported quad and plate under pressure, analyzes a single custom-named combo (1.4D) so the default Combo 1 is never solved, generates the HTML report, and asserts it does not raise, that the analyzed combo appears, and that Combo 1 does not. The test fails on main (KeyError: 'Combo 1') and passes with this change.
  • Beam-only reports (no quads/plates) still render unchanged.
  • Full core suite: 116 passed (115 + the new test).

Note: #268 originally bundled three problems; the first two were resolved in v1.2.0 / v1.5.0, and this addresses the last outstanding one. Happy to retarget to a dedicated issue number if you'd prefer.

Reporting.create_report() raised KeyError: 'Combo 1' for any model
containing quads or plates. The report template passed the load
combination name as the third positional argument to the elements'
shear()/moment()/membrane() methods, whose signature is
(xi, eta, local=True, combo_name='Combo 1'). The name therefore landed
in the 'local' slot and combo_name stayed at its default 'Combo 1',
which is not analyzed in most models, raising KeyError on the node
displacement lookup.

Pass combo_name as a keyword so 'local' keeps its default. Also fix the
membrane() result indexing, which returns a (3, 1) column vector: some
cells indexed it as [n] (leaving a 1-element array that the '%.3g'
format filter cannot render) instead of [n][0] like shear()/moment().

Adds Testing/test_reporting.py covering a quad+plate model analyzed for
a single custom-named combo (so the default 'Combo 1' is never solved).

Fixes JWock82#268
@JWock82 JWock82 merged commit 147c7aa into JWock82:main Jun 6, 2026
2 checks passed
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