前言
这个例子介绍添加空间和分区。
内容
从 UI 界面看空间和分区。“分析”选项卡“空间和分区”面板:
创建空间
点击“Create Space”按钮,点“OK”,出现右边所示的6个空间。
核心逻辑:
// SpaceManager::CreateSpaces(Level level, Phase phase)
ICollection<ElementId> elements = m_commandData.Application.ActiveUIDocument.Document.Create.NewSpaces2(level, phase, this.m_commandData.Application.ActiveUIDocument.Document.ActiveView);
foreach (ElementId elem in elements){Space space = m_commandData.Application.ActiveUIDocument.Document.GetElement(elem) as Space;if (space != null) {// 添加到UI列表中m_spaceDictionary[level.Id.IntegerValue].Add(space);}
}
创建和编辑分区
创建分区核心逻辑:
Zone zone = m_commandData.Application.ActiveUIDocument.Document.Create.NewZone(level, phase);
往分区里添加空间:
m_currentZone.AddSpaces(spaces);
当前分区中删除空间:
m_currentZone.RemoveSpaces(spaces);
Space 接口
Space 的很多接口时关于生成热负荷和冷负荷分析。
namespace Autodesk.Revit.DB.Mechanical
{public class Space : SpatialElement{public double OutdoorAirflow { get; }public double OutdoorAirPerPerson { get; }public double ActualExhaustAirflow { get; }public double DesignExhaustAirflow { get; set; }public double ActualReturnAirflow { get; }public double DesignReturnAirflow { get; set; }public ReturnAirflowType ReturnAirflow { get; set; }public double ActualSupplyAirflow { get; }public double CalculatedSupplyAirflow { get; }public double DesignSupplyAirflow { get; set; }public double ActualOtherLoad { get; }public double DesignOtherLoadperArea { get; set; }public double ActualHVACLoad { get; }public double DesignHVACLoadperArea { get; set; }public double FloorReflectance { get; set; }public double WallReflectance { get; set; }public double CeilingReflectance { get; set; }public double LightingCalculationWorkplane { get; set; }public double SpaceCavityRatio { get; }public double AverageEstimatedIllumination { get; }public double BaseOffset { get; set; }public double LimitOffset { get; set; }public Level UpperLimit { get; set; }public Room Room { get; }public double OutdoorAirPerArea { get; }public double AirChangesPerHour { get; }public Zone Zone { get; }public OutdoorAirFlowStandard OutdoorAirFlowStandard { get; }public bool Plenum { get; }public bool Occupiable { get; }public double DesignPowerLoad { get; set; }public double ActualPowerLoad { get; }public BaseLoadOn PowerLoadUnit { get; set; }public double DesignLightingLoad { get; set; }public double ActualLightingLoad { get; }public BaseLoadOn LightingLoadUnit { get; set; }public double LatentHeatGainperPerson { get; set; }public double SensibleHeatGainperPerson { get; set; }public double AreaperPerson { get; set; }public GeometryElement ClosedShell { get; }public double NumberofPeople { get; set; }public OccupancyUnit OccupancyUnit { get; set; }public double DesignCoolingLoad { get; set; }public double CalculatedCoolingLoad { get; }public double DesignHeatingLoad { get; set; }public double CalculatedHeatingLoad { get; }public MEPSpaceConstruction SpaceConstruction { get; }public ElementId SpaceTypeId { get; set; }public SpaceType SpaceType { get; set; }public ConditionType ConditionType { get; set; }public double Volume { get; }public double UnboundedHeight { get; }public BaseLoadOn BaseHeatLoadOn { get; set; }public bool IsPointInSpace(XYZ point);}
}
Zone 接口
namespace Autodesk.Revit.DB.Mechanical
{public class Zone : Element{public double CalculatedSupplyAirflow { get; }public bool IsDefaultZone { get; set; }public double Area { get; }public double GrossArea { get; }public double Volume { get; }public double GrossVolume { get; }public double Perimeter { get; }public SpaceSet Spaces { get; }public CurveArray Boundary { get; }public ServiceType ServiceType { get; set; }public override string Name { set; }public double CalculatedHeatingLoad { get; }public double CalculatedCoolingLoad { get; }public double HeatingSetPoint { get; set; }public double CoolingSetPoint { get; set; }public double HeatingAirTemperature { get; set; }public double CoolingAirTemperature { get; set; }public double HumidificationSetPoint { get; set; }public double DehumidificationSetPoint { get; set; }public Phase Phase { get; }public bool AddSpaces(SpaceSet spaces);public bool RemoveSpaces(SpaceSet spaces);}
}