Encyclopaedia Index

Contents list

Importing CAD Data

Introduction

Allowable Geometries

Converting and Importing Other CAD Format Files

Importing a CAD Object
      Co-ordinate system origin
      Changing units
      Alignment of axes

Assembling a Complete Geometry
     Import by Group
     'Double-import'

Translation Errors


Introduction

If the geometry already exists as CAD geometry files, a considerable time saving can be achieved through the use of PHOENICS-VR's ability to import CAD files directly.

CAD-packages are frequently used to design engineering equipment. Most have the ability to define their output in a variety of formats. The formats supported directly by VR are:

PHOENICS VR uses readers in the OpenSceneGraph libraries  to read files in the above formats  and convert them to the PHOENICS-VR geometry format. Once a CAD file is converted to the PHOENICS VR geometry format, its file extension is changed to '.DAT'. In addition, a JPEG thumbnail of the converted geometry is created. This can be used later to import another copy of the same geometry.

The new file is placed in the current working directory by default. Optionally, the new file can instead be placed in a central geometry store, \PHOENICS \D_SATELL \D_OBJECT \FROMCAD.

The local working directory should be used for geometries specific to a single project, or if the user does not have 'write' permission to the central store. The central store should be used for geometries which are to be shared between projects.

Each CAD file should ideally contain the geometry of only one object - as the entire contents of a CAD file are treated as a single VR object, it will not be possible to attach different attributes to different parts of the geometry. If the geometry consists of several objects with different attributes, then one file per object should be created using the CAD system and they can then be converted and imported into PHOENICS-VR individually.

If that is not possible, the FacetFix utility can be used to extract multiple objects from a single STL or DAT file.

Many files can be imported simultaneously, as explained below. See also the tutorials on importing CAD data.


Allowable Geometries

A few points must be observed prior to generating files which are to be imported into PHOENICS, regardless of what CAD program is used:

At first sight, viewed from above, this geometry looks acceptable:

cad1.jpg (149824 bytes)

In fact, it will not work because none of the buildings have bottoms, so they are not closed volumes. This can be seen when viewed from below.

cad2.jpg (149824 bytes)

The solver will not detect anything!


Converting and Importing other CAD format files.

PolyTrans / NuGraf

These third-party programs from Okino Computer Graphics provide a very powerful suite of conversion utilities. They will translate almost any CAD format into almost any other. One of the available export options is STL, so these programs can be used to convert any CAD file into something useable by PHOENICS. The programs have limited capability to modify or repair the CAD model.

CADFix

Use can be made of a third-party file-translator package called CADfix, a product of TranscenData Europe Ltd, for converting files from a large number of formats into a number of other formats, including STL.

The CADfix program has the additional capability of removing, with the aid of the user's knowledge of what was originally intended, the redundancies and inconsistencies which such files commonly contain.

CADfix is an interactive program, which runs under UNIX and WINDOWS (NT/2000/XP/Vista).

AC3D

The AC3D program can import geometries in many 3D file formats including POV-Ray, VRML (1 and 2), RenderMan, 3D Studio 3DS, Lightwave, DXF, Alias triangle, Wavefront OBJ, Direct X, Milkshape, MD2, Quake 3 BSP.

It can perform Boolean operations on multiple objects - for example to join two intersecting objects and leave only the surfaces of the joined part. It can export PHOENICS geometry files, which are directly useable by the VR-Editor.


Importing a Single CAD Object

Locating and Loading the CAD File

CAD geometries are attached to objects just as the CHAM-supplied geometries are. They can be attached to new objects, or to existing objects. The CAD file(s) to be imported can be anywhere on the file system.

To start the import process, create a new object, or double-click on an existing object. On the object dialog box, click on to the 'Shape' page. This will bring up a dialog box, which allows the type of file to be imported to be selected:

Image: CAD Type
selection

Click on 'CAD file', and a file browser will appear, with which the file to be imported can be selected:

Image: CAD File
Browser

A selection of example CAD files is supplied in the folders:

\PHOENICS\D_INTFAC\D_CADPHO\D_STL
\PHOENICS\D_INTFAC\D_DXF

In this example, PIPES.STL has been selected. The CAD file can be located anywhere on the system.

Once 'Open' on the file selection dialog has been clicked, a confirmation of the input and output file names will be shown:

Image: Input and
Out Filename Confirmation

If happy to proceed, click OK, and the selected file will be translated.

Fitting the CAD Geometry to the Object

Once the translation is complete, the following dialog box will be shown:

Image: Translation
Complete

This dialog shows how many points and facets were created, and shows the size and origin read from the CAD file. There are then two choices for the size and position:

Whichever option is chosen, the size and location of the object can be changed as desired later.

If the non-default second options are selected by clicking on the No buttons to change them to Yes, the dialog changes to this:

Image: Translation
Complete

The object will be re-sized to the dimensions found in the CAD file, and placed at the location found in the CAD file. If the re-sized object does not fit inside the solution domain, the solution domain is re-sized to just encompass the new object. Clicking on 'Reset', 'Fit to Window' on the toolbar will rescale the view to show the entire domain.

If the ' Object constrained by domain' tickbox on the General page is cleared before importing the CAD file or 'Object constrained by domain' is set to No on the dialog,  the domain will not be resized if the object becomes bigger than the domain.

Co-ordinate System Origin

The data-entry boxes labeled Xorg, Yorg and Zorg are used to locate the origin of the PHOENICS co-ordinate system relative to the CAD system. In the CAD system, it is often possible to locate geometries in the negative quadrants. In PHOENICS-VR only positive co-ordinates are allowed unless the ' Object constrained by domain' tickbox on the General page is cleared. Even then, the solution only takes place in the positive quadrant.

The values specified for Xorg, Yorg and Zorg are used to shift the object into the required position in the PHOENICS co-ordinate system. The relationship used is of the form:

XpVR = XpCAD-Xorg; YpVR = YpCAD-Yorg; ZpVR = ZpCAD-Zorg

Example 1, consider an object located at (-10,-20,0) in the CAD system. In the CFD simulation, this object is to be located at (5,10,0). The required settings for Xorg, Yorg and Zorg are -15, -30 and 0 respectively.

Example 2, consider an object located at (10,20,0) in the CAD system. In the CFD simulation, this object is to be located at (5,10,0). The required settings for Xorg, Yorg and Zorg are 5, 10 and 0 respectively.

If 'Object constrained by domain' is set to No, and 'Take position from geometry file' is set to 'Yes', the object will be positioned exactly as in the CAD file without using the offset values.

If the 'PHOENICS origin in CAD system'  is 'At object position' as shown in the image, the input boxes are greyed out. Xorg, Yorg and Zorg are set equal to XpCAD,YpCAD, ZpCAD for the first object to be imported. This ensures that the the first object is placed at the PHOENICS origin. Subsequent objects will be placed relative to the first. Thus if the objects referred to in Examples 1 and 2 above were to be imported 'At object position' in that order, object 1 would be placed at (0,0,0), and object 2 at (20,40,0). The relative positions are maintained.

If for any subsequent object XpCAD is less than Xorg (e.g. if object 2 were to be imported before object 1 above), Xorg is reset to XpCAD for the new (and subsequent) object to maintain positive PHOENICS co-ordinates. This will change the relative positions of the objects.

Therefore, it is best to always import the object with the lowest co-ordinates first, as all relative positions will then be maintained.

If the 'PHOENICS origin in CAD system' is 'User', the values Xorg, Yorg and Zorg in the input boxes will be used to locate the object as described above. These values should be set so as to place the object(s) in the required position in PHOENICS co-ordinates. These values thus define the PHOENICS origin in the CAD co-ordinate system.

Returning to the above examples, if both objects are imported with Xorg, Yorg and Zorg set to -15, -30 and 0, object 1 will be at (5,10,0), and object 2 at (25,50,0) again maintaining the relative positions.

Changing Units

The Geometry scaling factor allows the CAD data to be transformed from the CAD units to the units used in PHOENICS-VR. These are normally taken to be meters. Typical scaling factors are:

CAD-Units Factor
mm 0.001
cm 0.01
m 1.0
inches 0.0254
feet 0.3048
yards 0.9144

Note that the units of the CAD origin are always assumed to be meters. If they are not, the correct values must be input otherwise the object may be located incorrectly. When the scale is changed, the Xorg, Yorg and Zorg boxes are updated when 'Apply' is pressed.

Alignment of Axes

It is possible to change the alignment of the CAD and PHOENICS-VR axes. By default, the CAD and PHOENICS-VR axes will be the same. If the CAD geometry was created with, say, the X axis pointing up, but the simulation is to run with Y as up, clicking on the CAD X Y Z align with VR button will cycle the alignments through X Y Z, Y Z X and Z X Y. This will ensure that the dimensions of the object bounding box are set correctly. Further orientation changes within the bounding box can be made by clicking on the Rotate Object Down / Up buttons on the hand-set.


Assembling a Complete Geometry

Import by Group

The easiest way to import a large number of CAD (or DAT or mixture of CAD and DAT) files is to use the ' Import by group' button on the Object 'Shape' page. Note that this only appears for a new object.

IMAGE: Object
'Shape' page for New Object

Clicking on 'Import by Group' displays the Group CAD/DAT Import dialog.

IMAGE: Import by
group dialog

The names of the CAD files to be imported are selected with a file browser. The list can contain a mixture of supported CAD data types and also DAT files.

If the 'PHOENICS origin in CAD system' is set to 'At object position', then for the first object to be imported, the the object co-ordinates are located relative to the CAD origin, and the PHOENICS origin is located at the position of the object. For subsequent objects, the CAD origin will only be changed if the new object is at a location which is more negative than the first object  in any of the X, Y or Z co-ordinate directions.

If the  'PHOENICS origin in CAD system' is set to 'User', then the values in the Xorg, Yorg and Zorg input boxes will be used to shift the objects as described above.

As a sequence of CAD objects is to be imported, it is important to set the origin of the CAD system correctly for the first object, so that the relative positioning is maintained.

If the sequence of STL (or DAT) files has been created by FacetFix from a single STL (or DAT) file, a file named 'outputfile'_0.STL will have been created. This is a single facet which sets the origin and overall size of the imported objects. It should be the first on the list of files to be imported, as that will ensure that the following files are placed in the right positions.

A quirk of Windows is that if a number of files are selected by highlighting the first, pressing Shift then highlighting the last, the list returned to the program will have the last file selected as the first in the list. If it is desired that the first file is guaranteed to be first in the list, highlight the last file first, press Shift then highlight the first. Selecting in this reverse order returns the list the right way round. The order of files can be checked by clicking 'List selected files'.

It can be easier to set 'Objects constrained by domain' to No before importing. Then all objects will go to the size and position set in the CAD files regardless of the size of the domain. Once they are all imported, they can be made into a Group and moved to a more convenient location and the domain can be made large enough to encompass them all. If required the 'constrained by domain' flag can be reset from the Object Management Dialog.

The Origin, Geometry scaling factor and CAD X Y Z alignment buttons are as described above for a single CAD file.

The type and attributes of the first object are copied to all the remaining objects in the list during the importation process. If the objects share many attributes, it is easier to set these for the first object before importing the list.

An alternative is to import each object in the assembly in turn using the 'Take size from geometry file' and 'Take position from geometry file' options, as described above.

'Double Import'

Quite often, there will be a number of CAD files to import. It is important to keep their relative positions as they were in the CAD, but the absolute locations in the CAD system may not be known, and in any case are not important as the objects are to be placed in the PHOENICS domain.

Using the 'Import by group' feature described above, bring all the CAD files into the domain. The 'PHOENICS origin in CAD system' should be left at 'At object position'. If the bottom-leftmost object was first in the list, all the others will be correct. If it wasn't, the objects will not be correctly positioned relative to each other.

In that case, select all the objects just imported, and delete them. Repeat the import procedure. This time, 'PHOENICS origin in CAD system' will have been automatically reset to 'User', and the Xorg, Yorg and Zorg fields will have been filled with the CAD co-ordinates of the bottom-leftmost object. Leave these settings and perform the import.

All the objects will now be correctly placed relative to each other. They can be selected as a group and moved to the desired location in the domain.


Translation Errors

Failure to translate ASCII STL files may be due to the lines ending with Line-feed, rather than Carriage-return+Line-feed. This can be corrected by reading the STL file into DOS Edit or WordPad, then saving it. It may be possible to change the output format settings in the CAD system to output a correct file, or to switch to binary format.

Another common error in CAD files is that the normals do not all face outwards. A symptom of this is that the object appears to change shape as the view is rotated, or it appears inside-out. If the setting 'View - Show back of objects' makes the image appear correct, it is a sure sign that some of the normals face in and not out. See the tutorial 'CAD Import: Importing and Repairing STL Files' for an example.

Although STL formally defines a closed volume, this is not guaranteed. Some STL files may contain holes or gaps between facets. These can lead to detection errors in the Earth solver.

Both types of errors can sometimes be fixed in STL files using FacetFix, started from Run - Utilities - FacetFix. The tutorial mentioned above exemplifies the use of FacetFix as part of the process of importing a sequence of STL files.

FacetFix will also take DAT files as inputs, and so can be used to indirectly repair geometry imported from other formats.


Contents list