Previous IDL Reference Guide: File Format Object Classes Next

IDLffDXF::Write

Syntax | Arguments | Keywords | Examples | Version History

The IDLffDXF::Write function method writes a file for the DXF entity information this object contains.

Syntax

Result = Obj->[IDLffDXF::]Write(Filename)

Return Value

Returns a 1 if successful in writing the file, 0 otherwise.

Arguments

Filename

A scalar string containing the full path and filename of the DXF file to be written.

Keywords

None

Examples

; Write a square to a new DXF file using lines:  
oDXF = OBJ_NEW('IDLffDXF')  
lines = {IDL_DXF_POLYLINE}  
lines.dxf_type = 4  
lines.layer='myLayer'  
lines.thickness = 1.0  
  
; Create clockwise square:  
lines = REPLICATE(lines, 4)     
lines[0].vertices = PTR_NEW([[0.0,0.0,0.0], $  
     [0.0,1.0,0.0]])  
lines[0].connectivity = PTR_NEW([0,1])  
lines[1].vertices = PTR_NEW([[0.0,1.0,0.0], $  
    [1.0,1.0,0.0]])  
lines[1].connectivity = PTR_NEW([0,1])  
lines[2].vertices = PTR_NEW([[1.0,1.0,0.0], $  
    [1.0,0.0,0.0]])  
lines[2].connectivity = PTR_NEW([0,1])  
lines[3].vertices = PTR_NEW([[1.0,0.0,0.0], $  
    [0.0,0.0,0.0]])  
lines[3].connectivity = PTR_NEW([0,1])  
oDXF->PutEntity, lines  
IF (not oDXF->Write('mySquare.dxf')) THEN $  
   PRINT, 'Write Failed.'  
   ; Clean up the memory in the structs:  
   OBJ_DESTROY, oDXF  
   FOR i=0,3 DO BEGIN  
      PTR_FREE, lines[i].vertices, lines[i].connectivity  
ENDFOR  

Version History

5.2
Introduced

  IDL Online Help (March 06, 2007)