From a5175ebc1bcf1ff28b7fd3201b0f9bb3e91ffdbc Mon Sep 17 00:00:00 2001 From: infeeeee Date: Wed, 22 Jan 2020 21:36:01 +0100 Subject: [PATCH] Added PickNewHostMultipleRailings --- .../PickNewHostMultipleRailings-DP.dyn | 198 ++++++++++++++++++ .../PickNewHostMultipleRailings-DP.py | 24 +++ README.md | 4 + 3 files changed, 226 insertions(+) create mode 100644 PickNewHostMultipleRailings-DP/PickNewHostMultipleRailings-DP.dyn create mode 100644 PickNewHostMultipleRailings-DP/PickNewHostMultipleRailings-DP.py diff --git a/PickNewHostMultipleRailings-DP/PickNewHostMultipleRailings-DP.dyn b/PickNewHostMultipleRailings-DP/PickNewHostMultipleRailings-DP.dyn new file mode 100644 index 0000000..77be06f --- /dev/null +++ b/PickNewHostMultipleRailings-DP/PickNewHostMultipleRailings-DP.dyn @@ -0,0 +1,198 @@ +{ + "Uuid": "ce6a1744-c4f1-4cb4-8611-701ac21d599b", + "IsCustomNode": false, + "Description": null, + "Name": "PickNewHostMultipleRailings-DP", + "ElementResolver": { + "ResolutionMap": {} + }, + "Inputs": [], + "Outputs": [], + "Nodes": [ + { + "ConcreteType": "PythonNodeModels.PythonNode, PythonNodeModels", + "NodeType": "PythonScriptNode", + "Code": "import clr\r\nclr.AddReference('RevitAPI')\r\nfrom Autodesk.Revit.DB import *\r\n\r\nclr.AddReference(\"RevitServices\")\r\nimport RevitServices\r\nfrom RevitServices.Persistence import DocumentManager\r\nfrom RevitServices.Transactions import TransactionManager\r\ndoc = DocumentManager.Instance.CurrentDBDocument\r\n\r\ndoc = DocumentManager.Instance.CurrentDBDocument\r\n\r\nrailing_list = UnwrapElement(IN[0])\r\nnewhost = UnwrapElement(IN[1])\r\n\r\nTransactionManager.Instance.EnsureInTransaction(doc)\r\n\r\nhostId = newhost.Id\r\nfor r in railing_list:\r\n r.HostId = hostId\r\n\r\nTransactionManager.Instance.TransactionTaskDone()\r\n\r\nOUT = railing_list", + "VariableInputPorts": true, + "Id": "dec8434066a5437aa7bb73821e487e32", + "Inputs": [ + { + "Id": "55b09a1ea8464950b21e2f01ff0a0b43", + "Name": "IN[0]", + "Description": "Input #0", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "e681423910e241388a4263649bacdfc7", + "Name": "IN[1]", + "Description": "Input #1", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "6c2bb78d0b664cf780b5e4044b8e4359", + "Name": "OUT", + "Description": "Result of the python script", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Runs an embedded IronPython script." + }, + { + "ConcreteType": "Dynamo.Nodes.DSModelElementSelection, DSRevitNodesUI", + "NodeType": "ExtensionNode", + "InstanceId": [ + "fbb04a9b-b691-45ee-9789-15d66c732cd0-001666bf" + ], + "Id": "6283f8ff8b0e4cb6a5c9ba56d70c2242", + "Inputs": [], + "Outputs": [ + { + "Id": "de50caf6fbf34e94af3cbfe565b4d548", + "Name": "Element", + "Description": "The selected elements.", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled" + }, + { + "ConcreteType": "Dynamo.Nodes.DSModelElementsSelection, DSRevitNodesUI", + "NodeType": "ExtensionNode", + "InstanceId": [ + "ec7071b1-eb35-4b74-9eb0-530cab01c0c8-001af0cf", + "ec7071b1-eb35-4b74-9eb0-530cab01c0c8-001af0de" + ], + "Id": "6fc6ef0d13584bf5a348705b9ee037ff", + "Inputs": [], + "Outputs": [ + { + "Id": "3e45c7b526324860b6dde6c7fb3ae44a", + "Name": "Elements", + "Description": "The selected elements.", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled" + }, + { + "ConcreteType": "DSRevitNodesUI.Views, DSRevitNodesUI", + "SelectedIndex": -1, + "NodeType": "ExtensionNode", + "Id": "40dabaccc614466eb75ab9790d43c372", + "Inputs": [], + "Outputs": [ + { + "Id": "1b6ed4120b9f44a08c9bcaad754e0e32", + "Name": "Views", + "Description": "The selected Views", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "All views available in the current document." + } + ], + "Connectors": [ + { + "Start": "de50caf6fbf34e94af3cbfe565b4d548", + "End": "e681423910e241388a4263649bacdfc7", + "Id": "9b37522ac7de4cad8957f2608889c93b" + }, + { + "Start": "3e45c7b526324860b6dde6c7fb3ae44a", + "End": "55b09a1ea8464950b21e2f01ff0a0b43", + "Id": "a101134d40dd413d9beb01249ee505ed" + } + ], + "Dependencies": [], + "Bindings": [], + "View": { + "Dynamo": { + "ScaleFactor": 1.0, + "HasRunWithoutCrash": true, + "IsVisibleInDynamoLibrary": true, + "Version": "2.0.3.8810", + "RunType": "Manual", + "RunPeriod": "1000" + }, + "Camera": { + "Name": "Background Preview", + "EyeX": -17.0, + "EyeY": 24.0, + "EyeZ": 50.0, + "LookX": 12.0, + "LookY": -13.0, + "LookZ": -58.0, + "UpX": 0.0, + "UpY": 1.0, + "UpZ": 0.0 + }, + "NodeViews": [ + { + "ShowGeometry": true, + "Name": "Python Script", + "Id": "dec8434066a5437aa7bb73821e487e32", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "X": 481.0, + "Y": 332.81305637982189 + }, + { + "ShowGeometry": true, + "Name": "Select Host", + "Id": "6283f8ff8b0e4cb6a5c9ba56d70c2242", + "IsSetAsInput": true, + "IsSetAsOutput": false, + "Excluded": false, + "X": 166.83620079926141, + "Y": 482.43897226375645 + }, + { + "ShowGeometry": true, + "Name": "Select Railings", + "Id": "6fc6ef0d13584bf5a348705b9ee037ff", + "IsSetAsInput": true, + "IsSetAsOutput": false, + "Excluded": false, + "X": 131.2891236302047, + "Y": 197.80100613465413 + }, + { + "ShowGeometry": true, + "Name": "Views", + "Id": "40dabaccc614466eb75ab9790d43c372", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "X": 355.79295396139077, + "Y": 420.01420168314075 + } + ], + "Annotations": [], + "X": -69.9618910717075, + "Y": -154.4829252324904, + "Zoom": 1.0669527078898016 + } +} \ No newline at end of file diff --git a/PickNewHostMultipleRailings-DP/PickNewHostMultipleRailings-DP.py b/PickNewHostMultipleRailings-DP/PickNewHostMultipleRailings-DP.py new file mode 100644 index 0000000..fa95dd4 --- /dev/null +++ b/PickNewHostMultipleRailings-DP/PickNewHostMultipleRailings-DP.py @@ -0,0 +1,24 @@ +import clr +clr.AddReference('RevitAPI') +from Autodesk.Revit.DB import * + +clr.AddReference("RevitServices") +import RevitServices +from RevitServices.Persistence import DocumentManager +from RevitServices.Transactions import TransactionManager +doc = DocumentManager.Instance.CurrentDBDocument + +doc = DocumentManager.Instance.CurrentDBDocument + +railing_list = UnwrapElement(IN[0]) +newhost = UnwrapElement(IN[1]) + +TransactionManager.Instance.EnsureInTransaction(doc) + +hostId = newhost.Id +for r in railing_list: + r.HostId = hostId + +TransactionManager.Instance.TransactionTaskDone() + +OUT = railing_list \ No newline at end of file diff --git a/README.md b/README.md index d1ee289..8199a37 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,10 @@ Lists all inplace elements in model +### PickNewHostMultipleRailings-DP ✅ + +Pick new host for multiple railings + ### PrefixLoadedFamiliesBatch ✅ 🔻 Add a prefix to all loaded families' names from a selected category. Designed to be used with Revit Batch Processor