Skip to content

Commit

Permalink
#164 Element.Assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
andydandy74 committed Apr 21, 2024
1 parent 01f3921 commit 98366a5
Show file tree
Hide file tree
Showing 4 changed files with 372 additions and 104 deletions.
Binary file modified NodeList.xlsx
Binary file not shown.
167 changes: 167 additions & 0 deletions nodes/2.x/Element.Assembly.dyf
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
{
"Uuid": "2b8008fa-9975-4cfb-ae6b-e8f1ec391639",
"IsCustomNode": true,
"Category": "Clockwork.Revit.Elements.Query",
"Description": "Retrieves the assembly an element belongs to (if any)",
"Name": "Element.Assembly",
"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\ndef GetAssembly(item):\r\n\tif hasattr(item, \"AssemblyInstanceId\"): return item.Document.GetElement(item.AssemblyInstanceId)\r\n\telse: return None\r\n\r\nitems = UnwrapElement(IN[0])\r\n\r\nif isinstance(IN[0], list): OUT = [GetAssembly(x) for x in items]\r\nelse: OUT = GetAssembly(items)",
"Engine": "IronPython2",
"VariableInputPorts": true,
"Id": "6357f24fa00c4080b41ba4a8abc0f6c0",
"Inputs": [
{
"Id": "7237402e3c0a4f9c989242883bbf9afc",
"Name": "IN[0]",
"Description": "Input #0",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Outputs": [
{
"Id": "a1d8b64193a54015a9ac35c722643a09",
"Name": "OUT",
"Description": "Ergebnis des Python-Skripts",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Replication": "Disabled",
"Description": "Führt ein eingebettetes Python-Skript aus."
},
{
"ConcreteType": "Dynamo.Graph.Nodes.CustomNodes.Symbol, DynamoCore",
"NodeType": "InputNode",
"Parameter": {
"Name": "element",
"TypeName": "var",
"TypeRank": -1,
"DefaultValue": null,
"Description": ""
},
"Id": "e158165d8edf447cb92b90fc0cb323e0",
"Inputs": [],
"Outputs": [
{
"Id": "8f8f8658123242b8a1cc2e8eb4306de9",
"Name": "",
"Description": "Symbol",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Replication": "Disabled",
"Description": "Ein Funktionsparameter zur Verwendung mit benutzerdefinierten Blöcken.\r\n\r\nSie können den Typ und den Vorgabewert für den Parameter angeben, z. B.\r\n\r\ninput : var[]..[]\r\nvalue : bool = false"
},
{
"ConcreteType": "Dynamo.Graph.Nodes.CustomNodes.Output, DynamoCore",
"NodeType": "OutputNode",
"ElementResolver": null,
"Symbol": "assembly",
"Id": "42aff167bc914042a666f22f7bdeac02",
"Inputs": [
{
"Id": "df4d765efa5b49d7ad4b4ff3047cf8d8",
"Name": "",
"Description": "",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Outputs": [],
"Replication": "Disabled",
"Description": "Eine Funktionsausgabe zur Verwendung mit benutzerdefinierten Blöcken"
}
],
"Connectors": [
{
"Start": "a1d8b64193a54015a9ac35c722643a09",
"End": "df4d765efa5b49d7ad4b4ff3047cf8d8",
"Id": "e8d184a2332048278399c0420aed4e01"
},
{
"Start": "8f8f8658123242b8a1cc2e8eb4306de9",
"End": "7237402e3c0a4f9c989242883bbf9afc",
"Id": "b44b5ce57c0e4063af444dc8c71a0461"
}
],
"Dependencies": [],
"NodeLibraryDependencies": [],
"Author": "None provided",
"Bindings": [],
"View": {
"Dynamo": {
"ScaleFactor": 1.0,
"HasRunWithoutCrash": false,
"IsVisibleInDynamoLibrary": true,
"Version": "2.12.1.8246",
"RunType": "Manual",
"RunPeriod": "1000"
},
"Camera": {
"Name": "Hintergrundvorschau",
"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": "6357f24fa00c4080b41ba4a8abc0f6c0",
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 250.0,
"Y": 0.0
},
{
"ShowGeometry": true,
"Name": "Input",
"Id": "e158165d8edf447cb92b90fc0cb323e0",
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 0.0,
"Y": 0.0
},
{
"ShowGeometry": true,
"Name": "Output",
"Id": "42aff167bc914042a666f22f7bdeac02",
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 449.80000000000007,
"Y": 0.0
}
],
"Annotations": [],
"X": 0.0,
"Y": 0.0,
"Zoom": 1.0
}
}
12 changes: 12 additions & 0 deletions nodes/2.x/python/Element.Assembly.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

def GetAssembly(item):
if hasattr(item, "AssemblyInstanceId"): return item.Document.GetElement(item.AssemblyInstanceId)
else: return None

items = UnwrapElement(IN[0])

if isinstance(IN[0], list): OUT = [GetAssembly(x) for x in items]
else: OUT = GetAssembly(items)
Loading

0 comments on commit 98366a5

Please sign in to comment.