Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drill length #227

Merged
merged 3 commits into from
Feb 15, 2024
Merged
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Binary file modified examples/Grasshopper/CT_NEW_UI_Example.3dm
Binary file not shown.
Binary file modified examples/Grasshopper/CT_NEW_UI_Example.gh
Binary file not shown.
18 changes: 9 additions & 9 deletions src/compas_timber/consumers/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 6 additions & 7 deletions src/compas_timber/ghpython/components/CT_DrillHole/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
5 changes: 4 additions & 1 deletion src/compas_timber/ghpython/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading