Get a list of Exterior Window Constructions

Get a list of Exterior Window Constructions

Kevin.Lawson.PE
Advocate Advocate
768 Views
4 Replies
Message 1 of 5

Get a list of Exterior Window Constructions

Kevin.Lawson.PE
Advocate
Advocate

I'm attempting to get a list of the exterior window constructions using MEPBuildingConstruction.GetConstructions.  I can get roofs/walls/floors ect. fine, but I can't get windows or skylights.  I get a "System.Collections.Generic.KeyNotFoundException: 'The given key was not present in the dictionary.' Error. " Do I need to be looking at a different function?

ElementId eid = EnergyDataSettings.GetBuildingConstructionSetElementId(doc);
MEPBuildingConstruction mepBuildingConstruction = doc.GetElement(eid) as MEPBuildingConstruction;
List<Construction> roofConstructions = mepBuildingConstruction.GetConstructions(ConstructionType.Roof).ToList(); //This works fine
List<Construction> exteriorWindowConstructions = mepBuildingConstruction.GetConstructions(ConstructionType.ExteriorWindow).ToList(); //This does not work. I get a System.Collections.Generic.KeyNotFoundException: 'The given key was not present in the dictionary.'

 

 

 

 

-Kevin Lawson, PE
www.rippleengineeringsoftware.com
Revit heating and cooling load calculations in one click!
0 Likes
Accepted solutions (1)
769 Views
4 Replies
Replies (4)
Message 2 of 5

jeremytammik
Autodesk
Autodesk

That looks strange indeed, two such similar calls, and one failing so unpleasantly.

  

Can you provide a minimal reproducible case for the development team to analyse?

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

Thank you!

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 5

Kevin.Lawson.PE
Advocate
Advocate

Hi Jeremy,  I've attached a minimum reproducible test case with an empty project.   Let me know if you need anything else.  Thanks! -Kevin

-Kevin Lawson, PE
www.rippleengineeringsoftware.com
Revit heating and cooling load calculations in one click!
0 Likes
Message 4 of 5

Kevin.Lawson.PE
Advocate
Advocate

On further testing, I've found the above code works fine in both Revit 2020 and 2021.  It's just 2019 where I'm having a problem. 

-Kevin Lawson, PE
www.rippleengineeringsoftware.com
Revit heating and cooling load calculations in one click!
0 Likes
Message 5 of 5

jeremytammik
Autodesk
Autodesk
Accepted solution

Congratulations on getting it to work in the more recent versions.

 

The development team is currently working on future releases four or five years onward from Revit 2019, so it would require some very compelling arguments to motivate them to implement a fix for that version.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes