Quantcast
Channel: All Revit API Forum posts
Viewing all articles
Browse latest Browse all 66665

RationalBSplineSurface Issue of Exporting IFC4DTV through Revit API

$
0
0

Dear Revit experts, 

 

I encountered a problem when exporting .ifc file by using Revit API. Whenever I export a .ifc file from a Revit project which has an NURBS surface, the result is always unsatisfying. 

 

I specify IFC file version to IFC 4 Design Transfer View, so NURBS surface can be represented in the "IFCRATIONALBSPLINESURFACEWITHKNOTS" entities. 

 

Here is my C# code:

 

namespace Revit_IFC_Export_API_Test
{
    [Transaction(TransactionMode.Manual)]
    public class Command : IExternalCommand
    {
        public Result Execute(
          ExternalCommandData commandData,
          ref string message,
          ElementSet elements)
        {
            UIApplication uiapp = commandData.Application;
            UIDocument uidoc = uiapp.ActiveUIDocument;
            Application app = uiapp.Application;
            Document doc = uidoc.Document;

            using (Transaction tx = new Transaction(doc))
            {
                tx.Start("IFC4DTV Export");

                string path = @"C:\Program Files\IfcTools\edm_validate";
                string fileName = "Revit_API_ExportTest.ifc";

                IFCExportOptions exportOptions = new IFCExportOptions();

                exportOptions.FileVersion = IFCVersion.IFC4DTV;
                exportOptions.ExportBaseQuantities = false;
                exportOptions.WallAndColumnSplitting = false;
                exportOptions.SpaceBoundaryLevel = 1;

                bool result = doc.Export(path, fileName, exportOptions);

                if (result)
                    TaskDialog.Show("File Exported", "Revit_API_ExportTest.ifc is successfully exported!");
                else
                    TaskDialog.Show("Error", "Error happen when exporting files!");

                tx.Commit();
            }



            return Result.Succeeded;
        }
    }
}

 

For example, I drew a wall and a box with NURBS surface in Revit, and exported them to IFC file through my code above. From the IFCPlusPlus IFC viewer, we can see the box with NURBS surface is missing. In fact, I tested it with many different cases, and they all failed; whenever I have NURBS surface, the exporter function does not work properly.

 

However, If I export them using IFC2x3 or IFC4 IFCVersion, then the function turns all NURBS surfaces into triangle Mesh, which is the case I would like to avoid. 

RevitWallNurbsBox.PNGRevitWallNurbsBoxIFC.PNG

 

I used open source validation tools provided by Arne Tøn, and I got the following error message: IFC exported through Revit API is violate some rules compared to IFC4_ADD2.exp Express file. Briefly speaking, "IFCRATIONALBSPLINESURFACEWITHKNOTS" is not defined properly.

 

RevitWallNurbsBoxValidate.PNG

 

I am wondering if I did some mistake in the C# code or API export function have some bugs? How can I fix this mistake so NURBS surface can be exported correctly from Revit? 

 

If someone wants to see the IFC file and the validation log, those files can be found in the attachment. 

 

Thanks a lot, any feedback will be really appreciated.

 

Best, 

 

Gene

 

 

 

 

 

 

 

 

 


Viewing all articles
Browse latest Browse all 66665

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>