Changes not applied gbXML export via Python script

revit
python
dynamo
xml

#1

Hi,

I found a Python script on the web which allows to automatically export gbXML file from Revit using Dynamo and added some custom feature which include call to a webservice for gbXML parsing.
It works great unless some changes are not applied to the export file.

I have a Revit model with some spaces (arround 100).
I did a first export then I noticed that a few spaces had a wrong space type.
Went back to Revit, applied the modifications needed and relaunched the dynamo script.
The result is the same as before, the space types are not modified in the gbXML feed.

I have also tried to delete the space and recreate it => result is the same
Add more spaces => the new one are not in the gbXML feed.

If I do the process manually: R / Export / gbXML / choose spaces : it works.

Any ideas on how to fix that?

Thanks a lot.
Clement


#2

I’m no expert on this, but I think people will want to see your Python script.


#3

Exactly.
#Import Lib externes à Revit
import sys
sys.path.append(r’C:\Program Files (x86)\IronPython 2.7\DLLs’)
sys.path.append(r’C:\Program Files (x86)\IronPython 2.7\Lib’)

#Lib qui permet d'ouvrir le navigateur web et donc charger le webservice pour parser le fichier gbXML
import webbrowser

#Libs Revit
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import clr

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

#Récupère les variables passée en arguemnts 
folder = IN[0]
filename = IN[1]
complete = folder+'\\'+filename+'.xml'

optionsenergy = Analysis.EnergyAnalysisDetailModelOptions()

#Choose between final or secondlevel boundaries for export
#optionsenergy.Tier = Analysis.EnergyAnalysisDetailModelTier.Final
optionsenergy.Tier = Analysis.EnergyAnalysisDetailModelTier.SecondLevelBoundaries

TransactionManager.Instance.EnsureInTransaction(doc)
model = Analysis.EnergyAnalysisDetailModel.Create(doc,optionsenergy)
TransactionManager.Instance.TransactionTaskDone()

options = GBXMLExportOptions()
#buildingelement supposedly only works with massExport
#options.ExportEnergyModelType = ExportEnergyModelType.BuildingElement

options.ExportEnergyModelType = ExportEnergyModelType.SpatialElement

TransactionManager.Instance.EnsureInTransaction(doc)
doc.Export(folder,filename,options)
TransactionManager.Instance.TransactionTaskDone()

#Appel le script de parsing gbXML
webbrowser.open('http://localhost/tfe/backend/gbxml_parser.php?file=' + complete, new=2)

#Variable de sortie
OUT = 0

#4

Any ideas on this?
Thanks.