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.
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.
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
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.
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.
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
Dear Gene,
Thank you for your detailed report and analysis.
I passed it on to the development team for further exploration.
They will almost certainly ask for a full reproducible case:
http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b
Can you provide that, please, while we wait for a response?
Thank you!
Cheers,
Jeremy
Dear Gene,
Thank you for your detailed report and analysis.
I passed it on to the development team for further exploration.
They will almost certainly ask for a full reproducible case:
http://thebuildingcoder.typepad.com/blog/about-the-author.html#1b
Can you provide that, please, while we wait for a response?
Thank you!
Cheers,
Jeremy
Dear Jeremy,
Thank you so much for your fast and helpful response!
Files for the reproducible case are in the attachment,
Folder contains:
1. Revit_IFC_Export_API_Test: this is the VS solution file.
2. RevitFile: Revit file and family file which has free-form surface.
3. Exported IFC File: IFC4 file exported from the add-in.
4. Validation Result: a validation result I generated. It contains error messages.
The workflow can be seen as below:
1. Open the Revit_IFC_Export_API_Test and compile it. The code is simple, just using the Document.Export function in API and some of the IFCExportOptions are specified.
2. Open Revit_IFC_Export_API_Test.rvt in RevitFile.
3. I use Add-In Manager, so I loaded the .dll file which is compiled from the solution. which is in the folder Revit_IFC_Export_API_Test\bin\Debug\Revit_IFC_Export_API_Test.dll
After the IFC file is successfully exported, we will see this message.
4. In the folder "Exported IFC File" we can see the IFC4 DTV file. By opening it with ifcPlusPlus, we can see the box is gone.
I hope this is clear enough. 🙂 Thank you!
Cheers,
Gene
Dear Jeremy,
Thank you so much for your fast and helpful response!
Files for the reproducible case are in the attachment,
Folder contains:
1. Revit_IFC_Export_API_Test: this is the VS solution file.
2. RevitFile: Revit file and family file which has free-form surface.
3. Exported IFC File: IFC4 file exported from the add-in.
4. Validation Result: a validation result I generated. It contains error messages.
The workflow can be seen as below:
1. Open the Revit_IFC_Export_API_Test and compile it. The code is simple, just using the Document.Export function in API and some of the IFCExportOptions are specified.
2. Open Revit_IFC_Export_API_Test.rvt in RevitFile.
3. I use Add-In Manager, so I loaded the .dll file which is compiled from the solution. which is in the folder Revit_IFC_Export_API_Test\bin\Debug\Revit_IFC_Export_API_Test.dll
After the IFC file is successfully exported, we will see this message.
4. In the folder "Exported IFC File" we can see the IFC4 DTV file. By opening it with ifcPlusPlus, we can see the box is gone.
I hope this is clear enough. 🙂 Thank you!
Cheers,
Gene
Dear Gene,
Thank you for your detailed explanation and reproducible case.
I escalated this thread to an ADN case 12373012 [RationalBSplineSurface Issue of Exporting IFC4DTV through Revit API] and logged the issue REVIT-103194 [API: export RationalBSplineSurface to IFC4DTV fails -- 12373012] with our development team for this on your behalf as it requires further exploration and possibly a modification to our software. Please make a note of this number for future reference.
You are welcome to request an update on the status of this issue or to provide additional information on it at any time quoting this change request number.
This issue is important to me. What can I do to help?
This issue needs to be assessed by our engineering team, and prioritised against all of the other outstanding change requests. Any information that you can provide to influence this assessment will help. Please provide the following where possible:
This information is extremely important. Our engineering team have limited resources, and so must focus their efforts on the highest impact items. We do understand that this will cause you delays and affect your development planning, and we appreciate your cooperation and patience.
I hope this helps.
Best regards,
Jeremy
Dear Gene,
Thank you for your detailed explanation and reproducible case.
I escalated this thread to an ADN case 12373012 [RationalBSplineSurface Issue of Exporting IFC4DTV through Revit API] and logged the issue REVIT-103194 [API: export RationalBSplineSurface to IFC4DTV fails -- 12373012] with our development team for this on your behalf as it requires further exploration and possibly a modification to our software. Please make a note of this number for future reference.
You are welcome to request an update on the status of this issue or to provide additional information on it at any time quoting this change request number.
This issue is important to me. What can I do to help?
This issue needs to be assessed by our engineering team, and prioritised against all of the other outstanding change requests. Any information that you can provide to influence this assessment will help. Please provide the following where possible:
This information is extremely important. Our engineering team have limited resources, and so must focus their efforts on the highest impact items. We do understand that this will cause you delays and affect your development planning, and we appreciate your cooperation and patience.
I hope this helps.
Best regards,
Jeremy
Hi Gene,
If objects are "lost" when using an IFC file, it's possible the problem is either at the source (exporter) or the importer.
In this case, I'd suggest it's ifcplusplus not recognizing the advanced brep shape representation, it seems Revit exports this fine to me.
I've attached an image when I import into Rhino with my Geometry Gym plugin (http://www.geometrygym.com/downloads)
You can also use utilities such as my tree viewer to inspect the IFC file contents.
Hope this helps in some way,
Jon
Hi Gene,
If objects are "lost" when using an IFC file, it's possible the problem is either at the source (exporter) or the importer.
In this case, I'd suggest it's ifcplusplus not recognizing the advanced brep shape representation, it seems Revit exports this fine to me.
I've attached an image when I import into Rhino with my Geometry Gym plugin (http://www.geometrygym.com/downloads)
You can also use utilities such as my tree viewer to inspect the IFC file contents.
Hope this helps in some way,
Jon
Dear Jon,
Thank you for very much for explaining and confirming that it works.
The development team also responded to the issue REVIT-103194 [API: export RationalBSplineSurface to IFC4DTV fails -- 12373012] that I raised for this and say:
It cannot be an API issue, because the Revit IFC Export (API overrides) export the RationalBSplinesurface to IFC4 successfully, c.f. image below.
Please refer to the attachments "ok_Revit_IFC_Export_API_Test_RevitIFCExport.ifc" and "ok_RevitIFCExport_withNurbsFaces.png".
There are "IFCRATIONALBSPLINESURFACEWITHKNOTS" entities in the .ifc file.
I am closing the issue REVIT-103194 again now.
Best regards,
Jeremy
Dear Jon,
Thank you for very much for explaining and confirming that it works.
The development team also responded to the issue REVIT-103194 [API: export RationalBSplineSurface to IFC4DTV fails -- 12373012] that I raised for this and say:
It cannot be an API issue, because the Revit IFC Export (API overrides) export the RationalBSplinesurface to IFC4 successfully, c.f. image below.
Please refer to the attachments "ok_Revit_IFC_Export_API_Test_RevitIFCExport.ifc" and "ok_RevitIFCExport_withNurbsFaces.png".
There are "IFCRATIONALBSPLINESURFACEWITHKNOTS" entities in the .ifc file.
I am closing the issue REVIT-103194 again now.
Best regards,
Jeremy
Dear Jeremy and Jon,
Thank you very much and I am sorry for my late response, I wasn't able to use my computer for couple days.
I understand that the possibilities of the problem coming from other software's import function, so I will try to contact ifcplusplus team as well.
However, I still have some problem using the "ok_Revit_IFC_Export_API_Test_RevitIFCExport.ifc" file which Jeremy provided. Since I am a newbie of Revit, maybe I did something wrong, please point it out if I made some stupid mistakes.
1. Open the IFC file.
2. Top View after importing IFC file.
3. 3D View after importing IFC file.
4. In case something is missing, press "vv" to show all the hidden objects, I checked everything, includes "mass".
5. Still box is not showing in my screen.
Jeremy, can you show me how you reach up to the step of the screen that you have? I am wondering if I missed something...
I also import the IFC file through Solibri model checker and FZK viewer, neither of them works.
And since Solibri and FZK view are suggested on BuildingSmart website, http://www.buildingsmart.de/bim-know-how/software/ifc-viewer, it is weird that they all don't import IFC4 correctly.
Solibri Model Checker
FZK Viewer with validation.
Thank all of your patient replies.
Cheers,
Gene
p.s. about Jeremy's request:
Impact on your application and/or your development.
The number of users affected.
The potential revenue impact to you.
The potential revenue impact to Autodesk.
Realistic timescale over which a fix would help you.
In the case of a request for a new feature or a feature enhancement, please also provide detailed Use cases for the workflows that this change would address.
I will provide those information once we make sure the error was not due to my very limited Revit skill and my stupid mistakes. lol.
Dear Jeremy and Jon,
Thank you very much and I am sorry for my late response, I wasn't able to use my computer for couple days.
I understand that the possibilities of the problem coming from other software's import function, so I will try to contact ifcplusplus team as well.
However, I still have some problem using the "ok_Revit_IFC_Export_API_Test_RevitIFCExport.ifc" file which Jeremy provided. Since I am a newbie of Revit, maybe I did something wrong, please point it out if I made some stupid mistakes.
1. Open the IFC file.
2. Top View after importing IFC file.
3. 3D View after importing IFC file.
4. In case something is missing, press "vv" to show all the hidden objects, I checked everything, includes "mass".
5. Still box is not showing in my screen.
Jeremy, can you show me how you reach up to the step of the screen that you have? I am wondering if I missed something...
I also import the IFC file through Solibri model checker and FZK viewer, neither of them works.
And since Solibri and FZK view are suggested on BuildingSmart website, http://www.buildingsmart.de/bim-know-how/software/ifc-viewer, it is weird that they all don't import IFC4 correctly.
Solibri Model Checker
FZK Viewer with validation.
Thank all of your patient replies.
Cheers,
Gene
p.s. about Jeremy's request:
Impact on your application and/or your development.
The number of users affected.
The potential revenue impact to you.
The potential revenue impact to Autodesk.
Realistic timescale over which a fix would help you.
In the case of a request for a new feature or a feature enhancement, please also provide detailed Use cases for the workflows that this change would address.
I will provide those information once we make sure the error was not due to my very limited Revit skill and my stupid mistakes. lol.
Hi Gene,
Try linking the ifc into another project and it is visible. https://danielgijsbers.blogspot.com.au/2014/03/revit-2015-and-ifc-linking.html
I'd consider the file open absence a bug, as Revit gives no warning that it has ignored or misunderstood the shape representation (that I can see, including the log).
Note that typically software supporting IFC only implement a subset of IFC, commonly referred to as a model view definition.
http://www.buildingsmart-tech.org/specifications/ifc-view-definition/ifc4-design-transfer-view
Actually the Design transfer view doesn't support rational b splines (unless I'm misread the supported entities list http://www.buildingsmart-tech.org/mvd/IFC4Add1/DTV/1.0/html/link/alphabeticalorder-entities.htm ) which is a puzzle noting that non-rational entities are (http://www.buildingsmart-tech.org/mvd/IFC4Add1/DTV/1.0/html/link/ifcbsplinesurfacewithknots.htm ). I'd suggest this should be raising a request on the building smart jira that this be included.
http://jira.buildingsmart.org/secure/Dashboard.jspa
So maybe the viewers you are trying are not recognizing the shape representation as it's beyond the model view definition, or perhaps they just don't recognize b splines. Even though IFC4 was released 3 years ago, implementations of IFC4 are still largely in their infancy. Certification testing which is due to start soon might help improve the situation.
I hope this helps further,
Jon
Hi Gene,
Try linking the ifc into another project and it is visible. https://danielgijsbers.blogspot.com.au/2014/03/revit-2015-and-ifc-linking.html
I'd consider the file open absence a bug, as Revit gives no warning that it has ignored or misunderstood the shape representation (that I can see, including the log).
Note that typically software supporting IFC only implement a subset of IFC, commonly referred to as a model view definition.
http://www.buildingsmart-tech.org/specifications/ifc-view-definition/ifc4-design-transfer-view
Actually the Design transfer view doesn't support rational b splines (unless I'm misread the supported entities list http://www.buildingsmart-tech.org/mvd/IFC4Add1/DTV/1.0/html/link/alphabeticalorder-entities.htm ) which is a puzzle noting that non-rational entities are (http://www.buildingsmart-tech.org/mvd/IFC4Add1/DTV/1.0/html/link/ifcbsplinesurfacewithknots.htm ). I'd suggest this should be raising a request on the building smart jira that this be included.
http://jira.buildingsmart.org/secure/Dashboard.jspa
So maybe the viewers you are trying are not recognizing the shape representation as it's beyond the model view definition, or perhaps they just don't recognize b splines. Even though IFC4 was released 3 years ago, implementations of IFC4 are still largely in their infancy. Certification testing which is due to start soon might help improve the situation.
I hope this helps further,
Jon
Dear Jeremy,
thank you for your quick reply, it is very much appreciated.
Gene is now on holidays, which means that we cannot be sure if and when he will answer.
I have validated his IFC test file (attached above) with two different IFC validation programs (FZK and EDM). All of them show errors compared to IFC4 add2, their reports are attached as well.
This means that for the test file, the Revit export does not create an IFC file. It is not in the responsibility of other software programs to be able to read files that do not follow the express specification provided by buildingSMART.
The problem is now again identified as a Revit issue.
Could we please discuss the topic directly via e-mail? This would simplify the procedure very much. Thank you.
Best regards
Wendelin
Dear Jeremy,
thank you for your quick reply, it is very much appreciated.
Gene is now on holidays, which means that we cannot be sure if and when he will answer.
I have validated his IFC test file (attached above) with two different IFC validation programs (FZK and EDM). All of them show errors compared to IFC4 add2, their reports are attached as well.
This means that for the test file, the Revit export does not create an IFC file. It is not in the responsibility of other software programs to be able to read files that do not follow the express specification provided by buildingSMART.
The problem is now again identified as a Revit issue.
Could we please discuss the topic directly via e-mail? This would simplify the procedure very much. Thank you.
Best regards
Wendelin
Dear Wendelin,
Thank you for your appreciation.
I would suggest that you contact our IFC expert Angel Velez directly.
I cannot do more than pass your messages on to him and vice versa, so obviously it will be much more efficient for you to communicate with him directly instead.
His contact details are given in the materials for his Autodesk University class on IFC:
http://thebuildingcoder.typepad.com/blog/2016/11/au-day-two-ifc-and-revit-api-panel.html#2
You can also discuss directly with him via the IFC open source SourceForge project discussion forum:
https://sourceforge.net/p/ifcexporter
That might be better still.
Best regards,
Jeremy
Dear Wendelin,
Thank you for your appreciation.
I would suggest that you contact our IFC expert Angel Velez directly.
I cannot do more than pass your messages on to him and vice versa, so obviously it will be much more efficient for you to communicate with him directly instead.
His contact details are given in the materials for his Autodesk University class on IFC:
http://thebuildingcoder.typepad.com/blog/2016/11/au-day-two-ifc-and-revit-api-panel.html#2
You can also discuss directly with him via the IFC open source SourceForge project discussion forum:
https://sourceforge.net/p/ifcexporter
That might be better still.
Best regards,
Jeremy
Can't find what you're looking for? Ask the community or share your knowledge.