Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/osdagbridge/core/bridge_types/plate_girder/analyser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import ospgrillage as og
HAS_OSP_GRILLAGE = True
try:
import ospgrillage as og
except (ImportError, ModuleNotFoundError):
HAS_OSP_GRILLAGE = False

# from math import sqrt, pi
# import openseespy.opensees as ops
from osdagbridge.core.utils.codes.irc6_2017 import IRC6_2017
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,13 @@

import math
from collections import defaultdict, deque
import openseespy.opensees as ops

HAS_OPENSEES = True
try:
import openseespy.opensees as ops
except (ImportError, ModuleNotFoundError):
HAS_OPENSEES = False

import pandas as pd
from osdagbridge.core.utils.common import kN, m, m2
from osdagbridge.core.utils.codes.irc6_2017 import IRC6_2017
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
from matplotlib.ticker import FuncFormatter
from matplotlib.ticker import MaxNLocator
import numpy as np
import openseespy.opensees as ops

HAS_OPENSEES = True
try:
import openseespy.opensees as ops
except (ImportError, ModuleNotFoundError):
HAS_OPENSEES = False

from mpl_toolkits.mplot3d.art3d import Line3DCollection

try:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 34 additions & 9 deletions src/osdagbridge/desktop/ui/cad_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,20 @@
)
from PySide6.QtCore import QTimer, Qt

from OCC.Core.Quantity import Quantity_Color, Quantity_TOC_RGB
from OCC.Display.backend import load_backend

# CAD generator
from osdagbridge.core.bridge_types.plate_girder.cad_generator import (
PlateGirderCADGenerator
)
HAS_OCC = True
try:
from OCC.Core.Quantity import Quantity_Color, Quantity_TOC_RGB
from OCC.Display.backend import load_backend

# CAD generator
from osdagbridge.core.bridge_types.plate_girder.cad_generator import (
PlateGirderCADGenerator
)

# Custom 3D Viewer
from osdagbridge.desktop.ui.utils.custom_3dviewer import CustomViewer3d
# Custom 3D Viewer
from osdagbridge.desktop.ui.utils.custom_3dviewer import CustomViewer3d
except (ImportError, ModuleNotFoundError) as e:
HAS_OCC = False

from osdagbridge.core.bridge_types.plate_girder.dto import (
BridgeParametersDTO,
Expand All @@ -46,6 +50,23 @@ class CAD3DWindow(QWidget):
def __init__(self, parent=None):
super().__init__(parent)

if not HAS_OCC:
from PySide6.QtWidgets import QLabel
self.layout = QVBoxLayout(self)
self.layout.setAlignment(Qt.AlignCenter)

self.label = QLabel(
"<h3>3D CAD Viewer Unavailable</h3>"
"<p>The 3D viewer requires <b>pythonocc-core</b>, which is not installed in your Python environment.</p>"
"<p>To enable 3D viewing, please install it via conda:<br>"
"<code>conda install -c conda-forge pythonocc-core=7.6.2</code></p>"
)
self.label.setTextFormat(Qt.RichText)
self.label.setAlignment(Qt.AlignCenter)
self.label.setStyleSheet("color: #555555; font-size: 14px; padding: 20px; border: 1px solid #cccccc; border-radius: 8px; background-color: #fafafa;")
self.layout.addWidget(self.label)
return

# CAD generator
self.generator = PlateGirderCADGenerator()

Expand Down Expand Up @@ -77,6 +98,8 @@ def init_display(self):
Does NOT generate or render any geometry.
Call render_3d_cad() to render the model.
"""
if not HAS_OCC:
return
load_backend("pyside6")

self.viewer = CustomViewer3d(self)
Expand Down Expand Up @@ -112,6 +135,8 @@ def _complete_cad_init(self):
self.create_cad_view_controls()

def _is_display_ready(self):
if not HAS_OCC:
return False
return self.display is not None and not self._cad_init_pending

# ── RENDER / CLEAR ────────────────────────────────────────────────────────
Expand Down
4 changes: 4 additions & 0 deletions src/osdagbridge/desktop/ui/dialogs/additional_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ def init_ui(self):
# Keep girder count in sync across tabs
try:
self.typical_section_tab.girder_count_changed.connect(self.section_properties_tab.set_girder_count)
if hasattr(self.typical_section_tab, "cad_params_changed") and hasattr(self.section_properties_tab, "update_cad_params"):
self.typical_section_tab.cad_params_changed.connect(self.section_properties_tab.update_cad_params)
if hasattr(self, "_initial_cad_state") and self._initial_cad_state:
self.typical_section_tab.cad_params_changed.emit(self._initial_cad_state)
self._sync_member_properties_girder_count()
except Exception:
pass
Expand Down
Loading