- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey Everyone, I have a plugin where I launch a form that lets you pick the System Type & Pipe Type. Right now im using a user input double to set the pipe diameter. But I wanted to create a dropdown in the form that has the sizes for the pipe type.
example
I know you are supposed to iterate through the segments to get the sizes as shown in the link below but I only have one pipe segment type for each pipe type(name). So i want to be able to select the pipe type(name) "ductile iron" and then populate a list of the available sizes into the comboBox. is it possible to do this without getting the segments?
link to getting sizes from segment:
I dont want the user to have to select a pipe segment type because there is only one per Pipe Type(name)
Here is my Form:
Form Code:
public PipeCreationForm(Autodesk.Revit.UI.ExternalCommandData commandData)
{
InitializeComponent();
UIDocument uidoc = commandData.Application.ActiveUIDocument;
Document doc = uidoc.Document;
//levels
FilteredElementCollector levels = new FilteredElementCollector(uidoc.Document);
List<Level> levelCol = levels.OfClass(typeof(Level)).OfType<Level>().OrderBy(lev => lev.Elevation).ToList();
sLevel.DataSource = new List<Level>(levelCol);
sLevel.DisplayMember = "Name";
if (levelCol.Any())
{
sLevel.SelectedIndex = 0;
}
//System Type
FilteredElementCollector mepSystem = new FilteredElementCollector(uidoc.Document);
List<PipingSystemType> systemTypeCol = mepSystem.OfClass(typeof(PipingSystemType)).OfType<PipingSystemType>().OrderBy(x => x.Name).ToList();
pSysType.DataSource = new List<PipingSystemType>(systemTypeCol);
pSysType.DisplayMember = "Name";
if (systemTypeCol.Any())
{
pSysType.SelectedIndex = 0;
}
//pipe types
FilteredElementCollector pipeType = new FilteredElementCollector(uidoc.Document);
List<PipeType> pipeTypeCol = pipeType.OfClass(typeof(PipeType)).OfType<PipeType>().ToList();
pType.DataSource = new List<PipeType>(pipeTypeCol);
pType.DisplayMember = "Name";
if (pipeTypeCol.Any())
{
pType.SelectedIndex = 0;
}
//find segment sizes based on selected pipe type
}
Sorry if this has been asked before i didnt see it anywhere.
Solved! Go to Solution.