diff --git a/CHANGELOG.md b/CHANGELOG.md index 63bea00f8..99e1a7f18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fixed `AttributeError` in `SurfaceModel`. * Updated example scripts. * Calling `process_joinery` in `SurfaceModel`. +* Renamed `ShowSurfaceModelBeamType` to `ShowBeamsByCategory`. +* Changed `SurfaceModel` component input handling to give warnings instead of errors. ### Removed diff --git a/src/compas_timber/ghpython/components/CT_Model_From_Surface/code.py b/src/compas_timber/ghpython/components/CT_Model_From_Surface/code.py index c46c3e265..f0b3a12e7 100644 --- a/src/compas_timber/ghpython/components/CT_Model_From_Surface/code.py +++ b/src/compas_timber/ghpython/components/CT_Model_From_Surface/code.py @@ -12,7 +12,6 @@ from compas_timber.design import DebugInfomation from compas_timber.design import SurfaceModel - class SurfaceModelComponent(component): def RunScript(self, surface, stud_spacing, beam_width, frame_depth, z_axis, options, CreateGeometry=False): # minimum inputs required @@ -22,7 +21,18 @@ def RunScript(self, surface, stud_spacing, beam_width, frame_depth, z_axis, opti raise TypeError("Expected a compas.geometry.Surface, got: {}".format(type(surface))) if not stud_spacing: self.AddRuntimeMessage(Warning, "Input parameter 'spacing' failed to collect data") - if not isinstance(stud_spacing, float): + return + if stud_spacing is not None and not isinstance(stud_spacing, float): + raise TypeError("stud_spacing expected a float, got: {}".format(type(stud_spacing))) + if not beam_width: + self.AddRuntimeMessage(Warning, "Input parameter 'beam_width' failed to collect data") + return + if beam_width is not None and not isinstance(beam_width, float): + raise TypeError("stud_spacing expected a float, got: {}".format(type(stud_spacing))) + if not frame_depth: + self.AddRuntimeMessage(Warning, "Input parameter 'frame_depth' failed to collect data") + return + if frame_depth is not None and not isinstance(frame_depth, float): raise TypeError("stud_spacing expected a float, got: {}".format(type(stud_spacing))) if z_axis is not None and not isinstance(z_axis, RhinoVector): raise TypeError("Expected a compas.geometry.Vector, got: {}".format(type(z_axis))) diff --git a/src/compas_timber/ghpython/components/CT_ShowSurfaceModelBeamTypes/code.py b/src/compas_timber/ghpython/components/CT_ShowBeamsByCategory/code.py similarity index 94% rename from src/compas_timber/ghpython/components/CT_ShowSurfaceModelBeamTypes/code.py rename to src/compas_timber/ghpython/components/CT_ShowBeamsByCategory/code.py index d763fcf30..f7ba37406 100644 --- a/src/compas_timber/ghpython/components/CT_ShowSurfaceModelBeamTypes/code.py +++ b/src/compas_timber/ghpython/components/CT_ShowBeamsByCategory/code.py @@ -6,9 +6,9 @@ from compas_timber.ghpython.ghcomponent_helpers import rename_gh_output -class SurfaceModelJointRule(component): +class ShowBeamsByCategory(component): def __init__(self): - super(SurfaceModelJointRule, self).__init__() + super(ShowBeamsByCategory, self).__init__() self.beam_type = None if ghenv.Component.Params.Output[0].NickName == "type": self.joint_type = None diff --git a/src/compas_timber/ghpython/components/CT_ShowSurfaceModelBeamTypes/icon.png b/src/compas_timber/ghpython/components/CT_ShowBeamsByCategory/icon.png similarity index 100% rename from src/compas_timber/ghpython/components/CT_ShowSurfaceModelBeamTypes/icon.png rename to src/compas_timber/ghpython/components/CT_ShowBeamsByCategory/icon.png diff --git a/src/compas_timber/ghpython/components/CT_ShowSurfaceModelBeamTypes/metadata.json b/src/compas_timber/ghpython/components/CT_ShowBeamsByCategory/metadata.json similarity index 83% rename from src/compas_timber/ghpython/components/CT_ShowSurfaceModelBeamTypes/metadata.json rename to src/compas_timber/ghpython/components/CT_ShowBeamsByCategory/metadata.json index 0863bb9ca..fd02ae3f5 100644 --- a/src/compas_timber/ghpython/components/CT_ShowSurfaceModelBeamTypes/metadata.json +++ b/src/compas_timber/ghpython/components/CT_ShowBeamsByCategory/metadata.json @@ -1,9 +1,9 @@ { - "name": "ShowSurfaceModelBeamTypes", + "name": "ShowBeamsByCategory", "nickname": "ShowBeamType", "category": "COMPAS Timber", "subcategory": "Show", - "description": "allows user to visualize beam types in surface model.", + "description": "allows user to visualize beam categories in timber model.", "exposure": 2, "ghpython": { "isAdvancedMode": true,