Skip to content

Commit

Permalink
fix(create): Expose an option to set the name when resetting ID
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey committed Aug 12, 2024
1 parent 816691c commit 4bf7a95
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
Binary file modified honeybee_grasshopper_core/icon/HB Set Identifier.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions honeybee_grasshopper_core/json/HB_Set_Identifier.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.8.0",
"version": "1.8.1",
"nickname": "ID",
"outputs": [
[
Expand All @@ -26,10 +26,17 @@
"description": "Text for the identifier of the object. Note that, if this identifier\ndoes not conform to acceptable values of the object type (eg. no\nspaces for a radiance modifier id), then an exception will be thrown.",
"type": "string",
"default": null
},
{
"access": "item",
"name": "name_",
"description": "An optional text string to set the name of the object to something\nother than the identifier.",
"type": "string",
"default": null
}
],
"subcategory": "0 :: Create",
"code": "\ntry: # import the ladybug_{{cad}} dependencies\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n hb_obj = _hb_obj.duplicate()\n hb_obj.identifier = _id\n hb_obj.display_name = None\n",
"code": "\ntry: # import the ladybug_{{cad}} dependencies\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n hb_obj = _hb_obj.duplicate()\n hb_obj.identifier = _id\n hb_obj.display_name = None if name_ is None else name_\n",
"category": "Honeybee",
"name": "HB Set Identifier",
"description": "THIS COMPONENT IS INTENDED FOR ADVANCED USERS WHO UNDERSTAND THAT IDENTIFERS\nSHOULD BE UNIQUE AND THAT, TO SET THEM OTHERWISE CAN HAVE UNINTENDED CONSEQUENCES.\n_\nChange the identifier of any Honeybee object.\n_\nNote that this component only changes the identifer of the input _hb_obj and\nnone of the identifiers of the child objects.\n-"
Expand Down
6 changes: 4 additions & 2 deletions honeybee_grasshopper_core/src/HB Set Identifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
_id: Text for the identifier of the object. Note that, if this identifier
does not conform to acceptable values of the object type (eg. no
spaces for a radiance modifier id), then an exception will be thrown.
name_: An optional text string to set the name of the object to something
other than the identifier.
Returns:
report: ...
Expand All @@ -32,7 +34,7 @@

ghenv.Component.Name = 'HB Set Identifier'
ghenv.Component.NickName = 'ID'
ghenv.Component.Message = '1.8.0'
ghenv.Component.Message = '1.8.1'
ghenv.Component.Category = 'Honeybee'
ghenv.Component.SubCategory = '0 :: Create'
ghenv.Component.AdditionalHelpFromDocStrings = '0'
Expand All @@ -46,4 +48,4 @@
if all_required_inputs(ghenv.Component):
hb_obj = _hb_obj.duplicate()
hb_obj.identifier = _id
hb_obj.display_name = None
hb_obj.display_name = None if name_ is None else name_
Binary file modified honeybee_grasshopper_core/user_objects/HB Set Identifier.ghuser
Binary file not shown.

0 comments on commit 4bf7a95

Please sign in to comment.