- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I would like to the list of Plumbing Fixture, as it appears in the System Browser
Quisiera ordenar la lista de mueble sanitario, tal como aparece en el System Browser
Here is the script
public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Aplicación app = uiapp.Application;
Document doc = uidoc.Document;
string nombre_mueble = string.Empty;
//Extract all pipe system
foreach (PipingSystem pipingSystem in new FilteredElementCollector(doc)
.OfClass(typeof(PipingSystem)).WhereElementIsNotElementType().ToList())
{
// Get the Domestic Cold Water type
if (pipingSystem.SystemType == PipeSystemType.DomesticColdWater)
{
var elemset = pipingSystem.PipingNetwork;
foreach (Element elem in elemset)
{
FamilyInstance fi;
if (elem is FamilyInstance)
{
fi = elem as FamilyInstance;
if (fi != null)
{
MEPModel mEPModel = fi.MEPModel;
if (mEPModel is MechanicalFitting)
{
MechanicalFitting mf = mEPModel as MechanicalFitting;
//....
//...
//...
}
if (fi.Category.Id == new Elemento(BuiltInCategory.OST_PipeFitting))
{
//...
//...
//...
}
if (fi.Category.Id == new ElementId(BuiltInCategory.OST_PlumbingFixtures))
{
IList<Connector> connectorse = GetConnectors(fi);
foreach (var connector in connectorse)
{
if (connector.PipeSystemType == PipeSystemType.DomesticColdWater)
{
// var mepConnectorInfo = connector.GetMEPConnectorInfo() as MEPFamilyConnectorInfo;
// var parameterValue = (DoubleParameterValue)mepConnectorInfo.GetConnectorParameterValue(new ElementId(BuiltInParameter.CONNECTOR_DIAMETER));
// diametro_mueble = UnitUtils.ConvertFromInternalUnits(parameterValue. Value, UnitTypeId.Millimeters).ToString();
nombre_mueble += connector.Owner.Name + "\n"; //This is where I find the names
}
// demanda_m = connector.Demand.ToString();//Demanda del mueble
}
}
}
}
}
}
TaskDialog.Show("Revit_Informacion", nombre_mueble);
}
return Result.Succeeded;
}
#region Recuperar conectores de FamilyInstance
static IList<Connector> GetConnectors(FamilyInstance inst)
{
//1. Cast Element to FamilyInstance
//FamilyInstance inst = element as FamilyInstance;
//2. Get MEPModel Property
MEPModel mepModel = inst.MEPModel;
//3. Get connector set of inst
ConnectorSet connectorSet = mepModel.ConnectorManager.Connectors;
//4. Initialise empty list of connectors
List<Connector> connectorList = new List<Connector>();
//5. Loop through connector set and add to list
foreach (Connector connector in connectorSet)
{
connectorList.Add(connector);
}
return connectorList;
}
#endregion
Solved! Go to Solution.