diff --git a/nodes/2.x/Element.SuperComponent.dyf b/nodes/2.x/Element.SuperComponent.dyf index ec36de32..6a72a05f 100644 --- a/nodes/2.x/Element.SuperComponent.dyf +++ b/nodes/2.x/Element.SuperComponent.dyf @@ -60,7 +60,7 @@ { "ConcreteType": "PythonNodeModels.PythonNode, PythonNodeModels", "NodeType": "PythonScriptNode", - "Code": "import clr\r\nclr.AddReference('RevitAPI')\r\nfrom Autodesk.Revit.DB import *\r\n\r\ndef GetSuperComponent(item):\r\n\t# nested families\r\n\tif hasattr(item, \"SuperComponent\"): return item.SuperComponent\r\n\t# beam systems\r\n\tif hasattr(item, \"BeamBelongsTo\"): return BeamSystem.BeamBelongsTo(item)\r\n\t# handrails\r\n\tif hasattr(item, \"HostRailingId\"): return item.Document.GetElement(item.HostRailingId)\r\n\t# stair components\r\n\telif hasattr(item, \"GetStairs\"): return item.GetStairs()\r\n\t# grid segments\r\n\telif item.GetType().ToString() == 'Autodesk.Revit.DB.Grid': \r\n\t\tsc = MultiSegmentGrid.GetMultiSegementGridId(item)\r\n\t\tif sc: return item.Document.GetElement(sc)\r\n\t\telse: return None\r\n\telse: return None\r\n\r\nitems = UnwrapElement(IN[0])\r\n\r\nif isinstance(IN[0], list): OUT = [GetSuperComponent(x) for x in items]\r\nelse: OUT = GetSuperComponent(items)", + "Code": "import clr\r\nclr.AddReference('RevitAPI')\r\nfrom Autodesk.Revit.DB import *\r\n\r\ndef GetSuperComponent(item):\r\n\t# nested families\r\n\tif hasattr(item, \"SuperComponent\"): return item.SuperComponent\r\n\t# beam systems\r\n\tif hasattr(item, \"BeamBelongsTo\"): return BeamSystem.BeamBelongsTo(item)\r\n\t# handrails\r\n\tif hasattr(item, \"HostRailingId\"): return item.Document.GetElement(item.HostRailingId)\r\n\t# stair components\r\n\telif hasattr(item, \"GetStairs\"): return item.GetStairs()\r\n\t# site subregions\r\n\telif hasattr(item, \"IsSiteSubRegion\"):\r\n\t\tif item.IsSiteSubRegion:\r\n\t\t\treturn item.Document.GetElement(item.AsSiteSubRegion().HostId)\r\n\t# grid segments\r\n\telif item.GetType().ToString() == 'Autodesk.Revit.DB.Grid': \r\n\t\tsc = MultiSegmentGrid.GetMultiSegementGridId(item)\r\n\t\tif sc: return item.Document.GetElement(sc)\r\n\t\telse: return None\r\n\telse: return None\r\n\r\nitems = UnwrapElement(IN[0])\r\n\r\nif isinstance(IN[0], list): OUT = [GetSuperComponent(x) for x in items]\r\nelse: OUT = GetSuperComponent(items)", "Engine": "IronPython2", "VariableInputPorts": true, "Id": "e3c35b2105004cd2bc7b62c5c797f69e", diff --git a/nodes/2.x/python/Element.SuperComponent.py b/nodes/2.x/python/Element.SuperComponent.py index 946c8e5d..b8b13b45 100644 --- a/nodes/2.x/python/Element.SuperComponent.py +++ b/nodes/2.x/python/Element.SuperComponent.py @@ -3,15 +3,22 @@ from Autodesk.Revit.DB import * def GetSuperComponent(item): - if hasattr(item, "SuperComponent"): - sc = item.SuperComponent - if sc: return sc - else: return BeamSystem.BeamBelongsTo(item) + # nested families + if hasattr(item, "SuperComponent"): return item.SuperComponent + # beam systems + if hasattr(item, "BeamBelongsTo"): return BeamSystem.BeamBelongsTo(item) + # handrails if hasattr(item, "HostRailingId"): return item.Document.GetElement(item.HostRailingId) + # stair components elif hasattr(item, "GetStairs"): return item.GetStairs() + # site subregions elif hasattr(item, "IsSiteSubRegion"): if item.IsSiteSubRegion: return item.Document.GetElement(item.AsSiteSubRegion().HostId) + # grid segments + elif item.GetType().ToString() == 'Autodesk.Revit.DB.Grid': + sc = MultiSegmentGrid.GetMultiSegementGridId(item) + if sc: return item.Document.GetElement(sc) else: return None else: return None