diff --git a/README.md b/README.md index 397366c..92499b4 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,8 @@ :dragon: :green_book: Dragonfly plugin for Grasshopper (aka. dragonfly[+]). This repository contains all Grasshopper components for the dragonfly plugin. -The package includes both the userobjects (`.ghuser`) and the Python source (`.py`). +The package includes both the user objects (`.ghuser`), the Python source (`.py`), +and a JSON version of the grasshopper component data. Note that this library only possesses the Grasshopper components and, in order to run the plugin, the core libraries must be installed in a way that they can be discovered by Rhino (see dependencies). diff --git a/dragonfly_grasshopper/json/DF_Separate_Top_Bottom.json b/dragonfly_grasshopper/json/DF_Separate_Top_Bottom.json index b496f6e..afbec11 100644 --- a/dragonfly_grasshopper/json/DF_Separate_Top_Bottom.json +++ b/dragonfly_grasshopper/json/DF_Separate_Top_Bottom.json @@ -1,5 +1,5 @@ { - "version": "1.8.0", + "version": "1.8.1", "nickname": "TopBottom", "outputs": [ [ @@ -36,7 +36,7 @@ } ], "subcategory": "0 :: Create", - "code": "\ntry: # import the core honeybee dependencies\n from honeybee.units import parse_distance_string\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry: # import the core dragonfly dependencies\n from dragonfly.model import Model\nexcept ImportError as e:\n raise ImportError('\\nFailed to import dragonfly:\\n\\t{}'.format(e))\n\ntry: # import the ladybug_{{cad}} dependencies\n from ladybug_{{cad}}.config import units_system, tolerance\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# tolerance for computing the pole of inaccessibility\np_tol = parse_distance_string('0.01m', units_system())\n\n\ndef split_mid_stories(building):\n \"\"\"Split the middle stories of a building to ensure matching areas.\"\"\"\n for x, story in enumerate(building.unique_stories[:-1]):\n story_above = building.unique_stories[x + 1]\n story.split_with_story_above(story_above, tolerance)\n story.set_top_exposed_by_story_above(story_above, p_tol)\n story.solve_room_2d_adjacency(tolerance, intersect=False)\n\n\nif all_required_inputs(ghenv.Component):\n # get the building objects from the input ones\n buildings = [bldg.duplicate() for bldg in _buildings]\n for bldg in buildings:\n if sep_mid_:\n if isinstance(bldg, Model):\n for b in bldg.buildings:\n b.separate_mid_floors(p_tol)\n if split_mid_:\n split_mid_stories(b)\n else:\n bldg.separate_mid_floors(p_tol)\n if split_mid_:\n split_mid_stories(bldg)\n else:\n bldg.separate_top_bottom_floors()\n", + "code": "\ntry: # import the core honeybee dependencies\n from honeybee.units import parse_distance_string\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry: # import the core dragonfly dependencies\n from dragonfly.model import Model\nexcept ImportError as e:\n raise ImportError('\\nFailed to import dragonfly:\\n\\t{}'.format(e))\n\ntry: # import the ladybug_{{cad}} dependencies\n from ladybug_{{cad}}.config import units_system, tolerance\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# tolerance for computing the pole of inaccessibility\np_tol = parse_distance_string('0.01m', units_system())\n\n\ndef split_mid_stories(building):\n \"\"\"Split the middle stories of a building to ensure matching areas.\"\"\"\n for x, story in enumerate(building.unique_stories[:-1]):\n story_above = building.unique_stories[x + 1]\n story.split_with_story_above(story_above, tolerance)\n story.set_top_exposed_by_story_above(story_above, p_tol)\n story.solve_room_2d_adjacency(tolerance, intersect=False)\n\n\nif all_required_inputs(ghenv.Component):\n # get the building objects from the input ones\n buildings = [bldg.duplicate() for bldg in _buildings]\n for bldg in buildings:\n if sep_mid_ and len(bldg) != 1:\n if isinstance(bldg, Model):\n for b in bldg.buildings:\n b.separate_mid_floors(p_tol)\n if split_mid_:\n split_mid_stories(b)\n else:\n bldg.separate_mid_floors(p_tol)\n if split_mid_:\n split_mid_stories(bldg)\n else:\n bldg.separate_top_bottom_floors()\n", "category": "Dragonfly", "name": "DF Separate Top Bottom", "description": "Separate the top and bottom floors of a Building into unique Stories with a multiplier\nof 1 and automatically assign the first story Room2Ds to have a ground contact\nfloor and the top story Room2Ds to have an outdoor-exposed roof.\n_\nThis is particularly helpful when trying to account for the heat exchange of the\ntop or bottom floors with the gound or outdoors.\n_\nThe \"mid\" options can also be used to separate the middle floors and account for\nheat flow through exposed roofs of middle floors.\n-" diff --git a/dragonfly_grasshopper/src/DF Separate Top Bottom.py b/dragonfly_grasshopper/src/DF Separate Top Bottom.py index 7bbeab3..8da17e5 100644 --- a/dragonfly_grasshopper/src/DF Separate Top Bottom.py +++ b/dragonfly_grasshopper/src/DF Separate Top Bottom.py @@ -42,7 +42,7 @@ ghenv.Component.Name = 'DF Separate Top Bottom' ghenv.Component.NickName = 'TopBottom' -ghenv.Component.Message = '1.8.0' +ghenv.Component.Message = '1.8.1' ghenv.Component.Category = 'Dragonfly' ghenv.Component.SubCategory = '0 :: Create' ghenv.Component.AdditionalHelpFromDocStrings = '2' @@ -80,7 +80,7 @@ def split_mid_stories(building): # get the building objects from the input ones buildings = [bldg.duplicate() for bldg in _buildings] for bldg in buildings: - if sep_mid_: + if sep_mid_ and len(bldg) != 1: if isinstance(bldg, Model): for b in bldg.buildings: b.separate_mid_floors(p_tol) diff --git a/dragonfly_grasshopper/user_objects/DF Separate Top Bottom.ghuser b/dragonfly_grasshopper/user_objects/DF Separate Top Bottom.ghuser index 7d98c2e..caa2b93 100644 Binary files a/dragonfly_grasshopper/user_objects/DF Separate Top Bottom.ghuser and b/dragonfly_grasshopper/user_objects/DF Separate Top Bottom.ghuser differ