{ "Uuid": "2b92bb8b-ef18-4968-8b52-52bd5bf7d8b3", "IsCustomNode": false, "Description": "", "Name": "12_export_warnings_csv", "ElementResolver": { "ResolutionMap": {} }, "Inputs": [], "Outputs": [], "Nodes": [ { "ConcreteType": "CoreNodeModels.Input.StringInput, CoreNodeModels", "Id": "91188b58a4781842e12b29ae3b2d4e81", "NodeType": "StringInputNode", "Inputs": [], "Outputs": [ { "Id": "04f910d66d1999879caad7173aa36e1d", "Name": "", "Description": "String", "UsingDefaultValue": false, "Level": 2, "UseLevels": false, "KeepListStructure": false } ], "Replication": "Disabled", "Description": "Creates a string", "InputValue": "C:\\Temp\\revit_warnings.csv" }, { "ConcreteType": "PythonNodeModels.PythonNode, PythonNodeModels", "Code": "# -*- coding: utf-8 -*-\r\n# 12 — Exportar advertencias del modelo a CSV en disco.\r\n#\r\n# IN[0] : ruta completa del archivo .csv (str)\r\n#\r\n# Salida: mensaje con filas escritas o error.\r\n\r\nimport sys\r\n\r\nimport clr\r\nclr.AddReference('RevitAPI')\r\nclr.AddReference('RevitServices')\r\nclr.AddReference('System')\r\nfrom RevitServices.Persistence import DocumentManager\r\n\r\nimport System\r\n\r\ndoc = DocumentManager.Instance.CurrentDBDocument\r\n_PY3 = sys.version_info[0] >= 3\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 _exc_str(ex):\r\n if _PY3:\r\n return str(ex)\r\n try:\r\n return unicode(ex)\r\n except NameError:\r\n return str(ex)\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\n_ports = _dynamo_in_ports()\r\npath = _ustr(_ports[0]) if len(_ports) > 0 else ''\r\n\r\nif not path:\r\n OUT = ['Error: IN[0] ruta CSV.']\r\nelse:\r\n lines = []\r\n lines.append('severity;description;element_ids')\r\n warns = None\r\n gw_err = None\r\n try:\r\n warns = doc.GetWarnings()\r\n except Exception as ex:\r\n gw_err = _exc_str(ex)\r\n if gw_err is not None:\r\n OUT = ['GetWarnings no disponible o error: ' + gw_err]\r\n elif warns is not None:\r\n n = 0\r\n for w in warns:\r\n try:\r\n sev = _ustr(w.GetSeverity())\r\n desc = w.GetDescriptionText().replace(';', ',')\r\n ids = []\r\n try:\r\n for eid in w.GetFailingElements():\r\n ids.append(_ustr(eid.IntegerValue))\r\n except Exception:\r\n pass\r\n lines.append(sev + ';' + desc + ';' + '|'.join(ids))\r\n n += 1\r\n except Exception:\r\n continue\r\n try:\r\n System.IO.File.WriteAllLines(path, lines, System.Text.UTF8Encoding(False))\r\n OUT = ['OK', n, 'advertencias ->', path]\r\n except Exception as ex:\r\n OUT = ['No se pudo escribir archivo: ' + _exc_str(ex)]\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": "7b2b342c7aa207461f33c62324349f07", "NodeType": "PythonScriptNode", "Inputs": [ { "Id": "468d37724decb756aac87915a8575dd6", "Name": "IN[0]", "Description": "IN[0] ruta archivo .csv salida", "UsingDefaultValue": false, "Level": 2, "UseLevels": false, "KeepListStructure": false } ], "Outputs": [ { "Id": "b2ac51b62015472bdf23680e861a532b", "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": "04f910d66d1999879caad7173aa36e1d", "End": "468d37724decb756aac87915a8575dd6", "Id": "5fbcc849e38db58b1d57b53441ce09dc", "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": [], "Annotations": [], "X": 0, "Y": 0, "Zoom": 0.75, "NodeViews": [ { "Id": "91188b58a4781842e12b29ae3b2d4e81", "Name": "IN[0]", "IsSetAsInput": false, "IsSetAsOutput": false, "Excluded": false, "ShowGeometry": true, "X": 40, "Y": 220 }, { "Id": "7b2b342c7aa207461f33c62324349f07", "Name": "RÜM 12 Advertencias a CSV", "IsSetAsInput": false, "IsSetAsOutput": false, "Excluded": false, "ShowGeometry": true, "X": 520, "Y": 260 } ] } }