Table of Contents

Method AddFromStreamEx

Namespace
VectorDraw.Professional.vdCollections
Assembly
VectorDraw.Professional.dll

AddFromStreamEx(string, MemoryStream, bool, MergeTablesFlags)

Creates a block from an in-memory stream containing a serialized VectorDraw document and imports it into the current document according to the specified merge flags.

public vdBlock AddFromStreamEx(string BlockName, MemoryStream stream, bool iscompressed, vdDocument.MergeTablesFlags mergeflags)

Parameters

BlockName string

Base name to assign to the created block. The method appends a newly created handle from the current document to this base name to guarantee uniqueness for the temporary block name used during import.

stream MemoryStream

A MemoryStream that contains the source document data (vdml/vdcl). If the stream is null the method returns null.

iscompressed bool

If true, the stream is treated as compressed(vdcl) when loading the temporary document.

mergeflags vdDocument.MergeTablesFlags

A vdDocument.MergeTablesFlags value that controls how tables (layers, blocks, styles, etc.) from the source document are merged into the current document.

Returns

vdBlock

The created vdBlock imported from the stream, or null if the stream could not be loaded or the import failed.

Remarks

Implementation notes:

See Also

AddFromStreamEx(string, MemoryStream, string, MergeTablesFlags)

Creates a vdBlock by loading a VectorDraw document from an in-memory stream and importing its model into the current document using the specified merge behavior.

public vdBlock AddFromStreamEx(string BlockName, MemoryStream stream, string fileTypeExtension, vdDocument.MergeTablesFlags mergeflags)

Parameters

BlockName string

The base name to assign to the created block in the destination document. This name is passed as-is to AddFromDocument(string, vdDocument, MergeTablesFlags) when performing the import.

stream MemoryStream

A MemoryStream that contains the source document data ( ".vdml",".vdcl",".vds",".vdf",".dxf",".dwg",".dgn",".pdf",".ifc"). If null the method returns null.

fileTypeExtension string

The file type extension to use when loading the stream (for example, ".vdml",".vdcl",".vds",".vdf",".dxf",".dwg",".dgn",".pdf",".ifc"). This value is forwarded to LoadFromStream(Stream, string) when loading the temporary document.

mergeflags vdDocument.MergeTablesFlags

A vdDocument.MergeTablesFlags value that controls how tables (layers, blocks, styles, etc.) from the source document are merged into the current document. See vdDocument.MergeTablesFlags for options such as KeepExisting and Redefine.

Returns

vdBlock

The vdBlock that was imported into the current document, or null if the owning Document is null, the stream could not be loaded, or the import failed.

Remarks

  • Progress events raised by the temporary document while loading are forwarded to the owning document via the document progress callbacks (OnProgress / OnProgressStart / OnProgressStop).
  • The method creates a temporary vdDocument, attempts to load it from the provided stream using the specified fileTypeExtension, and then delegates the import/merge logic to AddFromDocument(string, vdDocument, MergeTablesFlags).
  • If loading the temporary document fails the temporary document is disposed and null is returned.
  • If importing fails, any errors from the import will propagate or be reported by the destination document's error handlers.