Hello, How to create dropdown nodes? I would like create dropdown nodes from pipe part. Like this one:
look at this
Hi @p.da,
If you want to create a dropdown list that is dynamically populated with information from the document, then youâll need to build a custom node or look into a third-party package.
If the list of options in the dropdown is fixed, you could use the Custom Selection
node. This was introduced in Dynamo Core 2.16 and is available in Civil 3D 2024 onwards.
thanks, I would like have three dropdown lists:
First: âPart Listâ, next âStructure/Pipe Famillesâ and next âPart Sizeâ.
The choice of the next one would depend on the choice of the previous one.
Currently there is no mechanism available to populate dropdowns with the output values of another node. You would need to build your own custom nodes for this, or explore third-party packages to see if any provide this capability.
Ok, thanks for explanation . That node would be very useful to dynamo player.
You could use winform in a Python node:
import clr
clr.AddReference("System.Windows.Forms")
clr.AddReference("System.Drawing")
import System
from System.Windows.Forms import *
from System.Drawing import *
Answers = ["Yes", "No"]
class CreateWindow(Form):
def __init__(self):
self.Name = "Create Window"
self.Text = "Lovely moose"
self.Size = Size(370, 270)
self.CenterToScreen()
label = Label()
label.Text = "Do you like moose?"
label.Parent = self
label.Location = Point(20, 20)
label.Height = 50
label.Width = 320
label.ForeColor = Color.Red
label.Font = Font("Arial", 12)
# drop down
self.ComboBox = ComboBox()
self.ComboBox.Parent = self
self.ComboBox.DropDownStyle = ComboBoxStyle.DropDownList
for i, key in enumerate(Answers):
self.ComboBox.Items.Add(key)
self.ComboBox.Location = Point(200, 70)
self.ComboBox.Width = 120
self.ComboBox.ItemHeight = 10
self.ComboBox.Font = Font(self.ComboBox.Font.Name, 11) # Font Size
self.ComboBox.SelectedIndex = 0
self.ComboBox.MaxDropDownItems = 5
# Create Bottom Line
self.bottom_line = Label()
self.bottom_line.Parent = self
self.bottom_line.Location = Point(0 , 170)
self.bottom_line.Size = Size(350, 3)
self.bottom_line.BorderStyle = BorderStyle.FixedSingle
self.bottom_line.ForeColor = Color.Black
self.button2 = Button()
self.button2.Parent = self
self.button2.Text = "Moose!"
self.button2.Font = Font("Arial", 11)
self.button2.Location = Point(20, 180)
self.button2.Width = 100
self.button2.Height = 40
self.button2.Click += self.ButtonClicked
self.button2.BackColor = Color.Red
self.button2.ForeColor = Color.White
# Make the form always on top + set the size
self.TopMost = True
def ButtonClicked(self, sender, args):
if sender == self.button2: # Cancel
self.value = self.ComboBox.SelectedItem
self.Close()
form = CreateWindow()
Application.Run(form)
OUT = form.value
You mentioned about Data Shapes package, it can be useful for this case?
I donât know this add-on.