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

Default_surface_model_params_SIMPLE #286

Merged
merged 4 commits into from
Sep 16, 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: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

* Added bake component for `Plate` eleents.
* Added bake component for `Plate` elements.
* Added default paramteters for `Surface Model` in the GH Component

### Changed

Expand All @@ -18,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Changed `TimberModel.walls` to return generator of `Wall` elements.
* Changed `TimberModel.plates` to return generator of `Plate` elements.
* Changed `TimberModel.joints` to return generator of `Joint` elements.
* Fixed polyline analysis for generating `SurfaceModel`

### Removed

Expand Down
7 changes: 1 addition & 6 deletions src/compas_timber/design/wall_from_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ def parse_loops(self):

def generate_perimeter_beams(self):
interior_indices = self.get_interior_segment_indices(self.outer_polyline)
print(interior_indices)
for i, segment in enumerate(self.outer_polyline.lines):
beam_def = self.BeamDefinition(segment, parent=self)
if i in interior_indices:
Expand Down Expand Up @@ -355,7 +354,6 @@ def generate_perimeter_beams(self):
self._beam_definitions.append(self.BeamDefinition(king_line, type="king_stud", parent=self))

def get_interior_segment_indices(self, polyline):
print(polyline.points)
points = polyline.points[0:-1]
out = []
for index in range(len(points)):
Expand All @@ -367,13 +365,10 @@ def get_interior_segment_indices(self, polyline):
angle = angle_vectors_signed(
points[index - 1] - points[index], points[index + 1] - points[index], self.normal, deg=True
)
print(index, angle)
if angle > 0:
print(index)
out.append(index - 1)
out.append(index)
if len(out) > 0:
out.insert(1, out[0] - 1)
out.insert(0, out[0] - 1)
return set(out)

def offset_elements(self, element_loop):
Expand Down
65 changes: 45 additions & 20 deletions src/compas_timber/ghpython/components/CT_Model_From_Surface/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,55 @@ def RunScript(self, surface, stud_spacing, beam_width, frame_depth, z_axis, opti
return
if not isinstance(surface, RhinoBrep):
raise TypeError("Expected a compas.geometry.Surface, got: {}".format(type(surface)))

units = Rhino.RhinoDoc.ActiveDoc.GetUnitSystemName(True, True, True, True)
tol = None
if units == "m":
tol = Tolerance(unit="M", absolute=1e-6, relative=1e-6)
elif units == "cm":
tol = Tolerance(unit="CM", absolute=1e-4, relative=1e-4)
elif units == "mm":
tol = Tolerance(unit="MM", absolute=1e-3, relative=1e-3)

if not stud_spacing:
self.AddRuntimeMessage(Warning, "Input parameter 'spacing' failed to collect data")
return
if stud_spacing is not None and not isinstance(stud_spacing, float):
self.AddRuntimeMessage(
Warning, "Input parameter 'stud_spacing' failed to collect data, using default value of 625mm"
)
if tol.unit == "M":
stud_spacing = 0.625
elif tol.unit == "MM":
stud_spacing = 625.0
elif tol.unit == "CM":
stud_spacing = 62.5
elif 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)))
self.AddRuntimeMessage(
Warning, "Input parameter 'beam_width' failed to collect data, using default value of 60mm"
)
if tol.unit == "M":
beam_width = 0.06
elif tol.unit == "MM":
beam_width = 60.0
elif tol.unit == "CM":
beam_width = 6.0
elif not isinstance(beam_width, float):
raise TypeError("beam_width expected a float, got: {}".format(type(beam_width)))

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)))
self.AddRuntimeMessage(
Warning, "Input parameter 'frame_depth' failed to collect data, using default value of 140mm"
)
if tol.unit == "M":
frame_depth = 0.14
elif tol.unit == "MM":
frame_depth = 140.0
elif tol.unit == "CM":
frame_depth = 14.0
elif not isinstance(frame_depth, float):
raise TypeError("frame_depth expected a float, got: {}".format(type(frame_depth)))

if z_axis is not None and not isinstance(z_axis, RhinoVector):
raise TypeError("Expected a compas.geometry.Vector, got: {}".format(type(z_axis)))

Expand All @@ -44,15 +78,6 @@ def RunScript(self, surface, stud_spacing, beam_width, frame_depth, z_axis, opti
if not options:
options = {}

units = Rhino.RhinoDoc.ActiveDoc.GetUnitSystemName(True, True, True, True)
tol = None
if units == "m":
tol = Tolerance(unit="M", absolute=1e-6, relative=1e-6)
elif units == "cm":
tol = Tolerance(unit="CM", absolute=1e-4, relative=1e-4)
elif units == "mm":
tol = Tolerance(unit="MM", absolute=1e-3, relative=1e-3)

surface_model = SurfaceModel(
Brep.from_native(surface), stud_spacing, beam_width, frame_depth, z_axis, tol, **options
)
Expand Down
Loading