Sunteți pe pagina 1din 12

Advanced IT Applications & Consultancy

AITAC B.V.
http://www.aitac.nl Guido Gezellelaan 10
phone: +31 6 21 53 87 65 2182 WC Hillegom
or: +31 6 51 52 47 01 The Netherlands

Catia 3D to/from DXF


(AutoCAD / Microstation)
2-way interface

AITAC B.V.
paul.van.der.zande@aitac.nl

December 7, 2004

AITAC B.V. Catia 3D interface to/from DXF Page 1 of 12


Table of Contents
1 Introduction ........................................................................................................................3
2 Installation..........................................................................................................................3
2.1 Prerequisites ...............................................................................................................3
2.2 Adding the software module to the environment (steplib) ...........................................4
2.3 Declarations ................................................................................................................4
2.3.1 Quickly setting up the declarations .......................................................................4
2.3.2 Declaration for the AEC_DXF function key...........................................................5
2.3.3 Declaring Message files........................................................................................5
2.3.4 Declaring ABA API’s .............................................................................................5
2.3.5 Declaring Output Directory ...................................................................................6
2.3.6 Declaration for quads............................................................................................6
2.3.7 What if you don’t run Catia AEC? .........................................................................6
3 Mapping tables...................................................................................................................7
3.1 Mapping table for EXPORT.........................................................................................7
3.2 Mapping table for IMPORT..........................................................................................7
4 Executing the interface ......................................................................................................8
4.1 Export ..........................................................................................................................8
4.2 Import ........................................................................................................................10
5 AutoCAD manipulations to validate the export ................................................................11
5.1 Importing the file in Autocad......................................................................................11
5.2 Manipulating the view in Autocad..............................................................................11
5.3 Render the model in Autocad....................................................................................11
5.4 Hidden Line model in Autocad ..................................................................................11
5.5 Save the model in Autocad .......................................................................................11
5.6 Then in Autocad ........................................................................................................11
6 Potential Improvements ...................................................................................................12

Revision Description By Date


1 First release Paul van der Zande 01-November-2001
2 Advices PTF’s for RF01 RF03 Paul van der Zande 31-December-2003
added.
3 Minor update of manual Paul van der Zande 13-January-2004
4 Explanation of use of declaration Paul van der Zande 18-April-2004
to call old APIs (for version prior
to 424RF01/RF03)
5 Update of options to export Paul van der Zande 20-July-2004
polynomial curves
6 Support of DXF import Paul van der Zande 21-November-2004
7 Option to invert the normal Paul van der Zande 7-December-2004
vector on facets for some DXF
files

AITAC B.V. Catia 3D interface to/from DXF Page 2 of 12


1 Introduction
This document describes the installation, configuration and use of the interface between
Catia V4 3D data and Autocad and Microstation (and others, such as 3D studio Max
Visualization software) using DXF.

The export interface is a Catia V4 GII program that will:


• allow the user to select mechanical elements (points, lines, curves, circles, faces,
surfaces, exact solids, mockup solids).
• AEC objects (piping, HVAC, equipments, SHD (AEC mode or free part mode),
raceway, STF elements).
• prompt for a name of the file to generate and settings
• process the selected elements.
The ascii file has then to be transferred by the user to the Windows PC where AutoCAD
and/or Microstation is running (files can get very big, so you may want to zip first).

The import interface is a Catia V4 GII program that will:


• allow the user to select a DXF file.
• define a dX,dY,dZ translation
• import the DXF file.

2 Installation
2.1 Prerequisites
The program runs on AIX only, on the following levels:
424RF01 (provided the PTF’s corresponding to APAR: HC88597, HC88695, HC92492,
HC90491, HD03848 are installed).
424RF03 (provided the PTF’s corresponding to APAR: HC97895, HD00961, HD04398,
HD03577, HD02645 are installed).
The program runs also on Catia 421 and 422, but a special declaration has to be set.

The administrator should be familiar with:


ABA (AEC Base) product:
• UNIX
• Environment variables
• Declarations

AITAC B.V. Catia 3D interface to/from DXF Page 3 of 12


2.2 Adding the software module to the environment (steplib)
The module named: AECDXF is to be placed in the steplib of CATIA. It is to be compared to
a dll (Dynamic Link Library) on Windows.
If no AEC license (AEC Base) license is available, the module MECDXF can be installed (it
requires a COM and SOLIDE license as prerequisite before starting the function).

There are two options to achieve this:

First option is to define a new directory, for example a directory local to the project :
$PROJ_LOC/steplib/AIX or local to the reference site: $CAT_SITE/steplib/AIX

This directory must be defined using the environment variable : STEPLIB


So in the environment file for the project (typically located in $CAT_CUST/env), add the
following lines to the end of the file :
STEPLIB=$PROJ_LOC/steplib/AIX :$STEPLIB
LIBPATH=$PROJ_LOC/steplib/AIX :$LIBPATH

Place the module in that directory; the module must be readable for all users:
chmod a+r AECDXF

Note: if you don’t want to use the above mentioned directory, you can find out which existing
directories can be used to place the module. To do so, use following command:
catpath –l -A STEPLIB
It will list the directories that are taken into account when loading the module (e.g.
$CAT_CUST/code/steplib/AIX).

2.3 Declarations
2.3.1 Quickly setting up the declarations
In order to quickly set up the declarations, you can do the following. If your master
declaration file is pointing to a central declaration file which is accessible by all users, then
add the following 2 lines to the end of this file:

include(‘$CAT_SITE/dec/DXF.dcls’) ;

Note that the master declaration file is defined by the environment variable : CATMSTR

If your master declaration file is not pointing to a central declaration file (e.g. it is pointing to
$HOME/USRENV.dcls), do the following:
Change the value of CATMSTR to: $PROJ_LOC/dec/SHIP1.dcls, then create this file, and
add the line described above. If you still want to include the USRENV.dcls in the home
directories of the users, also add the line:
include (‘$HOME/USRENV.dcls’);

You will still have to modify the values of declarations in DXF.dcls, but most of the work is
done.

Other ways to quickly set up the declarations:


- copy/paste the respective declarations into $CAT_SITE/CATDXF.dcls

AITAC B.V. Catia 3D interface to/from DXF Page 4 of 12


2.3.2 Declaration for the AEC_DXF function key
The function AEC_DXFis an interactive (GII) function. The following declaration is defining
the function key:

/* function AEC_DXF */
CATCMD.FUNCTION.NAME.AECDXF = 'AEC_DXF';
CATCMD.FUNCTION.LOAD3D.AECDXF = 'AECDXF';
CATCMD.FUNCTION.MODSPACE.AECDXF = TRUE;

If you already have a function ‘AEC_DXF’ or you already have a module AECDXF, you can
use different names (don’t forget to rename the file AECDXF).

If you (re-)start CATIA, you will be able to find the function key in the list of available
functions if the declaration is done correctly, and CATIA could find the module AECDXF
during the startup. The function will not work correctly however until the message files have
been installed.

2.3.3 Declaring Message files


There are 2 message files (1 help file, 1 error file) supplied:
DXFHELP.msg = help file for the function AEC_DXF
DXFERROR.msg = error file for the function AEC_DXF

The 3 files have to be placed in a declared directory. For example:


/* error and message files for AECDXF */
CATIA.MESSAGE = '$PROJ_LOC/msg';
or
CATIA.MESSAGE = ‘$CAT_SITE/msg’;

2.3.4 Declaring ABA API’s


By default the software uses ABA API’s. In the case you are not running version 424RF01 or
RF03 with the PTF’s mentioned (e.g. 421RF01 or 422RF01) , you get an abend. In that case
you could try to tell the software to use solide API’s:

/* To use SOLIDE API’s */


CATDXF.SETUP.DXF.ABA_API : INTEGER;
CATDXF.SETUP. DXF.ABA_API = 0 ;
/* */

The following declaration is optional (default). It allows to run without SOLIDE license.
/* To use ABA API’s */
CATDXF.SETUP.DXF.ABA_API : INTEGER;
CATDXF.SETUP. DXF.ABA_API = 1 ;
/* */

If you use SOLIDE API’s you need to have the SOLIDE (SOE, SBP, SBD, etc) license
allocated to yourself before starting the conversion.

AITAC B.V. Catia 3D interface to/from DXF Page 5 of 12


2.3.5 Declaring Output Directory
The directory where the results will be stored (the user can select another directory) needs to
be declared. An example is given below:

/* directory with DXF output results */


CATAEC.DATA.DXF.OUTPUT_DIR : STRING;
CATAEC.DATA.DXF.OUTPUT_DIR = '$PROJ_LOC/data/DXF/output';
/* */

Note: if you have one fixed directory for all projects, you can use $CAT_SITE instead of
$PROJ_LOC.

2.3.6 Declaration for quads


By default the software uses triangular and quad elements to tessellate 3D objects. Some
software however only accepts triangular description of elements. In that case you can force
the AEC_DXF function to generate only triangular elements:

/* declarations for quads. If zero then only triangular */


/* elements are created, if 1 then quads are created also */
/* this takes a little more time, but DXF file is smaller */
CATDXF.SETUP.DXF.QUADS : INTEGER;
CATDXF.SETUP.DXF.QUADS = 1;

2.3.7 What if you don’t run Catia AEC?


If you don’t run Catia AEC, but you run Catia Mechanical, then you don’t have ABA installed.
In that case you need a COM and a SOLIDE license (SOE, SBP, SBD, ADD) and you have
to take the following steps:

a) install the module: MECDXF instead of AECDXF


b) declare this function:
/* function MEC_DXF */
CATCMD.FUNCTION.NAME.MECDXF = 'MEC_DXF';
CATCMD.FUNCTION.LOAD3D.MECDXF = 'MECDXF';
CATCMD.FUNCTION.MODSPACE.MECDXF = TRUE;

Be sure to always allocate the SOLIDE license before you start the function (the function will
never access the ABA API’s of course).

Congratulations, you have now successfully installed the software.

AITAC B.V. Catia 3D interface to/from DXF Page 6 of 12


3 Mapping tables
3.1 Mapping table for EXPORT
Below is a mapping table of elements that are converted:

CATIA V4 element DXF element Remark


*SOL (SOLIDE) Polyface mesh
*SOL (SOLIDM) Polyface mesh
*STR (STF, SHD Polyface mesh
STRUCTURE)
*GPR (PRIMITIVE) Polyface mesh
*FAC Polyface mesh Only triangular tesselation
*SUR Polyface mesh Only triangular tesselation
*LN Line
*PT Point
*CRV Polyline (version 12) or Only polynomial curves are
Spline (=B-SPLINE) if converted. B-SPLINE and nurbs
selected (allowed for currently not converted. Only if
version 14 and above version 14 is selected (version
only). 12 does not support SPLINE,
and curves will always be written
as polylines for version 12).
*CCV Lines and Splines
*CIR Circle (full) or Arc (partial)

3.2 Mapping table for IMPORT


Below is a mapping table of elements that are converted:

DXF element CATIA V4 element Remark


POLYLINE (Polyface *SOL (MOCKUP) or *POL When it defines a closed
mesh type) volume, a mockup solid is
generated
LINE *LN
POINT *PT
BLOCK DETAIL WORKSPACE
INSERT *DIT
SPLINE Not imported yet
RAY Not imported yet (half infinite
line)
XLINE Not imported yet (infinite line)
CIRCLE Not imported yet
ARC Not imported yet

AITAC B.V. Catia 3D interface to/from DXF Page 7 of 12


4 Executing the interface
4.1 Export
Select the function AEC_DXF.
Select the option DxfOut
Select the elements.
Then the panel appears with options. Select the options wanted. Some may need
explanation:
• union geometry before export = the program will union all primitives of one piping
part, hvac part, raceway part, equipment before the export. So create one element in
the DXF file for each object.
• generate points on pipe connectors = create points in the DXF file on the location of
the pipe connectors for accurate measuring in DXF

• Layers:
o All elements are placed in a layer corresponding to their Catia layer number,
or;
o All elements are placed in a layer corresponding to their Catia layer number,
but piping elements, and equipments, are placed on a layer that is not defined
by the Catia layer number, but by the name of the pipeline of the equipment.

• Polynomial curves:
o Polynomial curves are written as polylines with a number of straight segments.
This option will always the taken when version 12 DXF file is created.
o Polynomial curves are written as Bezier arcs. 1 Bezier arc per polynomial arc.
This option is to be used when no FRF license is available.
o Polynomial curves are written as (multi segment) B-Splines. But you need
access to licenses allowing these API’s to be executed. In case of abend
(‘licensing violation’), use previous option.

AITAC B.V. Catia 3D interface to/from DXF Page 8 of 12


AITAC B.V. Catia 3D interface to/from DXF Page 9 of 12
4.2 Import
Select the function AEC_DXF.
Select the option Dxfin
The following panel appears:

Select the File… button and select the DXF file (notice that the file should have only
LineFeed characters (LF) at the end of the line (as common on Unix) and not CR/LF
characters (as used on Windows). So transfer the file using the ASC mode when using FTP.

Define the dX,dY,dZ for the transformation (normally 0/0/0, but you can translate the
geometry to a different location in you 3D model directly on import).

Define the units of the DXF file.

In some cases the DXF file may have been written by a program that orients the normal
vector of facets towards the inside of the volume described by the polyfacet (relevant for
closed volumes only, not for open body polyfacets). In that case, you may want to tell Catia
to invert the orientation of the facets.

Select the Apply button. After the program has finished, reframe the model, and you may
want to review also the detail workspaces.

AITAC B.V. Catia 3D interface to/from DXF Page 10 of 12


5 AutoCAD manipulations to validate the export
5.1 Importing the file in Autocad
To import the DXF file in Autocad perform following steps:
a) key the command: NEW [Enter]
b) Select ‘Metric’ if required (depends on AutoCAD version)
c) key the command: DXFIN [Enter]
d) Select the DXF file
e) key in the command: ZOOM [Enter]
f) key in the option: E [Enter] (=extents)

5.2 Manipulating the view in Autocad


To verify the file imported, rotate the view:
g) key the command: VPOINT [Enter]
h) just press enter again: [Enter]
i) move the mouse in the circle
j) click left mouse button

5.3 Render the model in Autocad


To verify the file imported, render the model:
k) key the command: RENDER [Enter]
l) select the option: PHOTOREAL
m) select the option: SMOOTHSHADE
n) select the APPLY button

5.4 Hidden Line model in Autocad


To verify the file imported, render the model:
o) key the command: HIDE [Enter]

5.5 Save the model in Autocad


You may want to save the model in AutoCAD in DWG format, since the DWG format is much
smaller in size than the DXF file.

5.6 Then in Autocad


Now in AutoCAD you can measure distances, create additional geometry (with the Catia data
as reference), and create drawings (viewports in paperspace, compare to transparent views
in V4).

AITAC B.V. Catia 3D interface to/from DXF Page 11 of 12


6 Potential Improvements
Below is list of potential improvements:

A Support of ditto and detail workspaces on export


B Convert a complex curve to circle if it is really a circle (simpler to analyze in Autocad,
e.g. radius)
C If circle is in XY plane, always have Z axis pointing up (some stupid programs do not
understand really DXF data model and ignore Z axis)
D Approximate polynomial curve by line segments (for AutoCAD version 12). Done.

AITAC B.V. Catia 3D interface to/from DXF Page 12 of 12

S-ar putea să vă placă și