diff --git a/CHANGELOG.md b/CHANGELOG.md index 57e2036a5..483192a12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,9 +17,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fixed T-Butt doesn't get extended to cross beam's plane. * `SimpleSequenceGenerator` updated to work with `compas.datastructures.assembly` and generates building plan acording to type. * Changed GH Categories for joint rules +* `BrepGeometryConsumer` continues to apply features even after the first error. +* `DrillHole` component calculates length from input line. +* `DrillHole` has default diameter proportional to beam cross-section. ### Removed +* Removed input `Length` from `DrillHole` component. ## [0.6.1] 2024-02-02 diff --git a/examples/Grasshopper/CT_NEW_UI_Example.3dm b/examples/Grasshopper/CT_NEW_UI_Example.3dm index 56da817be..bbed55a1c 100644 Binary files a/examples/Grasshopper/CT_NEW_UI_Example.3dm and b/examples/Grasshopper/CT_NEW_UI_Example.3dm differ diff --git a/examples/Grasshopper/CT_NEW_UI_Example.gh b/examples/Grasshopper/CT_NEW_UI_Example.gh index d7bb71aa3..517feb6a6 100644 Binary files a/examples/Grasshopper/CT_NEW_UI_Example.gh and b/examples/Grasshopper/CT_NEW_UI_Example.gh differ diff --git a/src/compas_timber/consumers/geometry.py b/src/compas_timber/consumers/geometry.py index 45abc75bb..5f8fda5e2 100644 --- a/src/compas_timber/consumers/geometry.py +++ b/src/compas_timber/consumers/geometry.py @@ -220,20 +220,20 @@ def result(self): for beam in self.assembly.beams: geometry = Brep.from_box(beam.blank) debug_info = None - try: - resulting_geometry = self._apply_features(geometry, beam.features) - except FeatureApplicationError as error: - resulting_geometry = geometry - debug_info = error + resulting_geometry, debug_info = self._apply_features(geometry, beam.features) yield BeamGeometry(beam, resulting_geometry, debug_info) def _apply_features(self, geometry, features): + debug_info = [] for feature in features: cls = self.FEATURE_MAP.get(type(feature), None) if not cls: raise ValueError("No applicator found for feature type: {}".format(type(feature))) feature_applicator = cls(geometry, feature) - if not feature_applicator: - continue - geometry = feature_applicator.apply() - return geometry + + try: + geometry = feature_applicator.apply() + except FeatureApplicationError as error: + debug_info.append(error) + + return geometry, debug_info diff --git a/src/compas_timber/ghpython/components/CT_DrillHole/code.py b/src/compas_timber/ghpython/components/CT_DrillHole/code.py index 7365fcf73..8529a73b0 100644 --- a/src/compas_timber/ghpython/components/CT_DrillHole/code.py +++ b/src/compas_timber/ghpython/components/CT_DrillHole/code.py @@ -8,21 +8,20 @@ class DrillHoleFeature(component): - def RunScript(self, beam, line, diameter, length): + def RunScript(self, beam, line, diameter): if not beam: self.AddRuntimeMessage(Warning, "Input parameter Beams failed to collect data") if not line: self.AddRuntimeMessage(Warning, "Input parameter Line failed to collect data") - if not diameter: - self.AddRuntimeMessage(Warning, "Input parameter Diameter failed to collect data") - if not length: - self.AddRuntimeMessage(Warning, "Input parameter Length failed to collect data") - if not (beam and line and diameter and length): + if not (beam and line): return if not isinstance(beam, list): beam = [beam] - f = DrillFeature(line_to_compas(line), diameter, length) + diameter = diameter or beam[0].width * beam[0].height * 0.5 + + line = line_to_compas(line) + f = DrillFeature(line, diameter, line.length) return FeatureDefinition(f, beam) diff --git a/src/compas_timber/ghpython/components/CT_DrillHole/metadata.json b/src/compas_timber/ghpython/components/CT_DrillHole/metadata.json index 275ac2182..f3e419726 100644 --- a/src/compas_timber/ghpython/components/CT_DrillHole/metadata.json +++ b/src/compas_timber/ghpython/components/CT_DrillHole/metadata.json @@ -26,12 +26,6 @@ "description": "The diameter of the drill hole", "typeHintID": "float", "scriptParamAccess": 0 - }, - { - "name": "Length", - "description": "The depth of the drill hole from the starting point of the line", - "typeHintID": "float", - "scriptParamAccess": 0 } ], "outputParameters": [ diff --git a/src/compas_timber/ghpython/workflow.py b/src/compas_timber/ghpython/workflow.py index 2c22784eb..777ec72c6 100644 --- a/src/compas_timber/ghpython/workflow.py +++ b/src/compas_timber/ghpython/workflow.py @@ -329,7 +329,10 @@ def has_errors(self): return self.feature_errors or self.joint_errors def add_feature_error(self, error): - self.feature_errors.append(error) + if isinstance(error, list): + self.feature_errors.extend(error) + else: + self.feature_errors.append(error) def add_joint_error(self, error): self.joint_errors.append(error)