-
Notifications
You must be signed in to change notification settings - Fork 26
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 hole #172
Merged
Merged
Drill hole #172
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/compas_timber/ghpython/components/CT_DrillHole/code.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from ghpythonlib.componentbase import executingcomponent as component | ||
from Grasshopper.Kernel.GH_RuntimeMessageLevel import Warning | ||
|
||
from compas_rhino.conversions import line_to_compas | ||
|
||
from compas_timber.ghpython import FeatureDefinition | ||
from compas_timber.parts import DrillFeature | ||
|
||
|
||
class DrillHoleFeature(component): | ||
def RunScript(self, Beam, Line, Diameter, Length): | ||
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): | ||
return | ||
|
||
if not isinstance(Beam, list): | ||
Beam = [Beam] | ||
|
||
Feature = [] | ||
for beam in Beam: | ||
feature = DrillFeature(line_to_compas(Line), Diameter, Length) | ||
Feature.append(FeatureDefinition(feature, beam)) | ||
|
||
return Feature |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions
44
src/compas_timber/ghpython/components/CT_DrillHole/metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"name": "Drill Hole Feature", | ||
"nickname": "Drill Hole", | ||
"category": "COMPAS Timber", | ||
"subcategory": "Features", | ||
"description": "Creates a Feature representing a drill hole in Beam. Specify multiple Beams to drill through all Beams with the same hole.", | ||
"exposure": 4, | ||
"ghpython": { | ||
"isAdvancedMode": true, | ||
"iconDisplay": 0, | ||
"inputParameters": [ | ||
{ | ||
"name": "Beam", | ||
"description": "Beam(s) to subtract Geometry from.", | ||
"typeHintID": "none", | ||
"scriptParamAccess": 1 | ||
}, | ||
{ | ||
"name": "Line", | ||
"description": "Line representing the axis of the drill hole.", | ||
"typeHintID": "line", | ||
"scriptParamAccess": 0 | ||
}, | ||
{ | ||
"name": "Diameter", | ||
"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": [ | ||
{ | ||
"name": "Feature", | ||
"description": "Defined Feature(s)." | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it required that the param names are uppercased? I think it does a positional match, so, these could be lowercased
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you're right. That's awesome, had no idea. will make a separate PR to change all the components, will be much cozier :)