Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Export of multiple GBXML models

Anonymous

Export of multiple GBXML models

Anonymous
Not applicable

Hello everyone!

For my Thesis work at my university I have to make a lot of different GBXML models (around 18000). No way I can do that without code.

This is what I came up with (I attached only a part of it; FloorR, WallsR, RoofR are lists to set R value of corresponding elements):

 

####### Setting Enegry Analysis parameters  #############

opt=Analysis.EnergyAnalysisDetailModelOptions()
opt.EnergyModelType=Analysis.EnergyModelType.BuildingElement
opt.ExportMullions=False
opt.IncludeShadingSurfaces=False
opt.SimplifyCurtainSystems=True
opt.Tier=Analysis.EnergyAnalysisDetailModelTier.SecondLevelBoundaries



##### loop over all R-value combinations and create models    ####################

t=Transaction(doc,"R change")
c=Transaction(doc,"model creation")

for i in range(len(FloorR)):
		for j in range(len(WallsR)):
			for k in range(len(RoofR)):
				t.Start()
				Floor.Set(FloorR[i]/0.3048)  #R-value change for floor
				Wall.Set(WallsR[j]/0.3048)#R-value change for Walls
				Roof.Set(RoofR[k]/0.3048)#R-value change for roof
				t.Commit()
				t.Dispose()
				
				c.Start()
				model=Analysis.EnergyAnalysisDetailModel.Create(doc, opt)
				model.TransformModel()
				GBopt=GBXMLExportOptions()
				GBopt.ExportEnergyModelType=ExportEnergyModelType.BuildingElement
				doc.Export("C:\Users\Миша\Desktop\ASD","0"+","+str(0.2/FloorR[i])+","+str(0.3/WallsR[j])+","+str(0.3/RoofR[k]), GBopt)
				c.Commit()
                               

 

This creates models, but I ran into a problem I dont fully understand: as the process continues, it slowes down and stops at about 170-175 created models. Apparently, comething is taking up the memory. I tried to doc.Delete(model) at the end of each 'for' loop, but it didnt help either.

 

What could be a solution? 

Thank you !

 

0 Likes
Reply
Accepted solutions (1)
538 Views
3 Replies
Replies (3)

jeremytammik
Autodesk
Autodesk
Accepted solution

The behaviour you describe is completely expected and as designed.

 

Revit is an end user product designed to be driven by a human being.

 

Human beings are not expected to sit down and create 18000 models in one sitting.

 

I suggest you implement an external executable that drives Revit using the code you shared above and monitors progress as you export results from the models you create.

 

Whenever Revit starts slowing down, take note of how far you got in processing, kill the process, restart Revit and continue from where you left off.

 

This is a common approach to programmatically drive processes in batch mode that were not designed for it.

 

You can also search The Building Coder for further hints on batch processing Revit documents:

 

https://www.google.com/search?q=batch+processing&as_sitesearch=thebuildingcoder.typepad.com

 

Alternatively, you could generate your 18000 models online using Forge and DA4R:

 

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

 

Good luck and have fun with your thesis!

 

Cheers,

 

Jeremy

 



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

0 Likes

Anonymous
Not applicable

I'll try those out, thank you for your answer!

0 Likes

RIPENG
Enthusiast
Enthusiast

Based on the code snippet provided, it appears that only R-values are manipulated and not the underlying model geometry. If that's the case, best to use Revit to export a single gbXML seed file. Then iterate over desired seed file parameters (like R-value) in an environment like Python which is excellent for large scale text operations.

 

Two utilities that would help with the route described above:

1. XmlNotepad (to build familiarity with gbXML structure and mechanization),

2. xgbxml (Python library for gbXML parsing and manipulation).

 

-Jake