Table of Contents

Method AddFromFile

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

AddFromFile(string, bool)

Creates a vdBlock from the specified file and adds it to this collection.

public vdBlock AddFromFile(string FileName, bool redefine)

Parameters

FileName string

The path to the file from which model entities for the block will be taken.

redefine bool

If true and a block with the same name already exists in this document, the existing block will be redefined (replaced) by the block imported from the file. If false, an existing block with the same name will be preserved (kept) and returned — in that case the existing block is un-deleted if necessary.

Returns

vdBlock

The vdBlock that was created or found in this collection. Returns null if the file could not be opened or the import failed.

Remarks

This overload maps the boolean redefine to a vdDocument.MergeTablesFlags value:

The method delegates the actual import work to AddFromFile(string, MergeTablesFlags).
See Also

AddFromFile(string, MergeTablesFlags)

Creates a vdBlock object from a file.

public vdBlock AddFromFile(string FileName, vdDocument.MergeTablesFlags mergeflags)

Parameters

FileName string

The full path to the source file from which model entities for the block will be taken.

mergeflags vdDocument.MergeTablesFlags

A vdDocument.MergeTablesFlags value that controls how tables (layers, blocks, styles, etc.) with the same name are merged into the current document. For example:

  • KeepExisting - keep existing tables in the destination document and skip replacing them.
  • Redefine - replace destination tables with those from the source.

Returns

vdBlock

The vdBlock that was created or found in this collection. If a block with the same name already exists and mergeflags is KeepExisting, the existing block is returned (and un-deleted). If the file cannot be opened or no block is created, the method returns null.

Remarks

This method:

AddFromFile(string, string, MergeTablesFlags)

Creates a vdBlock object from a file.

public vdBlock AddFromFile(string blockname, string FileName, vdDocument.MergeTablesFlags mergeflags)

Parameters

blockname string

The name to assign to the created block. If an empty string is provided, a new unnamed block is created.

FileName string

The full path to the source file from which model entities for the block will be taken.

mergeflags vdDocument.MergeTablesFlags

A vdDocument.MergeTablesFlags value that controls how tables (layers, blocks, styles, etc.) with the same name are merged into the current document. For example:

  • KeepExisting - keep existing tables in the destination document and skip replacing them.
  • Redefine - replace destination tables with those from the source.

Returns

vdBlock

The vdBlock that was created or found in this collection. If a block with the same name already exists and mergeflags is KeepExisting, the existing block is returned (and un-deleted). If the file cannot be opened or no block is created, the method returns null.

Remarks

This method: