Added PickNewHostMultipleRailings

This commit is contained in:
2020-01-22 21:36:01 +01:00
parent f52d850efd
commit a5175ebc1b
3 changed files with 226 additions and 0 deletions

View File

@@ -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
}
}

View File

@@ -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