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

Surface_model_show_beam_type #272

Merged
merged 5 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

* Added `SurfaceModelJointOverride` GH Component
* Added `ShowSurfaceModelBeamType` GH Component

### Changed

Expand Down
2 changes: 2 additions & 0 deletions src/compas_timber/design/wall_from_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,8 @@ def __init__(self, outline, sill_height=None, header_height=None, parent=None):
self._length = None
self._height = None
self._frame = None

self.dist_tolerance = parent.dist_tolerance
self.process_outlines()

@property
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from compas.scene import Scene
from ghpythonlib.componentbase import executingcomponent as component
from Grasshopper.Kernel.GH_RuntimeMessageLevel import Warning
from System.Windows.Forms import ToolStripSeparator

from compas_timber.design import SurfaceModel
from compas_timber.ghpython.ghcomponent_helpers import rename_gh_output


class SurfaceModelJointRule(component):
def __init__(self):
super(SurfaceModelJointRule, self).__init__()
self.beam_type = None
if ghenv.Component.Params.Output[0].NickName == "type":
self.joint_type = None
else:
self.beam_type = ghenv.Component.Params.Output[0].NickName

def RunScript(self, model):
if not self.beam_type:
ghenv.Component.Message = "Select beam type from context menu (right click)"
self.AddRuntimeMessage(Warning, "Select beam type from context menu (right click)")
return None
else:
ghenv.Component.Message = self.beam_type
scene = Scene()
for beam in model.beams:
if beam.attributes["category"] == self.beam_type:
scene.add(beam.geometry)
return scene.draw()

def AppendAdditionalMenuItems(self, menu):
if not self.RuntimeMessages(Warning):
menu.Items.Add(ToolStripSeparator())
for name in SurfaceModel.beam_category_names():
item = menu.Items.Add(name, None, self.on_item_click)
if self.beam_type and name == self.beam_type:
item.Checked = True

def on_item_click(self, sender, event_info):
self.beam_type = str(sender)
rename_gh_output(self.beam_type, 0, ghenv)
ghenv.Component.ExpireSolution(True)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "ShowSurfaceModelBeamTypes",
"nickname": "ShowBeamType",
"category": "COMPAS Timber",
"subcategory": "Show",
"description": "allows user to visualize beam types in surface model.",
"exposure": 2,
"ghpython": {
"isAdvancedMode": true,
"iconDisplay": 0,
"inputParameters": [
{
"name": "Model",
"description": "Model object.",
"typeHintID": "none",
"scriptParamAccess": 0
}
],
"outputParameters": [
{
"name": "type",
"description": "beam type to visualize."
}
]
}
}
Loading