IFC4 export error

IFC4 export error

Anonymous
Not applicable
580 Views
4 Replies
Message 1 of 5

IFC4 export error

Anonymous
Not applicable

Hi,

 

I'm trying to export revit model to IFC by creating my add-in. I've created a very simple project and the export class. The problem is that export to the  IFCVersion.Default  and all IFC2.** versions works fine, but i can't export to any IFC4.* version as i simply get a mistake like this "An unrecoverable error occurred during the export process. The export will be aborted". Does anybody have any sugestions what can be wrong? I',m using revit 2019 and here is an example of my code

[Transaction(TransactionMode.Manual)]
    public class Command : IExternalCommand
    {
        private IServiceProvider _serviceProvider;

        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
        {
            try
            {
                var doc = commandData.Application.ActiveUIDocument.Document;

                if (!(doc.ActiveView is View3D view))
                {
                    MessageBox.Show("This is not a 3D view");
                    return Result.Cancelled;
                }

                using (Transaction tr = new Transaction(doc))
                {
                    tr.Start("Export doc");
                    try
                    {
                        var ifcExportOptions = new IFCExportOptions {FileVersion = IFCVersion.IFC4};
                        bool res = doc.Export("D:\\temp\\", "ExportDoc.ifc", ifcExportOptions);
                        tr.Commit();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        tr.RollBack();
                        throw;
                    }
                }

                return Result.Succeeded;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return Result.Failed;
            }
        }

 

0 Likes
581 Views
4 Replies
Replies (4)
Message 2 of 5

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @Anonymous ,

Try to export your model in the Revit user interface(without API) and let me know whether you are facing the same problem.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 5

Anonymous
Not applicable
Hi,
Sorry for not mentioning it. Using revit interface exporting works perfect. Tried different models and all of them were good
0 Likes
Message 4 of 5

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @Anonymous ,

I am unable to reproduce the issue in Revit 2019.

As far as I checked, there is no issue reported related to IFC export in Revit 2019. 

 

I have 2 suggestions 

1)Create a new visual studio project and create a new dll. Try IFC export and let me know whether you facing the same issue.

2)Make sure your Revit 2019 updated and is up to date 

https://knowledge.autodesk.com/support/revit-products/troubleshooting/caas/sfdcarticles/sfdcarticles/Released-Revit-2019-Updates-Add-ins.html 

 

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 5 of 5

Anonymous
Not applicable

Ok, i wil try this and report you later as now i can't check it. Thanks!

0 Likes