From 8e949973fbcb8aa733411e54fec48d1300acb328 Mon Sep 17 00:00:00 2001 From: Juney Lee Date: Sat, 9 Nov 2024 22:15:33 -0500 Subject: [PATCH] creating roadblocks --- plugin/RV_force.py | 10 +++++++++- plugin/RV_force_modify.py | 2 ++ plugin/RV_form.py | 16 ++++++++++++++-- plugin/RV_form_modify.py | 1 + plugin/RV_form_relax.py | 1 + plugin/RV_form_smooth.py | 1 + plugin/RV_pattern.py | 11 +++++------ plugin/RV_pattern_modify.py | 1 + plugin/RV_pattern_openings.py | 1 + plugin/RV_pattern_relax.py | 1 + plugin/RV_pattern_supports.py | 1 + plugin/RV_thrust_modify.py | 3 +++ plugin/RV_tna_vertical.py | 11 ++++++++++- 13 files changed, 50 insertions(+), 10 deletions(-) diff --git a/plugin/RV_force.py b/plugin/RV_force.py index 8c2f475..a5ff997 100644 --- a/plugin/RV_force.py +++ b/plugin/RV_force.py @@ -14,8 +14,14 @@ def RunCommand(): session = RVSession() - form = session.find_formdiagram() + form = session.find_formdiagram(warn=False) if not form: + print("There is no FormDiagram in the scene.") + return + + force = session.find_forcediagram(warn=False) + if force: + print("ForceDiagram already exists in the scene.") return session.clear_all_forcediagrams() @@ -49,6 +55,8 @@ def RunCommand(): rs.Redraw() + print('ForceDiagram successfully created.') + if session.settings.autosave: session.record(name="Create Force Diagram") diff --git a/plugin/RV_force_modify.py b/plugin/RV_force_modify.py index 14cfcca..49f1ba5 100644 --- a/plugin/RV_force_modify.py +++ b/plugin/RV_force_modify.py @@ -12,10 +12,12 @@ def RunCommand(): form = session.find_formdiagram() if not form: + print("There is no FormDiagram in the scene.") return force = session.find_forcediagram() if not force: + print("There is no ForceDiagram in the scene.") return # ============================================================================= diff --git a/plugin/RV_form.py b/plugin/RV_form.py index d2ec335..bc0ea52 100644 --- a/plugin/RV_form.py +++ b/plugin/RV_form.py @@ -16,11 +16,21 @@ def RunCommand(): session = RVSession() - pattern = session.find_pattern() + pattern = session.find_pattern(warn=False) if not pattern: + print("There is no Pattern in the scene.") return - session.clear_all_diagrams() + if not list(pattern.mesh.vertices_where(is_support=True)): + print("Pattern has no supports! Please define supports vertices.") + return + + form = session.find_formdiagram(warn=False) + if form: + print("FormDiagram already exists in the scene.") + return + + session.clear_all_formdiagrams() # ============================================================================= # Init the form diagram @@ -72,6 +82,8 @@ def RunCommand(): rs.Redraw() + print('FormDiagram successfully created.') + if session.settings.autosave: session.record(name="Init Form Diagram") diff --git a/plugin/RV_form_modify.py b/plugin/RV_form_modify.py index 769484f..e7750a7 100644 --- a/plugin/RV_form_modify.py +++ b/plugin/RV_form_modify.py @@ -12,6 +12,7 @@ def RunCommand(): form = session.find_formdiagram() if not form: + print("There is no FormDiagram in the scene.") return # ============================================================================= diff --git a/plugin/RV_form_relax.py b/plugin/RV_form_relax.py index a4f2fbc..0634da7 100644 --- a/plugin/RV_form_relax.py +++ b/plugin/RV_form_relax.py @@ -12,6 +12,7 @@ def RunCommand(): form = session.find_formdiagram() if not form: + print("There is no FormDiagram in the scene.") return # ============================================================================= diff --git a/plugin/RV_form_smooth.py b/plugin/RV_form_smooth.py index ded560c..ce32bc8 100644 --- a/plugin/RV_form_smooth.py +++ b/plugin/RV_form_smooth.py @@ -13,6 +13,7 @@ def RunCommand(): form = session.find_formdiagram() if not form: + print("There is no FormDiagram in the scene.") return # ============================================================================= diff --git a/plugin/RV_pattern.py b/plugin/RV_pattern.py index 2c2d5f6..98db322 100644 --- a/plugin/RV_pattern.py +++ b/plugin/RV_pattern.py @@ -17,13 +17,10 @@ def RunCommand(): patternobj = session.find_pattern(warn=False) if patternobj: - if session.confirm("This will remove all current RhinoVAULT data and objects. Do you wish to proceed?"): - session.scene.clear() - else: - return + print("Pattern already exists in the scene.") + return - else: - session.scene.clear() + session.clear_all_patterns() # ============================================================================= # Make a Force "Pattern" @@ -111,6 +108,8 @@ def RunCommand(): session.scene.add(pattern, name=pattern.name) session.scene.draw() + print('Pattern successfully created.') + if session.settings.autosave: session.record(name="Make Pattern") diff --git a/plugin/RV_pattern_modify.py b/plugin/RV_pattern_modify.py index f0c98b5..92dba27 100644 --- a/plugin/RV_pattern_modify.py +++ b/plugin/RV_pattern_modify.py @@ -12,6 +12,7 @@ def RunCommand(): pattern = session.find_pattern() if not pattern: + print("There is no Pattern in the scene.") return # ============================================================================= diff --git a/plugin/RV_pattern_openings.py b/plugin/RV_pattern_openings.py index a4ef00f..934727c 100644 --- a/plugin/RV_pattern_openings.py +++ b/plugin/RV_pattern_openings.py @@ -12,6 +12,7 @@ def RunCommand(): pattern = session.find_pattern() if not pattern: + print("There is no Pattern in the scene.") return # ============================================================================= diff --git a/plugin/RV_pattern_relax.py b/plugin/RV_pattern_relax.py index 2352a88..75caa51 100644 --- a/plugin/RV_pattern_relax.py +++ b/plugin/RV_pattern_relax.py @@ -12,6 +12,7 @@ def RunCommand(): pattern = session.find_pattern() if not pattern: + print("There is no Pattern in the scene.") return # ============================================================================= diff --git a/plugin/RV_pattern_supports.py b/plugin/RV_pattern_supports.py index 5eb2e21..7da51f6 100644 --- a/plugin/RV_pattern_supports.py +++ b/plugin/RV_pattern_supports.py @@ -12,6 +12,7 @@ def RunCommand(): pattern = session.find_pattern() if not pattern: + print("There is no Pattern in the scene.") return # ============================================================================= diff --git a/plugin/RV_thrust_modify.py b/plugin/RV_thrust_modify.py index a019e06..711cd89 100644 --- a/plugin/RV_thrust_modify.py +++ b/plugin/RV_thrust_modify.py @@ -12,14 +12,17 @@ def RunCommand(): form = session.find_formdiagram() if not form: + print("There is no FormDiagram in the scene.") return force = session.find_forcediagram() if not force: + print("There is no ForceDiagram in the scene.") return thrust = session.find_thrustdiagram() if not thrust: + print("There is no ThrustDiagram in the scene.") return # ============================================================================= diff --git a/plugin/RV_tna_vertical.py b/plugin/RV_tna_vertical.py index dfa366c..167ab70 100644 --- a/plugin/RV_tna_vertical.py +++ b/plugin/RV_tna_vertical.py @@ -15,14 +15,17 @@ def RunCommand(): form = session.find_formdiagram() if not form: + print("There is no FormDiagram in the scene.") return force = session.find_forcediagram() if not force: + print("There is no ForceDiagram in the scene.") return thrust = session.find_thrustdiagram() if not thrust: + print("There is no ThrustDiagram in the scene.") return # ============================================================================= @@ -48,8 +51,11 @@ def RunCommand(): # can we not use the thrust diagram here _, scale = vertical_from_zmax(form.diagram, zmax, kmax=kmax) + if not _: + print("Vertical equilibrium failed!") + return + # store scale in force diagram - print(scale) thrustdiagram: ThrustDiagram = form.diagram.copy(cls=ThrustDiagram) thrustdiagram.name = "ThrustDiagram" @@ -69,6 +75,9 @@ def RunCommand(): thrust.diagram = thrustdiagram thrust.redraw() + print('Vertical equilibrium found!') + print('ThrustDiagram object successfully created with target height of {}.'.format(zmax)) + if session.settings.autosave: session.record(name="TNA Vertical")