Hi!
I’m using Revit Python Shell to create a script that would use SBiM API to import a surface from LandXML file.
The xml file is generated in Autodesk Civil. It imports without errors when using SBiM interface. But when I try to do this programmaticly the xml is not valid.
I would be grateful if you could point out what i’m making wrong.
Here is my code:
import sys
import clr
import math
clr.AddReference(“RevitAPI”)
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference(“RevitServices”)
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
RvtDB = Autodesk.Revit.DB
SBiM Library
clr.AddReference(“sof_sbim_api_six”)
from SOFiSTiK.Infrastructure.API import *
clr.AddReference(‘System.Windows.Forms’)
from System.Windows.Forms import OpenFileDialog
uidoc = revit.ActiveUIDocument
doc = uidoc.Document
print(doc)
file_dialog = OpenFileDialog()
ret = file_dialog.ShowDialog()
path = file_dialog.FileName
print(path)
ter = Terrain()
ter.Position = ImportPosition.Shared
ter.Units = ImportUnits.Meter
ter.BaseElevation = 0
material = doc.GetElement(RvtDB.ElementId(1182617))
ter.SetSource(path, TerrainSourceType.LandXML)
ter.SetTerrainType(TerrainType.ComponentFamily)
ter.AngularTolerance = 0.1
ter.SetMaterial(material)
print(“is valid? :”,ter.IsValidObject())
print(ter)
print(ter.LogMessage)
terenElem = TerrainElement.Create(doc, ter)
print(terenElem)