From f8e2d7f34fde0c0e0123a6a89d7e3a9ea5c63b07 Mon Sep 17 00:00:00 2001 From: oliver bucklin Date: Fri, 24 Jan 2025 16:25:49 +0100 Subject: [PATCH 1/7] updated component --- .../components/CT_ShowBeamFaces/code.py | 29 ---------------- .../components/CT_ShowBeamFaces/icon.png | Bin 938 -> 0 bytes .../components/CT_ShowBeamFaces/metadata.json | 21 ------------ .../components/CT_Show_Beam_Ref_Face/code.py | 23 +++++++++++++ .../components/CT_Show_Beam_Ref_Face/icon.png | Bin 0 -> 864 bytes .../CT_Show_Beam_Ref_Face/metadata.json | 32 ++++++++++++++++++ 6 files changed, 55 insertions(+), 50 deletions(-) delete mode 100644 src/compas_timber/ghpython/components/CT_ShowBeamFaces/code.py delete mode 100644 src/compas_timber/ghpython/components/CT_ShowBeamFaces/icon.png delete mode 100644 src/compas_timber/ghpython/components/CT_ShowBeamFaces/metadata.json create mode 100644 src/compas_timber/ghpython/components/CT_Show_Beam_Ref_Face/code.py create mode 100644 src/compas_timber/ghpython/components/CT_Show_Beam_Ref_Face/icon.png create mode 100644 src/compas_timber/ghpython/components/CT_Show_Beam_Ref_Face/metadata.json diff --git a/src/compas_timber/ghpython/components/CT_ShowBeamFaces/code.py b/src/compas_timber/ghpython/components/CT_ShowBeamFaces/code.py deleted file mode 100644 index 921e7df23f..0000000000 --- a/src/compas_timber/ghpython/components/CT_ShowBeamFaces/code.py +++ /dev/null @@ -1,29 +0,0 @@ -# flake8: noqa -import System -from compas_rhino.conversions import point_to_rhino -from ghpythonlib.componentbase import executingcomponent as component - - -class ShowBeamFaces(component): - def RunScript(self, Beam): - self.pt = [] - self.txt = [] - - if not Beam: - return None - for b in Beam: - for side_index in range(len(b.ref_sides)): - surface = b.side_as_surface(side_index) - midpoint = surface.point_at(surface.xsize * 0.5, surface.ysize * 0.5) - side_name = b.ref_sides[side_index].name - - self.pt.append(point_to_rhino(midpoint)) - self.txt.append(side_name) - - def DrawViewportWires(self, arg): - if self.Locked: - return - col = System.Drawing.Color.FromArgb(255, 255, 255, 255) - # https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Display_DisplayPipeline_Draw2dText_5.htm - for p, t in zip(self.pt, self.txt): - arg.Display.Draw2dText(t, col, p, True, 16, "Verdana") diff --git a/src/compas_timber/ghpython/components/CT_ShowBeamFaces/icon.png b/src/compas_timber/ghpython/components/CT_ShowBeamFaces/icon.png deleted file mode 100644 index 774b93b14031d966fd563aa8961ca9a5eef1df1a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 938 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjoCO|{#S9GGLLkg|>2BR01_tIB zPZ!4!kItkY|Nq-xv`|w^vz3>>Z_mco_P=Gr-o1bSe}8}fKRZzK|Nly-K79IAB(1Ex z`1=uwGw09$-@kwVe|wHK@%#VTLlk6KXs)|<{rdm?EaY z2Add|nIW2!4lbV<8a1^s_U44f&dKc$-|rUZv41}={m18bmLJOu4GbWf4rMW(NN8=b zYI}dEizmot4NnnM3{QAmUD}UNzvY=9e?83OKYfeQpWpvlH@xKG;el%END0fl`k(9W z?|-{>?f(D2@tFSsNBhOq>-PLvZ}{{_ee12M|7TiM9!RPPmSR3!57o56VP)>^{}V!| zKh)$*+2M0vaEGdV{hxpNX0M;r-<;FgqMHBTpoI@VVY|0WJh#38T6I^hJQ8iM6ZRv_b zvfB@QTJWbyf99^8J99zF6q*d8ZglQCZoFal@}}aA%U5YI%Uc`YP`{nOKk>)U&+3Oa zOS%FhcFysr8y`P>_`}P=aUx<*#YY)7Ab?sHIcpP#XH(5#g;lvsV*fus=Rf@V@omX{ zbMLX~t6k7#VC@8^?@Dj))6N^2BR01_ov! zPZ!4!kItkY|Nq;EZt%H3@xM{6yHvoL-~Z<`0`>g=pOkojDMUns-@w4&hVxRX_clB3 zH~7jr9yo9SC=HZvie9j2!3rSvLt|s(LWYwC0xQA;1O5~|KlqnZW%fCkGA58R381nK za{asNL|Kp4v9Yza^YHL6mdoAQ?=a;hkO?s`sp-;@U4HX`ru}%3l#l?mCGrDx{=&+=w3j_oPm^AFlV+Oj+ZkA*t&_nE<$qc7=rce9#^SixHko%mcCl>erf4A@d zzb{E`Gi4%x{$K_>Z#gIHf&vpEA<|qZc2K%l}V2kn`>3eqd|} z9mx9kKON$hLs4RPD+}bOm~?v1V_S45$3Er94a)?kd0K~jiqG3OAJK%F+;o&N@>s-086G{|ZKX_S231_WwQxt7o42~|FVdQ&MBb@054izcmMzZ literal 0 HcmV?d00001 diff --git a/src/compas_timber/ghpython/components/CT_Show_Beam_Ref_Face/metadata.json b/src/compas_timber/ghpython/components/CT_Show_Beam_Ref_Face/metadata.json new file mode 100644 index 0000000000..248d967e3c --- /dev/null +++ b/src/compas_timber/ghpython/components/CT_Show_Beam_Ref_Face/metadata.json @@ -0,0 +1,32 @@ +{ + "name": "Show Reference Side", + "nickname": "ShowRefSide", + "category": "COMPAS Timber", + "subcategory": "Show", + "description": "Shows the element side based on BTLx ref_side_index.", + "exposure": 4, + "ghpython": { + "isAdvancedMode": true, + "iconDisplay": 0, + "inputParameters": [ + { + "name": "Element", + "description": "Element", + "typeHintID": "none", + "scriptParamAccess": 0 + }, + { + "name": "Reference Side", + "description": "integer 1-6 corresponding to BTLx reference side.", + "typeHintID": "int", + "scriptParamAccess": 0 + } + ], + "outputParameters": [ + { + "name": "Reference Side", + "description": "Surface and Line showing Reference Side and orientation(triangle at origin corner)." + } + ] + } +} From 5b7a98e405d91036cdf9053a9dfd6a7a36670237 Mon Sep 17 00:00:00 2001 From: oliver bucklin Date: Fri, 24 Jan 2025 16:29:49 +0100 Subject: [PATCH 2/7] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5456761dd8..41a424f55f 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 * Refactored `compas_timber.connections.LapJoint` to comply with the new system. * Changed `THalfLapJoint`, `LHalfLapJoint`, `XHalfLapJoint` from `compas_timber.connections` so that they use the `Lap` BTLx processing. * Renamed all `X/T/LHalfLapJoint` classes to `X/T/LLapJoint`. +* Changed `Show_beam_faces` gh component to `Show_beam_ref_side`, which now takes an `int` index and shows the corresponding face + including origin corner. ### Removed From 56aee13c60c1a922aa61f5cbd7c3e15903e2fcda Mon Sep 17 00:00:00 2001 From: oliver bucklin Date: Wed, 5 Feb 2025 13:21:24 +0100 Subject: [PATCH 3/7] text2D => text3D --- .../components/CT_Show_Beam_Ref_Face/code.py | 55 ++++++++++++++----- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/src/compas_timber/ghpython/components/CT_Show_Beam_Ref_Face/code.py b/src/compas_timber/ghpython/components/CT_Show_Beam_Ref_Face/code.py index e2e00ca8a1..cf48ba66f7 100644 --- a/src/compas_timber/ghpython/components/CT_Show_Beam_Ref_Face/code.py +++ b/src/compas_timber/ghpython/components/CT_Show_Beam_Ref_Face/code.py @@ -1,23 +1,52 @@ +# flake8: noqa +import System import rhinoscriptsyntax as rs +from ghpythonlib.componentbase import executingcomponent as component + from compas.geometry import Line from compas.scene import Scene from compas_rhino.conversions import frame_to_rhino -from ghpythonlib.componentbase import executingcomponent as component -class BTLxRefFace(component): - def RunScript(self, element, ref_side_index): - if not element: - return - if not ref_side_index: - ref_side_index = 0 - return self.get_srf(element, ref_side_index) +class ShowBeamFaces(component): + def RunScript(self, Beam, RefSideIndex): + if not Beam: + return None + self.pl = [] + self.txt = [] + self.ht = [] + srfs = [] + if not RefSideIndex: + RefSideIndex = [0] + if not len(RefSideIndex) == len(Beam): + RefSideIndex = [RefSideIndex[0] for _ in Beam] + + for b, i in zip(Beam, RefSideIndex): + srfs.append(self.get_srf(b, i)) + ht = 1000 + for side_index in range(len(b.ref_sides)): + surface = b.side_as_surface(side_index) + ht = min([self.ht, surface.xsize / 6.0, surface.ysize / 6.0]) + for side_index in range(len(b.ref_sides)): + surface = b.side_as_surface(side_index) + frame = b.ref_sides[side_index] + frame.point = surface.point_at(0, ht / 4.0) + + self.pl.append(frame_to_rhino(frame)) + self.txt.append("RS_{}".format(side_index)) + self.ht.append(ht) + + return srfs def get_srf(self, element, ref_side_index): face = element.side_as_surface(ref_side_index) rh_srf = rs.AddPlaneSurface(frame_to_rhino(face.frame), face.xsize, face.ysize) - ln = Line(face.point_at(0, face.ysize / 3.0), face.point_at(face.ysize * 3 / 4, 0)) - scene = Scene() - scene.add(ln) - ln = scene.draw() - return rh_srf, ln[0] + return rh_srf + + def DrawViewportWires(self, arg): + if self.Locked: + return + col = System.Drawing.Color.FromArgb(255, 255, 255, 255) + # https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Display_DisplayPipeline_Draw3dText_5.htm + for p, t, h in zip(self.pl, self.txt, self.ht): + arg.Display.Draw3dText(t, col, p, h, "Verdana", True, False) From 86b7e8711e32530bd8d7f5e354ac4ac53abe0a5a Mon Sep 17 00:00:00 2001 From: oliver bucklin Date: Wed, 5 Feb 2025 13:28:00 +0100 Subject: [PATCH 4/7] rename folder --- .../code.py | 0 .../icon.png | Bin .../metadata.json | 16 ++++++++-------- 3 files changed, 8 insertions(+), 8 deletions(-) rename src/compas_timber/ghpython/components/{CT_Show_Beam_Ref_Face => CT_Show_Ref_Sides}/code.py (100%) rename src/compas_timber/ghpython/components/{CT_Show_Beam_Ref_Face => CT_Show_Ref_Sides}/icon.png (100%) rename src/compas_timber/ghpython/components/{CT_Show_Beam_Ref_Face => CT_Show_Ref_Sides}/metadata.json (50%) diff --git a/src/compas_timber/ghpython/components/CT_Show_Beam_Ref_Face/code.py b/src/compas_timber/ghpython/components/CT_Show_Ref_Sides/code.py similarity index 100% rename from src/compas_timber/ghpython/components/CT_Show_Beam_Ref_Face/code.py rename to src/compas_timber/ghpython/components/CT_Show_Ref_Sides/code.py diff --git a/src/compas_timber/ghpython/components/CT_Show_Beam_Ref_Face/icon.png b/src/compas_timber/ghpython/components/CT_Show_Ref_Sides/icon.png similarity index 100% rename from src/compas_timber/ghpython/components/CT_Show_Beam_Ref_Face/icon.png rename to src/compas_timber/ghpython/components/CT_Show_Ref_Sides/icon.png diff --git a/src/compas_timber/ghpython/components/CT_Show_Beam_Ref_Face/metadata.json b/src/compas_timber/ghpython/components/CT_Show_Ref_Sides/metadata.json similarity index 50% rename from src/compas_timber/ghpython/components/CT_Show_Beam_Ref_Face/metadata.json rename to src/compas_timber/ghpython/components/CT_Show_Ref_Sides/metadata.json index 248d967e3c..2a01c75a27 100644 --- a/src/compas_timber/ghpython/components/CT_Show_Beam_Ref_Face/metadata.json +++ b/src/compas_timber/ghpython/components/CT_Show_Ref_Sides/metadata.json @@ -1,9 +1,9 @@ { - "name": "Show Reference Side", - "nickname": "ShowRefSide", + "name": "Show Beam Reference Side", + "nickname": "ShowBeamSides", "category": "COMPAS Timber", "subcategory": "Show", - "description": "Shows the element side based on BTLx ref_side_index.", + "description": "Shows the element side based on ref_side_index. Text labels are located at the reference side origins and oriented to the reference side frame.", "exposure": 4, "ghpython": { "isAdvancedMode": true, @@ -13,19 +13,19 @@ "name": "Element", "description": "Element", "typeHintID": "none", - "scriptParamAccess": 0 + "scriptParamAccess": 1 }, { - "name": "Reference Side", - "description": "integer 1-6 corresponding to BTLx reference side.", + "name": "Reference Side Index", + "description": "integer 0-5 corresponding to reference side.", "typeHintID": "int", - "scriptParamAccess": 0 + "scriptParamAccess": 1 } ], "outputParameters": [ { "name": "Reference Side", - "description": "Surface and Line showing Reference Side and orientation(triangle at origin corner)." + "description": "Reference Side as surface." } ] } From 4d55dbc220ce6c8c25738ba4e2bcf659c8c1e03b Mon Sep 17 00:00:00 2001 From: obucklin Date: Thu, 6 Feb 2025 13:47:47 +0100 Subject: [PATCH 5/7] changed icon --- .../components/CT_Show_Ref_Sides/icon.png | Bin 864 -> 938 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/compas_timber/ghpython/components/CT_Show_Ref_Sides/icon.png b/src/compas_timber/ghpython/components/CT_Show_Ref_Sides/icon.png index 1048a8466c28c175cdfec98af9d5d54aab33b0d7..774b93b14031d966fd563aa8961ca9a5eef1df1a 100644 GIT binary patch literal 938 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjoCO|{#S9GGLLkg|>2BR01_tIB zPZ!4!kItkY|Nq-xv`|w^vz3>>Z_mco_P=Gr-o1bSe}8}fKRZzK|Nly-K79IAB(1Ex z`1=uwGw09$-@kwVe|wHK@%#VTLlk6KXs)|<{rdm?EaY z2Add|nIW2!4lbV<8a1^s_U44f&dKc$-|rUZv41}={m18bmLJOu4GbWf4rMW(NN8=b zYI}dEizmot4NnnM3{QAmUD}UNzvY=9e?83OKYfeQpWpvlH@xKG;el%END0fl`k(9W z?|-{>?f(D2@tFSsNBhOq>-PLvZ}{{_ee12M|7TiM9!RPPmSR3!57o56VP)>^{}V!| zKh)$*+2M0vaEGdV{hxpNX0M;r-<;FgqMHBTpoI@VVY|0WJh#38T6I^hJQ8iM6ZRv_b zvfB@QTJWbyf99^8J99zF6q*d8ZglQCZoFal@}}aA%U5YI%Uc`YP`{nOKk>)U&+3Oa zOS%FhcFysr8y`P>_`}P=aUx<*#YY)7Ab?sHIcpP#XH(5#g;lvsV*fus=Rf@V@omX{ zbMLX~t6k7#VC@8^?@Dj))6N^2BR01_ov! zPZ!4!kItkY|Nq;EZt%H3@xM{6yHvoL-~Z<`0`>g=pOkojDMUns-@w4&hVxRX_clB3 zH~7jr9yo9SC=HZvie9j2!3rSvLt|s(LWYwC0xQA;1O5~|KlqnZW%fCkGA58R381nK za{asNL|Kp4v9Yza^YHL6mdoAQ?=a;hkO?s`sp-;@U4HX`ru}%3l#l?mCGrDx{=&+=w3j_oPm^AFlV+Oj+ZkA*t&_nE<$qc7=rce9#^SixHko%mcCl>erf4A@d zzb{E`Gi4%x{$K_>Z#gIHf&vpEA<|qZc2K%l}V2kn`>3eqd|} z9mx9kKON$hLs4RPD+}bOm~?v1V_S45$3Er94a)?kd0K~jiqG3OAJK%F+;o&N@>s-086G{|ZKX_S231_WwQxt7o42~|FVdQ&MBb@054izcmMzZ From 5877a1699ee23b96d2a0b36bd6dc2cadfc6c3d95 Mon Sep 17 00:00:00 2001 From: obucklin Date: Thu, 6 Feb 2025 13:49:23 +0100 Subject: [PATCH 6/7] mergemain --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9524bed64d..11dc85eec6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fixed `restore_beams_from_keys` in `LMiterJoint` to use the correct variable names. * Reworked `DoubleCut` to more reliably produce the feature and geometry with the `from_planes_and_element` class method. * Renamed `intersection_box_line()` to `intersection_beam_line_param()`, which now take a beam input and outputs the intersecting ref_face_index. -* Changed `Show_beam_faces` gh component to `Show_beam_ref_side`, which now takes an `int` index and shows the corresponding face +* Changed `Show_beam_faces` gh component to `Show_ref_sides`, which now takes an `int` index and shows the corresponding face including origin corner. ### Removed From 959b1a73b3dd1816bad5d6b0d425daae52869390 Mon Sep 17 00:00:00 2001 From: obucklin Date: Thu, 6 Feb 2025 14:35:39 +0100 Subject: [PATCH 7/7] format --- src/compas_timber/fabrication/french_ridge_lap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compas_timber/fabrication/french_ridge_lap.py b/src/compas_timber/fabrication/french_ridge_lap.py index 7674b6a2bb..35217673d1 100644 --- a/src/compas_timber/fabrication/french_ridge_lap.py +++ b/src/compas_timber/fabrication/french_ridge_lap.py @@ -56,7 +56,7 @@ def __data__(self): data["drillhole_diam"] = self.drillhole_diam return data - def __init__(self, orientation = OrientationType.START, start_x=0.0, angle=90.0, ref_position=EdgePositionType.REFEDGE, drillhole=False, drillhole_diam=0.0, **kwargs): + def __init__(self, orientation=OrientationType.START, start_x=0.0, angle=90.0, ref_position=EdgePositionType.REFEDGE, drillhole=False, drillhole_diam=0.0, **kwargs): super(FrenchRidgeLap, self).__init__(**kwargs) self._orientation = None self._start_x = None