diff --git a/Elements.Serialization.IFC/src/IFCModelExtensions.cs b/Elements.Serialization.IFC/src/IFCModelExtensions.cs
index 30a1f2bb5..902f75d27 100644
--- a/Elements.Serialization.IFC/src/IFCModelExtensions.cs
+++ b/Elements.Serialization.IFC/src/IFCModelExtensions.cs
@@ -182,18 +182,25 @@ public static void ToIFC(this Model model,
///
/// The model to convert to an IFC document.
/// The stream in which to write the IFC document.
- /// The path to the generated IFC STEP file.
/// Indicates whether UpdateRepresentation should be called for all elements.
-
+ /// Indicates whether the underlying stream should be left open.
+ ///
+ /// This method provides two options for stream handling:
+ /// 1. When the stream is left open for further access (using leaveOpen: true with StreamWriter).
+ /// Users must ensure proper resource management and close the StreamWriter when done.
+ /// 2. When the StreamWriter is closed (default - using leaveOpen: false with StreamWriter), ensuring proper resource cleanup.
+ /// Users can reopen the stream if further access is needed (use stream.Seek(0, SeekOrigin.Begin) to reset the position).
+ ///
public static void ToIFC(this Model model,
MemoryStream stream,
- bool updateElementsRepresentation = true)
+ bool updateElementsRepresentation = true,
+ bool leaveOpen = false)
{
var ifc = CreateIfcDocument(model, updateElementsRepresentation);
- using (var writer = new StreamWriter(stream))
+ using (var writer = new StreamWriter(stream, leaveOpen: leaveOpen))
{
- writer.Write(ifc);
+ writer.Write(ifc.ToSTEP());
}
}
}
-}
\ No newline at end of file
+}