创建了机械系统,没有用风管连接起来。还不太理解,记录一下。
ConnectorSet connectorSet = new ConnectorSet();
Connector baseConnector 
= null;
ConnectorSetIterator csi 
= null;
ElementSet selection 
= sel.Elements;
foreach (Element e in selection)
{
    
if (e is FamilyInstance)
    {
        FamilyInstance fi 
= e as FamilyInstance;
        Family family 
= fi.Symbol.Family;
        
if (family.FamilyCategory.Name == "机械设备")
        {
            
if (null != fi.MEPModel)
            {
                csi 
= fi.MEPModel.ConnectorManager.Connectors.ForwardIterator();
                
while (csi.MoveNext())
                {
                    Connector conn 
= csi.Current as Connector;
                    
if (conn.Direction == FlowDirectionType.Out && conn.DuctSystemType == DuctSystemType.SupplyAir)
                    {
                        baseConnector 
= conn;
                        
break;
                    }
                }
            }
        }
        
else if (family.FamilyCategory.Name == "风道末端")
        {
            csi 
= fi.MEPModel.ConnectorManager.Connectors.ForwardIterator();
            csi.MoveNext();
            connectorSet.Insert(csi.Current 
as Connector);
        }
    }
}
MechanicalSystem mechanicalSys 
= null;
PipingSystem pipingSystem 
= null;
if (null != baseConnector && connectorSet.Size > 0)
{
    mechanicalSys 
= doc.Create.NewMechanicalSystem(baseConnector, connectorSet, DuctSystemType.SupplyAir);
    
//pipingSystem = doc.Create.NewPipingSystem(baseConnector, connectorSet, PipeSystemType.SupplyHydronic);
}
from:http://revit.5d6d.com/thread-858-1-1.html

相关文章:

  • 2021-12-26
  • 2022-12-23
  • 2021-10-07
  • 2021-08-03
  • 2022-02-17
  • 2021-04-01
  • 2021-08-22
猜你喜欢
  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
  • 2021-10-04
  • 2021-12-06
  • 2021-11-29
  • 2021-08-18
相关资源
相似解决方案