Skip to content

Commit

Permalink
Pass settings
Browse files Browse the repository at this point in the history
  • Loading branch information
oberbichler committed Apr 6, 2022
1 parent f0c8973 commit 6428f09
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions nfem/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1137,26 +1137,28 @@ def load_displacement_curve(self, dof: DofID,
def _ipython_display_(self) -> None:
self.show()

def html(self) -> str:
def html(self, height: int = 500, timestep: int = 0) -> str:
timesteps = []

for model in self.get_model_history():
timestep = {}
ts = {}

timestep['name'] = model.name or ''
ts['name'] = model.name or ''

timestep['objects'] = objects = []
ts['objects'] = objects = []

for element in model.elements:
element.draw(objects)

for node in model.nodes:
node.draw(objects)

timesteps.append(timestep)
timesteps.append(ts)

data = dict(
settings=dict(
height=height,
timestep=timestep,
),
timesteps=timesteps,
)
Expand All @@ -1166,6 +1168,6 @@ def html(self) -> str:
return load_html('model-viewer', data)

def show(self, height: int = 500, timestep: int = 0) -> None:
raw_html = self.html()
raw_html = self.html(height, timestep)

show_html(raw_html, height, iframe=True)

0 comments on commit 6428f09

Please sign in to comment.