Table of Contents

Method ImportFromFile

Namespace
VectorDraw.Professional.vdObjects
Assembly
VectorDraw.Professional.dll

ImportFromFile(string)

Imports the specified file into this vdDocument.

public bool ImportFromFile(string filename)

Parameters

filename string

Full path to the file to import. Can be a DWG, DGN, DXF, IFC, DWF, STEP OBJ PLY SKP STA STL , image formats (bmp jpg tiff png), PDF, RTF, LAS/PointCloud, metafile or a supported script/web format.

Returns

bool

true when the file was successfully imported and the document was updated; otherwise false.

Remarks

This method will examine the provided filename and select the correct import path depending on SupportPath :

  • If the extension is a new vdraw format (e.g. .vdcl or .vdml) the method delegates to Open(string).
  • For VDraw web/script formats it calls ImportScript(string).
  • For LAS/point-cloud files it creates and imports a vdPointCloud.
  • For metafiles and supported raster images it creates a vdImageDef and inserts a vdImage into the model (behavior depends on EMFImportProperties).
  • For .rtf files it will create a vdMText and populate it from the RTF contents.
  • For PDF files (when PDF import-as-underlay is enabled) it creates image definitions for PDF pages and adds them to layouts.

Side effects: - May modify document state (model entities, images, layouts, current filename, external references). - Temporarily disables redraw and freezes actions; modifies undo history settings during import. - Calls FindFile(string, out string) to locate files and may call VectorDraw.Professional.vdObjects.vdDocument.RaiseOnBeforeOpenDocument(VectorDraw.Professional.vdObjects.vdDocument) and RaiseOnAfterOpenDocument(vdDocument).

Error handling: The method will not throw for unsupported formats or file-not-found scenarios; instead it uses RaiseGenericError(string, string) and returns false. Unknown file types may trigger VectorDraw.Professional.vdObjects.vdDocument.FireLoadUnknownFileName(System.Object,System.String,System.Boolean@).

Note: This operation is not thread-safe and should be invoked from the UI thread or from code that ensures exclusive access to this document.

Open(string) IsvalidOpenFormat(string) ImportScript(string)