Hi! Can anybody help me ? I need a window pop up with that IDs , that you can click on the green part and it would take you to that element.
This will do it for you.
This wasn’t make by me, you can find all the source documentation here;
Python Script
import sys
import clr
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
#import net library
from System.Collections.Generic import List
#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument
app = uiapp.Application
clr.AddReference('System.Drawing')
clr.AddReference('System.Windows.Forms')
import System.Drawing
import System.Windows.Forms
from System.Drawing import *
from System.Windows.Forms import *
class FormResume(Form):
def __init__(self, lstElems):
self._lst_Elems = lstElems
self.InitializeComponent()
def InitializeComponent(self):
self._listView1 = System.Windows.Forms.ListView()
self._buttonQuit = System.Windows.Forms.Button()
self.SuspendLayout()
#
# listView1
x,y = 294, 379
self._listView1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right
self._listView1.Location = System.Drawing.Point(13, 33)
listViewItem = []
for elem in self._lst_Elems:
item1 = System.Windows.Forms.ListViewItem(elem.Name)
item1.Tag = elem
listViewItem.append(item1)
self._columnHeader1 = System.Windows.Forms.ColumnHeader()
self._columnHeader1.Text = "Liste Elements"
self._listView1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
self._listView1.CheckBoxes = False
self._listView1.Columns.AddRange(System.Array[System.Windows.Forms.ColumnHeader]([self._columnHeader1]))
self._listView1.GridLines = True
self._listView1.Items.AddRange(System.Array[System.Windows.Forms.ListViewItem](listViewItem))
self._listView1.Size = System.Drawing.Size(x,y)
self._listView1.View = System.Windows.Forms.View.Details
self._columnHeader1.Width = x
self._listView1.ItemSelectionChanged += self.ListView1ItemSelectionChanged
#
# buttonQuit
#
self._buttonQuit.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right
self._buttonQuit.Location = System.Drawing.Point(226, 418)
self._buttonQuit.Name = "buttonQuit"
self._buttonQuit.Size = System.Drawing.Size(81, 30)
self._buttonQuit.TabIndex = 1
self._buttonQuit.Text = "Quit"
self._buttonQuit.UseVisualStyleBackColor = True
self._buttonQuit.Click += self.ButtonQuitClick
#
# FormListView29
#
self.ClientSize = System.Drawing.Size(319, 460)
self.Controls.Add(self._buttonQuit)
self.Controls.Add(self._listView1)
self.Name = "FormResume"
self.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show
self.Text = "FormResume"
self.ResumeLayout(False)
def ButtonQuitClick(self, sender, e):
self.Close()
def ListView1ItemSelectionChanged(self, sender, e):
elem = e.Item.Tag
itemId = elem.Id
uidoc.ShowElements(elem)
uidoc.Selection.SetElementIds(List[ElementId]([itemId]))
objForm = FormResume(UnwrapElement(IN[0]))
objForm.Show()
2 Likes
I’m sorry . I’m new to dynamo and i have no idea what to do with that code isn’t there a way to solve this using nodes?
No sir.
Use it like this. (My Python node is re named here)
- Copy the Python code from above into a Python node.
- Your input is the list of elements that you have shown above.
When you run that with the list of elements, you will be given a popup window shown int he screenshot and you can click between them like you want.
No copy it into a “Python Script” node
WORKS PERFECT! LOVE IT. THANKS!
1 Like