Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

EnergyAnalysisOpening and EnergyAnalysisSurface

1 REPLY 1
Reply
Message 1 of 2
pmcmm1
406 Views, 1 Reply

EnergyAnalysisOpening and EnergyAnalysisSurface

Hello there,

 

I'm trying to use the EnergyAnalysis function of revit to calculate adjacencies and to report all surfaces of the model. Everything works wonderfully except for one element: I can't seem to find a way to connect a window (class EnergyAnalysisOpening) with a certain surface (class EnergyAnalysisSurface).

 

It's such a trivial question that I refuse to do any complex operations with geometry such as intersections.

The location of the window is the basis of model analysis and I can also see that it gets reported into the gbxml file, so it must be somewhere in one of the functions of the class Openings.

 

Can someone help me out here finding the solution for something obvious? Here goes a sample code to get the windows and walls:

 

EmOpt = EnergyAnalysisDetailModelOptions()
EmOpt.ExportMullions = False
EmOpt.EnergyModelType = EnergyModelType.SpatialElement

tx = Transaction(doc)
tx.Start('create model')
calc_model = EnergyAnalysisDetailModel.Create(doc,EmOpt)
tx.Commit()

spaces_list = calc_model.GetAnalyticalSpaces()
windows_list = calc_model.GetAnalyticalOpenings()

for window in windows_list:
    type = window.LookupParameter("Opening Type").AsValueString()
    if type != 'Air':
        width_window = window.Width*ft_to_m
        height_window = window.Height*ft_to_m
        area_window = width_window*height_window
        name_window = window.OriginatingElementDescription
        win_id = window.CADObjectUniqueId
        win = doc.GetElement(win_id)
        window_host_id = win.Host.Id.ToString()
        uvalue_window = win.Symbol.LookupParameter("Heat Transfer Coefficient (U)").AsValueString()
        print '{}   {}: {} x{} = {} m2'.format(name_window,uvalue_window,
            width_window,height_window,area_window)

 

Thanks a lot for your help!

1 REPLY 1
Message 2 of 2
ottosson_mathias
in reply to: pmcmm1

I know this is an old question by know, but here is my solution to this problem:

Instead of getting the openings from the space, get it from the surfaces, and then get the space from the surface as well.

 

var analyticalSurfaces = new FilteredElementCollector(doc)
  .OfCategory(BuiltInCategory.OST_AnalyticSurfaces)
  .ToElements().ToList();

foreach (var surface in analyticalSurfaces)
{
  if (!(surface is EnergyAnalysisSurface))
  {
    continue;
  }

  var space = surface.GetAnalyticalSpace(); // to get the space
  var openings = surface.GetAnalyticalOpenings(); // openings for the current surface
}

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report