Store energy model somewhere in the revit file

Store energy model somewhere in the revit file

pedromz5GA9B
Explorer Explorer
1,007 Views
3 Replies
Message 1 of 4

Store energy model somewhere in the revit file

pedromz5GA9B
Explorer
Explorer

Hello community,

 

I am using the Analysis from the DB library to get the energy model so I can run some calculations from that model. For anyone interested, this is the piece of code:

 

EmOpt = EnergyAnalysisDetailModelOptions()
    EmOpt.IncludeShadingSurfaces = False
    EmOpt.ExportMullions = False
    EmOpt.Tier = EnergyAnalysisDetailModelTier.SecondLevelBoundaries
    EmOpt.EnergyModelType = EnergyModelType.SpatialElement

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

My problem is that, for large models, it is annoying to have to run this function each time i run the code, even if no changes have been made to the model.

So the question is: is there a way to calculate and store the energy model somewhere in the revit file and access it any time I need to get info from it?

Regards,
Pedro

0 Likes
Accepted solutions (1)
1,008 Views
3 Replies
Replies (3)
Message 2 of 4

Revitalizer
Advisor
Advisor

Hi,

 

what about the static method EnergyAnalysisDetailModel.GetMainEnergyAnalysisDetailModel(Document doc) ?

 

Since the EnergyAnalysisDetailModel is just an Element, it is already stored in the project file.

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 3 of 4

cwaluga
Advocate
Advocate

The EnergyModelType.SpatialElement is never stored, since this option is only available for export. The energy model in Revit which Revitalizer refers to is always EnergyModelType.BuildingElement.

Message 4 of 4

pedromz5GA9B
Explorer
Explorer
Accepted solution

There was a really easy and simple solution for my question. It turns out that the model is indeed stored in the revit file. From the EnergyAnalysisDetailModel class:

 

If there is already a persistent EnergyAnalysisDetailModel element in the document, the API can generate other independent energy models, but they will not be affected by the actions the user takes in the UI. The EnergyAnalysisDetailModel will remain in the document until it is discarded (either by the actions of the user, or by a call to Document.Delete()

 

In other words, if the model already exists, it can be accessed through the function GetMainEnergyAnalysisDetailModel(). If it does not exist, then it should be generated through the EnergyAnalysisDetailModel.Create. Keep in mind that the model is only stored if there are no models available.

 

Thank you for the replies.