Skip to content

Commit

Permalink
add SnoopElementById
Browse files Browse the repository at this point in the history
  • Loading branch information
chuongmep committed May 29, 2023
1 parent 56f018e commit 4b5fde2
Show file tree
Hide file tree
Showing 3 changed files with 178 additions and 0 deletions.
23 changes: 23 additions & 0 deletions OpenMEP/Application/Database.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Diagnostics;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using OpenMEP.Helpers;
using RevitServices.Persistence;

namespace OpenMEP.Application;
Expand Down Expand Up @@ -35,4 +36,26 @@ public static string SnoopElements(List<global::Revit.Elements.Element> elements
DocumentManager.Instance.CurrentUIApplication.PostCommand(lookupCommandId);
return "Success";
}

/// <summary>
/// Snoop Explore Elements By Id
/// </summary>
/// <param name="id">id of element</param>
/// <returns></returns>
/// <example>
/// ![](../OpenMEPPage/application/dyn/pic/Database.SnoopElementById.png)
/// [Database.SnoopElementById.dyn](../OpenMEPPage/application/dyn/Database.SnoopElementById.dyn)
/// </example>
public static string SnoopElementById(List<string> id)
{
Autodesk.Revit.DB.Document document = DocumentManager.Instance.CurrentDBDocument;
List<global::Revit.Elements.Element> elements = new List<global::Revit.Elements.Element>();
foreach (string s in id)
{
ElementId elementId = new ElementId(int.Parse(s));
global::Revit.Elements.Element element = document.GetElement(elementId).ToDynamoType();
elements.Add(element);
}
return SnoopElements(elements);
}
}
155 changes: 155 additions & 0 deletions docs/OpenMEPPage/application/dyn/Database.SnoopElementById.dyn
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
{
"Uuid": "5d8156c2-ab88-477b-bf54-97d6725cd43e",
"IsCustomNode": false,
"Description": "",
"Name": "Database.SnoopElementById",
"ElementResolver": {
"ResolutionMap": {}
},
"Inputs": [],
"Outputs": [],
"Nodes": [
{
"ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore",
"NodeType": "FunctionNode",
"FunctionSignature": "OpenMEP.Application.Database.SnoopElementById@string[]",
"Id": "2e08a8a8f4b24690a0a9adb59ce60a65",
"Inputs": [
{
"Id": "d0b3db882f1a47c6911d6d5aa3396ef3",
"Name": "id",
"Description": "id of element\n\nstring[]",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Outputs": [
{
"Id": "cf395efbd706416989460b6b1f6d17e0",
"Name": "string",
"Description": "string",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Replication": "Auto",
"Description": "Snoop Explore Elements By Id\n\nDatabase.SnoopElementById (id: string[]): string"
},
{
"ConcreteType": "CoreNodeModels.Input.StringInput, CoreNodeModels",
"NodeType": "StringInputNode",
"InputValue": "960073",
"Id": "a6b00ae3d9104151b0b020f93b3a68a7",
"Inputs": [],
"Outputs": [
{
"Id": "826558db73774650a09992373de9d4e5",
"Name": "",
"Description": "String",
"UsingDefaultValue": false,
"Level": 2,
"UseLevels": false,
"KeepListStructure": false
}
],
"Replication": "Disabled",
"Description": "Creates a string."
}
],
"Connectors": [
{
"Start": "826558db73774650a09992373de9d4e5",
"End": "d0b3db882f1a47c6911d6d5aa3396ef3",
"Id": "a75fd84cdf44487c941ab8de8643583f",
"IsHidden": "False"
}
],
"Dependencies": [],
"NodeLibraryDependencies": [
{
"Name": "OpenMEP",
"Version": "1.0.0",
"ReferenceType": "Package",
"Nodes": [
"2e08a8a8f4b24690a0a9adb59ce60a65"
]
}
],
"Thumbnail": "",
"GraphDocumentationURL": null,
"ExtensionWorkspaceData": [
{
"ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670",
"Name": "Properties",
"Version": "2.16",
"Data": {}
},
{
"ExtensionGuid": "DFBD9CC0-DB40-457A-939E-8C8555555A9D",
"Name": "Generative Design",
"Version": "3.0",
"Data": {}
}
],
"Author": "",
"Linting": {
"activeLinter": "None",
"activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a",
"warningCount": 0,
"errorCount": 0
},
"Bindings": [],
"View": {
"Dynamo": {
"ScaleFactor": 1.0,
"HasRunWithoutCrash": true,
"IsVisibleInDynamoLibrary": true,
"Version": "2.16.1.2727",
"RunType": "Automatic",
"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
},
"ConnectorPins": [],
"NodeViews": [
{
"Name": "Database.SnoopElementById",
"ShowGeometry": true,
"Id": "2e08a8a8f4b24690a0a9adb59ce60a65",
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 483.20000000000005,
"Y": 287.2
},
{
"Name": "String",
"ShowGeometry": true,
"Id": "a6b00ae3d9104151b0b020f93b3a68a7",
"IsSetAsInput": false,
"IsSetAsOutput": false,
"Excluded": false,
"X": 254.40000000000009,
"Y": 271.2
}
],
"Annotations": [],
"X": -96.800000000000068,
"Y": -33.599999999999966,
"Zoom": 1.0
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4b5fde2

Please sign in to comment.