From 21d0b7b10a83f6eef57200c8b3a8de1ee23681bc Mon Sep 17 00:00:00 2001 From: "GMP-AD\\adieckmann" Date: Tue, 7 Nov 2023 06:03:30 +0100 Subject: [PATCH] #387 --- nodes/2.x/Element.Category+.dyf | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/nodes/2.x/Element.Category+.dyf b/nodes/2.x/Element.Category+.dyf index f6a26965..4adbb396 100644 --- a/nodes/2.x/Element.Category+.dyf +++ b/nodes/2.x/Element.Category+.dyf @@ -65,7 +65,8 @@ { "ConcreteType": "PythonNodeModels.PythonNode, PythonNodeModels", "NodeType": "PythonScriptNode", - "Code": "import System\r\nimport clr\r\nclr.AddReference('RevitAPI')\r\nfrom Autodesk.Revit.DB import *\r\n\r\nclr.AddReference(\"RevitNodes\")\r\nimport Revit\r\nclr.ImportExtensions(Revit.Elements)\r\n\r\ndef GetCategory(item):\r\n\tif not item: return None, None\r\n\tobjtype = item.GetType().ToString()\r\n\tif objtype == \"Autodesk.Revit.DB.ParameterFilterElement\": return [GetCategoryObjects(x) for x in item.GetCategories()]\r\n\telif objtype == \"Autodesk.Revit.DB.ViewSchedule\": return GetCategoryObjects(item.Definition.CategoryId)\r\n\telif objtype == \"Autodesk.Revit.DB.Family\": return GetCategoryObjects(item.FamilyCategoryId)\r\n\telif objtype == \"Autodesk.Revit.DB.GraphicsStyle\": return GetCategoryObjects(item.GraphicsStyleCategory.Id)\r\n\telif objtype == \"Revit.Application.Document\":\r\n\t\tif item.IsFamilyDocument: \r\n\t\t\tclr.AddReference(\"RevitServices\")\r\n\t\t\timport RevitServices\r\n\t\t\tfrom RevitServices.Persistence import DocumentManager\r\n\t\t\treturn GetCategoryObjects(DocumentManager.Instance.CurrentDBDocument.OwnerFamily.FamilyCategoryId)\r\n\t\telse: return None, None\r\n\telif objtype == \"Autodesk.Revit.DB.Category\": \r\n\t\tif item.Parent: return GetCategoryObjects(item.Parent.Id)\r\n\t\telse: return None, None\r\n\telif hasattr(item, \"Category\"): \r\n\t\tif item.Category: return GetCategoryObjects(item.Category.Id)\r\n\t\telse: return None, None\r\n\telse: return None, None\r\n\r\ndef GetCategoryObjects(catID):\r\n\tif not catID: return None, None\r\n\treturnBic = System.Enum.ToObject(BuiltInCategory, catID.IntegerValue)\r\n\ttry: returnCat = Revit.Elements.Category.ById(catID.IntegerValue)\r\n\texcept: returnCat = None\r\n\treturn returnCat, returnBic\r\n\r\n\r\nitems = UnwrapElement(IN[0])\r\n\r\nif isinstance(IN[0], list): OUT = map(list, zip(*[GetCategory(x) for x in items]))\r\nelse: OUT = GetCategory(items)", + "Code": "import System\r\nimport clr\r\nclr.AddReference('RevitAPI')\r\nfrom Autodesk.Revit.DB import *\r\n\r\nclr.AddReference(\"RevitNodes\")\r\nimport Revit\r\nclr.ImportExtensions(Revit.Elements)\r\n\r\ndef GetCategory(item):\r\n\tif not item: return None, None\r\n\tobjtype = item.GetType().ToString()\r\n\treturnID = None\r\n\treturnIDs = None\r\n\treturnCat = None\r\n\treturnBic = None\r\n\tif objtype == \"Autodesk.Revit.DB.ParameterFilterElement\": returnIDs = item.GetCategories()\r\n\telif objtype == \"Autodesk.Revit.DB.ViewSchedule\": returnID = item.Definition.CategoryId\r\n\telif objtype == \"Autodesk.Revit.DB.Family\": returnID = item.FamilyCategoryId\r\n\telif objtype == \"Autodesk.Revit.DB.GraphicsStyle\": returnID = item.GraphicsStyleCategory.Id\r\n\telif objtype == \"Revit.Application.Document\":\r\n\t\tif item.IsFamilyDocument: \r\n\t\t\tclr.AddReference(\"RevitServices\")\r\n\t\t\timport RevitServices\r\n\t\t\tfrom RevitServices.Persistence import DocumentManager\r\n\t\t\treturnID = DocumentManager.Instance.CurrentDBDocument.OwnerFamily.FamilyCategoryId\r\n\telif objtype == \"Autodesk.Revit.DB.Category\": \r\n\t\tif item.Parent: returnID = item.Parent.Id\r\n\telif hasattr(item, \"Category\"): \r\n\t\tif item.Category: returnID = item.Category.Id\r\n\tif returnID:\r\n\t\treturnBic = System.Enum.ToObject(BuiltInCategory, returnID.IntegerValue)\r\n\t\ttry: returnCat = Revit.Elements.Category.ById(returnID.IntegerValue)\r\n\t\texcept: pass\r\n\telif returnIDs:\r\n\t\treturnCat = []\r\n\t\treturnBic = []\r\n\t\tfor returnID in returnIDs:\r\n\t\t\treturnBic.append(System.Enum.ToObject(BuiltInCategory, returnID.IntegerValue))\r\n\t\t\ttry: returnCat.append(Revit.Elements.Category.ById(returnID.IntegerValue))\r\n\t\t\texcept: returnCat.append(None)\r\n\t\treturnCat.sort()\r\n\treturn returnCat, returnBic\r\n\r\nitems = UnwrapElement(IN[0])\r\n\r\nif isinstance(IN[0], list): OUT = map(list, zip(*[GetCategory(x) for x in items]))\r\nelse: OUT = GetCategory(items)", + "Engine": "IronPython2", "VariableInputPorts": true, "Id": "b4b979ee8b544c808efd2356bf9eec69", "Inputs": [ @@ -91,7 +92,7 @@ } ], "Replication": "Disabled", - "Description": "Führt ein eingebettetes IronPython-Skript aus." + "Description": "Führt ein eingebettetes Python-Skript aus." }, { "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", @@ -142,7 +143,7 @@ "Outputs": [ { "Id": "5aab4c13819741aa9345d2236384900e", - "Name": "last", + "Name": "item", "Description": "Das letzte Element in der Liste", "UsingDefaultValue": false, "Level": 2, @@ -204,13 +205,14 @@ ], "Dependencies": [], "NodeLibraryDependencies": [], + "Author": "None provided", "Bindings": [], "View": { "Dynamo": { "ScaleFactor": 1.0, "HasRunWithoutCrash": false, "IsVisibleInDynamoLibrary": true, - "Version": "2.6.2.15705", + "Version": "2.12.1.8246", "RunType": "Manual", "RunPeriod": "1000" }, @@ -289,8 +291,8 @@ } ], "Annotations": [], - "X": 95.17876305277, - "Y": 291.70571789162096, + "X": -132.82123694723, + "Y": 274.905717891621, "Zoom": 0.931811528498331 } } \ No newline at end of file