{ "Uuid": "dcd8d61d38d64bf093a4f1737ed7df61", "IsCustomNode": false, "Description": "", "Name": "30_uppercase_parameter", "ElementResolver": { "ResolutionMap": {} }, "Inputs": [], "Outputs": [], "Nodes": [ { "ConcreteType": "CoreNodeModels.Input.StringInput, CoreNodeModels", "Id": "eb9f62b492c34e7cb4462887a40cc322", "NodeType": "StringInputNode", "Inputs": [], "Outputs": [ { "Id": "9727ae48436d4b7bafdb3fd2bc67acfa", "Name": "", "Description": "String", "UsingDefaultValue": false, "Level": 2, "UseLevels": false, "KeepListStructure": false } ], "Replication": "Disabled", "Description": "Creates a string", "InputValue": "Walls" }, { "ConcreteType": "CoreNodeModels.Input.StringInput, CoreNodeModels", "Id": "673898bd39854346a088f651948ee0a4", "NodeType": "StringInputNode", "Inputs": [], "Outputs": [ { "Id": "a3b8536dc6804151b41645c3bcd70bcb", "Name": "", "Description": "String", "UsingDefaultValue": false, "Level": 2, "UseLevels": false, "KeepListStructure": false } ], "Replication": "Disabled", "Description": "Creates a string", "InputValue": "Comments" }, { "ConcreteType": "CoreNodeModels.Input.StringInput, CoreNodeModels", "Id": "c2ada30464a1412e89819a896f7ca0f5", "NodeType": "StringInputNode", "Inputs": [], "Outputs": [ { "Id": "c217139e99e24c4c88cb56d9cd7ffedf", "Name": "", "Description": "String", "UsingDefaultValue": false, "Level": 2, "UseLevels": false, "KeepListStructure": false } ], "Replication": "Disabled", "Description": "Creates a string", "InputValue": "False" }, { "ConcreteType": "PythonNodeModels.PythonNode, PythonNodeModels", "Code": "# -*- coding: utf-8 -*-\r\n# Micro — Pasar a MAYÚSCULAS un parámetro de texto (categoría o selección).\r\n#\r\n# IN[0] : categoría\r\n# IN[1] : nombre parámetro\r\n# IN[2] : True = solo selección\r\n#\r\n# Salida: conteo modificado.\r\n\r\nimport sys\r\n\r\nimport clr\r\nclr.AddReference('RevitAPI')\r\nclr.AddReference('RevitServices')\r\nfrom Autodesk.Revit.DB import FilteredElementCollector, BuiltInCategory, StorageType\r\nfrom RevitServices.Persistence import DocumentManager\r\nfrom RevitServices.Transactions import TransactionManager\r\n\r\n_PY3 = sys.version_info[0] >= 3\r\ndoc = DocumentManager.Instance.CurrentDBDocument\r\n\r\n\r\ndef _ustr(value):\r\n if value is None:\r\n return ''\r\n if _PY3:\r\n return str(value).strip()\r\n try:\r\n if isinstance(value, unicode):\r\n return value.strip()\r\n except NameError:\r\n pass\r\n return str(value).strip()\r\n\r\n\r\ndef _to_py_list(obj, max_index=256):\r\n if obj is None:\r\n return []\r\n if isinstance(obj, (list, tuple)):\r\n return list(obj)\r\n try:\r\n return list(obj)\r\n except TypeError:\r\n pass\r\n out = []\r\n for i in range(max_index):\r\n try:\r\n out.append(obj[i])\r\n except Exception:\r\n break\r\n return out\r\n\r\n\r\ndef _dynamo_in_ports():\r\n raw = globals().get('IN', [])\r\n ports = _to_py_list(raw, max_index=32)\r\n if len(ports) == 0 and raw is not None:\r\n tmp = []\r\n for i in range(32):\r\n try:\r\n tmp.append(raw[i])\r\n except Exception:\r\n break\r\n ports = tmp\r\n return ports\r\n\r\n\r\ndef _as_bool(val):\r\n if val is None:\r\n return False\r\n if isinstance(val, bool):\r\n return val\r\n if isinstance(val, int):\r\n return bool(val)\r\n s = _ustr(val).lower()\r\n if s in ('false', 'falso', '0', 'no', 'n', '', 'off'):\r\n return False\r\n if s in ('true', 'verdadero', '1', 'yes', 'si', 'sí', 'on'):\r\n return True\r\n try:\r\n return bool(int(float(s)))\r\n except Exception:\r\n return bool(val)\r\n\r\n\r\ndef _bic(cat_str):\r\n try:\r\n s = _ustr(cat_str).strip()\r\n name = s if s.startswith('OST_') else 'OST_' + s.replace(' ', '')\r\n return getattr(BuiltInCategory, name)\r\n except Exception:\r\n return None\r\n\r\n\r\ndef _elements(cat, use_sel):\r\n if _as_bool(use_sel):\r\n uidoc = DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument\r\n ids = uidoc.Selection.GetElementIds()\r\n return [doc.GetElement(i) for i in ids]\r\n bic = _bic(cat)\r\n if bic is None:\r\n return []\r\n return list(FilteredElementCollector(doc).OfCategory(bic).WhereElementIsNotElementType().ToElements())\r\n\r\n\r\n_ports = _dynamo_in_ports()\r\ncat = _ustr(_ports[0]) if len(_ports) > 0 else ''\r\npname = _ustr(_ports[1]) if len(_ports) > 1 else ''\r\nuse_sel = _as_bool(_ports[2]) if len(_ports) > 2 else False\r\n\r\nif not pname or (not use_sel and not cat):\r\n OUT = ['Error: parámetro y categoría o selección True.']\r\nelse:\r\n n = 0\r\n TransactionManager.Instance.EnsureInTransaction(doc)\r\n try:\r\n for el in _elements(cat, use_sel):\r\n if el is None:\r\n continue\r\n p = el.LookupParameter(pname)\r\n if p is None or p.IsReadOnly or p.StorageType != StorageType.String:\r\n continue\r\n cur = p.AsString()\r\n if cur is None:\r\n continue\r\n newv = cur.strip().upper()\r\n if newv == cur:\r\n continue\r\n try:\r\n p.Set(newv)\r\n n += 1\r\n except Exception:\r\n pass\r\n finally:\r\n TransactionManager.Instance.TransactionTaskDone()\r\n OUT = [n, 'elementos']\r\n\r\n# --- RÜM: mensaje de cierre (URL en rum_platform_url.py) ---\r\ntry:\r\n import sys as _rum_sys\r\n _rum_root = r'c:\\RUM_Platform\\RUM_Tools\\Dynamo_Routines'\r\n if _rum_root not in _rum_sys.path:\r\n _rum_sys.path.insert(0, _rum_root)\r\n import rum_finalize as _rum_fin\r\n OUT = _rum_fin.apply(OUT)\r\nexcept Exception:\r\n pass\r\n", "Engine": "CPython3", "VariableInputPorts": true, "Id": "10ba7ec9c5124fd7a12b2454268f70bf", "NodeType": "PythonScriptNode", "Inputs": [ { "Id": "379c9a5ae0ac4eda9fd04e6315991027", "Name": "IN[0]", "Description": "IN[0] Categoría", "UsingDefaultValue": false, "Level": 2, "UseLevels": false, "KeepListStructure": false }, { "Id": "79488c911e43416ca215eb7b53eb76d1", "Name": "IN[1]", "Description": "IN[1] Parámetro", "UsingDefaultValue": false, "Level": 2, "UseLevels": false, "KeepListStructure": false }, { "Id": "531be57a199c4c628ff7409802c8a151", "Name": "IN[2]", "Description": "IN[2] Solo selección True/False", "UsingDefaultValue": false, "Level": 2, "UseLevels": false, "KeepListStructure": false } ], "Outputs": [ { "Id": "090fb79716ac46db82c7e99ae0d85a0f", "Name": "OUT", "Description": "Result of the python script", "UsingDefaultValue": false, "Level": 2, "UseLevels": false, "KeepListStructure": false } ], "Replication": "Disabled", "Description": "Runs an embedded Python script." } ], "Connectors": [ { "Start": "9727ae48436d4b7bafdb3fd2bc67acfa", "End": "379c9a5ae0ac4eda9fd04e6315991027", "Id": "9b233f90e9544ff58510a30aadd7be07", "IsHidden": "False" }, { "Start": "a3b8536dc6804151b41645c3bcd70bcb", "End": "79488c911e43416ca215eb7b53eb76d1", "Id": "c2c09c3dfe3742518a33d1330ffdef96", "IsHidden": "False" }, { "Start": "c217139e99e24c4c88cb56d9cd7ffedf", "End": "531be57a199c4c628ff7409802c8a151", "Id": "c8f2d55555e441a483abc6d7fef722ea", "IsHidden": "False" } ], "Dependencies": [], "NodeLibraryDependencies": [], "EnableLegacyPolyCurveBehavior": true, "Thumbnail": "", "GraphDocumentationURL": null, "ExtensionWorkspaceData": [ { "ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670", "Name": "Properties", "Version": "3.3", "Data": {} }, { "ExtensionGuid": "DFBD9CC0-DB40-457A-939E-8C8555555A9D", "Name": "Generative Design", "Version": "8.2", "Data": {} } ], "Author": "RÜM", "Linting": { "activeLinter": "None", "activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a", "warningCount": 0, "errorCount": 0 }, "Bindings": [], "View": { "Dynamo": { "ScaleFactor": 1, "HasRunWithoutCrash": false, "IsVisibleInDynamoLibrary": true, "Version": "3.3.0.6316", "RunType": "Manual", "RunPeriod": "1000" }, "Camera": { "Name": "_Background Preview", "EyeX": 0, "EyeY": 0, "EyeZ": 10, "LookX": 0, "LookY": 0, "LookZ": 0, "UpX": 0, "UpY": 1, "UpZ": 0 }, "ConnectorPins": [], "NodeViews": [ { "Id": "eb9f62b492c34e7cb4462887a40cc322", "Name": "IN[0]", "IsSetAsInput": false, "IsSetAsOutput": false, "Excluded": false, "ShowGeometry": true, "X": 40, "Y": 220 }, { "Id": "673898bd39854346a088f651948ee0a4", "Name": "IN[1]", "IsSetAsInput": false, "IsSetAsOutput": false, "Excluded": false, "ShowGeometry": true, "X": 240, "Y": 220 }, { "Id": "c2ada30464a1412e89819a896f7ca0f5", "Name": "IN[2]", "IsSetAsInput": false, "IsSetAsOutput": false, "Excluded": false, "ShowGeometry": true, "X": 440, "Y": 220 }, { "Id": "10ba7ec9c5124fd7a12b2454268f70bf", "Name": "RUM_30_UppercaseParameter", "IsSetAsInput": false, "IsSetAsOutput": false, "Excluded": false, "ShowGeometry": true, "X": 720, "Y": 360 } ], "Annotations": [], "X": 0, "Y": 0, "Zoom": 0.75 } }