Empty IFC files after exporting with Revit api.
- Dominant language
- C#
- Stars
- 637
- Forks
- 225
- PR merge metrics
- No merged PRs in 30d
Description
I've created the Revit addin that exports 3d views from the working set.
If I am not assign activeViewId to the FilterViewId options, I am getting the whole model in each IFC result with the same size.
If assign I am getting empty files.
It worked fine, but now I have this strange behaviour.
My IFCExportOptions
```
IFCExportOptions options = new IFCExportOptions()
{
FileVersion = IFCVersion.IFC2x3CV2,
ExportBaseQuantities = false,
FilterViewId = ElementId.InvalidElementId,
SpaceBoundaryLevel = 1,
WallAndColumnSplitting = false
};
options.AddOption("Name", "IFC Auto");
options.AddOption("SitePlacement", "1");
options.AddOption("Export2DElements", "true" );
options.AddOption("VisibleElementsOfCurrentView", " true");
options.AddOption("Use2DRoomBoundaryForVolume", "false");
options.AddOption("ExportPartsAsBuildingElements", "true");
options.AddOption("TessellationLevelOfDetail", "3");
options.AddOption("UseActiveViewGeometry", "true");
options.AddOption("IncludeSiteElevation", "true");
options.AddOption("ExportSolidModelRep", "true");
```
Here is a code for export:
using (Transaction trans = new Transaction(doc))
{
foreach (var item in ifcViews)
{
activeViewId = item.Id;
options.FilterViewId = activeViewId;
options.AddOption("ExportIFCCommonPropertySets", "true");
options.AddOption("ActiveViewId", activeViewId.ToString());
trans.Start("ifc export");
try
{
doc.Export(output_path, modelName + "-IFC2x3CV2-" + item.Name, options);
}
catch (Exception ex)
{
trans.RollBack();
}
trans.Commit();
}
}
`
Contributor guide
Research direction
Start with the IFCExportOptions setup and the loop that assigns FilterViewId before calling doc.Export. Reproduce the difference between InvalidElementId and each ifcViews item, then inspect how ActiveViewId and VisibleElementsOfCurrentView are handled. Done means exports consistently contain the expected view elements rather than empty files or the whole model.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100