Skip to content

Commit ec73241

Browse files
authored
Merge pull request #373 from cfsengineering/ui-updates
ui general updates
2 parents b90f001 + a7610fb commit ec73241

3 files changed

Lines changed: 24 additions & 15 deletions

File tree

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# For mac users: CONDA_SUBDIR=osx-64 conda env create -f ceasiompy.yml
1+
# For mac users: CONDA_SUBDIR=osx-64 conda env create -f environment.yml
22

33
name: ceasiompy
44

src/app/01_✈️_Geometry.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -508,12 +508,21 @@ def section_select_cpacs() -> None:
508508
title += ")"
509509
st.markdown(title)
510510

511-
_, col, _ = st.columns(spec=[0.1, 1.0, 0.1])
512-
with col:
513-
section_3d_view(
514-
cpacs=cpacs,
515-
force_regenerate=True,
516-
)
511+
section_3d_view(
512+
cpacs=cpacs,
513+
force_regenerate=True,
514+
)
515+
516+
cpacs_path = Path(cpacs.cpacs_file)
517+
if cpacs_path.exists():
518+
with open(cpacs_path, "rb") as f:
519+
st.download_button(
520+
label="Download CPACS file",
521+
data=f,
522+
file_name=cpacs_path.name,
523+
mime="application/octet-stream",
524+
width="stretch",
525+
)
517526

518527
# Once 3D view of CPACS file is done scroll down
519528
scroll_down()

src/ceasiompy/utils/plot.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -294,14 +294,14 @@ def get_aircraft_mesh_data(
294294
"""Returns (x, y, z, i, j, k), and when symmetry: only y >= 0.0"""
295295

296296
cpacs_path = Path(cpacs.cpacs_file)
297-
stl_name = cpacs_path.stem
297+
vtp_name = cpacs_path.stem
298298
if symmetry:
299-
stl_name = f"{stl_name}_symmetry"
300-
stl_file = Path(tempfile.gettempdir()) / f"{stl_name}.stl"
299+
vtp_name = f"{vtp_name}_symmetry"
300+
vtp_file = Path(tempfile.gettempdir()) / f"{vtp_name}.vtp"
301301

302-
if force_regenerate or not stl_file.exists():
302+
if force_regenerate or not vtp_file.exists():
303303
try:
304-
with st.spinner("Meshing geometry (STL export)..."):
304+
with st.spinner("Meshing geometry (VTP export)..."):
305305
warning_signature = "Warning: 1 face has been skipped due to null triangulation"
306306
with (
307307
tempfile.TemporaryFile(mode="w+b") as stdout_capture,
@@ -312,7 +312,7 @@ def get_aircraft_mesh_data(
312312
try:
313313
os.dup2(stdout_capture.fileno(), 1)
314314
os.dup2(stderr_capture.fileno(), 2)
315-
cpacs.aircraft.tigl.exportMeshedGeometrySTL(str(stl_file), 0.01)
315+
cpacs.aircraft.tigl.exportMeshedGeometryVTK(str(vtp_file), 0.01)
316316
finally:
317317
os.dup2(saved_stdout_fd, 1)
318318
os.dup2(saved_stderr_fd, 2)
@@ -331,12 +331,12 @@ def get_aircraft_mesh_data(
331331
return None
332332

333333
try:
334-
your_mesh = mesh.Mesh.from_file(stl_file)
334+
your_mesh = mesh.Mesh.from_file(vtp_file)
335335
except Exception as e:
336336
st.error(f"Cannot load 3D preview mesh file: {e=}.")
337337
return None
338338

339-
log.info(f"Mesh from stl at {stl_file=}")
339+
log.info(f"Mesh from stl at {vtp_file=}")
340340

341341
mesh_vectors = your_mesh.vectors
342342
if symmetry:

0 commit comments

Comments
 (0)