readDXF

Synopsis

The readDXF user macro reads DXF format files.

Parameters

Name Type Description UI Control

file_name string Name of DXF file to read. File Dialog
reverse_normals boolean Specifies if read normals should be reversed. Check Box
fill_polygons boolean Specifies if polygons should be filled or outlined. Check Box
layers int[] DXF layers that should be output Check Boxes

Output Ports

Name Type Description

out_flds Field[] Array of layers read from DXF file.
out_geom GroupObject Renderable geometry object
out_text GroupObject Renderable text object

Description

The DXF file format was created by AutoDesk so that drawing information could be transferred between AutoCad and other applications. The DXF acronym actually stands for Drawing eXchange Format. DXF files can be of two types, binary and the more common ASCII formats. The readDXF user macro allows AVS/Express to read data from an ascii DXF file and output it as an array of field data. The DXF format can contain a number of layers of information. Each of these are read into a separate field in the output array. The user can select which layers should be output. The user can also specify whether polygons should be filled and whether normals should be reversed.

Parameters

file_name

String parameter that specifies which DXF file should be read. The file_name string should contain the full path name of the file and can contain any of the AVS/Express environment variables (e.g. $XP_PATH<1>)

reverse_normals

Boolean parameter that specifies if the normals read from the DXF file should be reversed. The data in a 3D model should be arranged so that normal vectors point outwards, away from the solid mass of the model. However it is quite common to find files where the normals been mistakenly written so that they point inwards. This parameter allows the user to correct this problem. If you notice that the lighting on the loaded DXF file does not look correct you should try setting this parameter.

fill_polygons

Boolean parameter that specifies if polygons should be output as filled shapes or as outlines.

layers[]

Array of integers that specifies which layers read from the DXF file should be output to the field and renderable object outputs. The array should contain a list of index numbers that specifies which layers should be selected. Hence the array {0,1,2} specifies that only the first three layers should be output. This kind of array is output by the UIoptionBoxLabel component. Each time the DXF file is read the layers array is reset so that all layers are output. Internally an ExtractObjectsCore module processes this parameter.

Outputs

out_flds[]

Array of fields containing the geometry data read from the specified DXF file. Each specified layer is read into a separate field in the array.

out_geom

The GroupObject version of the geometry output, suitable for direct connection to the viewer. It contains the array of fields present on the out_flds output port. The transform of each child DataObject is matched to the transformation of the parent GroupObject.

out_text

A GroupObject that represents the text read from the DXF file. This output is suitable for direct connection to the viewer. The transform of each child DataObject is matched to the transformation of the parent GroupObject.

Utility Macros

The ReadDXFFunc functional macro uses the low-level ReadDXFCore module. It also uses the ExtractObjectsCore module and the cat_cell_sets macro. The ExtractObjectsCore module is used to select the appropriate layers from the ReadDXFCore output. The cat_cell_sets macro is used because ReadDXFCore module outputs field data with a large number of cell sets. To improve performance the cat_cell_sets macro is used to reduce the number of cell sets output.

The ReadDXFFunc functional macro and the ReadDXF_UI user interface macro are used by the readDXF user macro. All of these macros use the ReadDXFParams parameter block to communicate data.

Example

The project includes two example applications that demonstrates the use of the readDXF macro. The ReadDXFEg application uses the readDXF macro to read a DXF file containing a model of an aeroplane. The ReadDXFExtractEg application extends the ReadDXFEg application by extracting fields from the output and performing mesh visualization on them.

Files

iac_proj/rd_dxf/rdxfmods.v contains the V definition of the ReadDXFCore module and the ReadDXFParams parameter block.

iac_proj/rd_dxf/rdxfmacs.v contains the V definitions of the ReadDXF_UI UI macro, the ReadDXFFunc functional macro and the readDXF user macro.

iac_proj/rd_dxf/rdxfapps.v contains the V definition of the ReadDXFEg example application.

Prerequisites

This project requires the following components to be installed correctly. Without these components the project will not work.

Other Notes

The low-level ReadDXFMods library containing the ReadDXFCore module does not specify a process. By default the express process will be used.

Authors

Peter Stark
Stephen Marsland
Margaret Wood
Anja Bindrich

Modifications

Andrew Dodd,
International AVS Centre

Contact

International AVS Centre
Manchester Visualization Centre
Manchester Computing
University of Manchester
Oxford Road
Manchester
United Kingdom
M13 9PL

See Also