Message 1 of 3
IFC Export fails
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This is a piece of IFC exporter I use, it used to work, but if we want to export an IFC, the file is or empty or some (only few) of the element's of the 3D view are exported.
When we use the same json with the normal export button in revit it works, but with this code it sometimes works but most of the time not.
When it works in a model, it keeps working in that model, but when it's not working in a model, it's not exporting. so it's a consistant 'bug'.
What can I try to solve this ?
Using tx As New Transaction(doc)
tx.Start("IFC")
If System.IO.Directory.Exists(IFC_Pad) = False Then System.IO.Directory.CreateDirectory(IFC_Pad)
' select ifc file
Dim IFCInstance As New IFC
Dim configfile As String = Json_Filename
If configfile.Length = 0 Then
configfile = IFCInstance.Get_Ifc_Settings_Filename()
End If
If configfile.Length = 0 Then Return 0
Dim ifcconfig As New IfcExportSettings(configfile)
Dim ifcoptions As New IFCExportOptions
Dim threedv As View3D
For Each id As ElementId In Viewlist
Dim el As Element = doc.GetElement(id)
threedv = TryCast(el, View3D)
If Not threedv Is Nothing Then
ifcoptions.FilterViewId = id
ifcoptions.ExportBaseQuantities = ifcconfig.ExportBaseQuantities
ifcoptions.SpaceBoundaryLevel = ifcconfig.SpaceBoundaries
ifcoptions.WallAndColumnSplitting = ifcconfig.SplitWallsAndColumns
ifcoptions.FileVersion = ifcconfig.IFC_Version
For Each item In ifcconfig.Settings_Overig
ifcoptions.AddOption(item.Name, item.Value)
Next
Dim selectedconfig As BIM.IFC.Export.UI.IFCExportConfiguration = BIM.IFC.Export.UI.IFCExportConfiguration.CreateDefaultConfiguration
selectedconfig.VisibleElementsOfCurrentView = False
selectedconfig.UpdateOptions(ifcoptions, threedv.Id)
Try
doc.Export(IFC_Pad, threedv.Name, ifcoptions)
Catch
Debug.Print(Err.Description)
End Try
cnt_Exported_Views += 1
End If
Next
tx.Commit()
End Using