ImageEn, unit imageenview

TImageEnView.LayersImport

TImageEnView.LayersImport


Declaration

function LayersImport(const FileName: String; Stream: TStream = nil; FileFormat: TIOFileType = ioUnknown; Append: Boolean = False): Integer;


Description

Imports layers from a file or stream in IEV, ALL or DXF format.

Parameter Description
FileName The full path to a file to import (or '' if importing from a stream)
Stream A stream to import from (or nil if importing from file)
FileFormat The type of file, if known. It should be one ioIEV, ioALL or ioDXF. You can also specify ioUnknown, whereby ImageEn will infer the format from the content (with DXF only the file extension is considered)
Append When false the existing content is cleared before importing

Result is -1 in the case of an error, otherwise returns the number of layers added.

IEV and ALL are object formats of TImageEnVect.
Conversion is as follows:
Object Kind Converted To Notes
iekLINE TIELineLayer -
iekBOX TIEShapeLayer -
iekELLIPSE TIEShapeLayer -
iekARC TIEPolylineLayer -
iekBITMAP TIEImageLayer -
iekTEXT TIETextLayer -
iekRULER Skipped -
iekPOLYLINE TIEPolylineLayer -
iekANGLE TIEAngleLayer -
iekMEMO TIETextLayer Text formatting is lost
iekLINELABEL TIELineLayer Inward arrows are converted to outward arrows

DXF is an Autocad vector format. DXF file can only be imported from file and only lines and ellipses objects are supported.


Example

// Import from an IEV file (replacing the existing layers)
ImageEnView1.LayersImport( 'C:\Vect.iev' );

// Import from an IEV file (adding to the existing layers)
ImageEnView1.LayersImport( 'C:\Vect.iev', nil, ioIEV, True );

// Import from an IEV stream (replacing the existing layers)
ImageEnView1.LayersImport( '', myStream );

// Import from an IEV stream (adding to the existing layers)
ImageEnView1.LayersImport( '', myStream, ioIEV, True );

// Import from an Autocad file
ImageEnView1.LayersImport( 'C:\cad.dxf', nil, ioDXF );


See Also

- CopyAllObjectsTo
- LoadFromFileIEN
- LoadFromStreamIEN
- LoadFromFileIEV
- LoadFromStreamIEV
- LoadFromFileAll
- LoadFromStreamAll
- ImportDXF