Encyclopaedia Index

WORKSHOP - CAD Import: Importing and Repairing 3DS Files

Overview

The aim of this tutorial is to show:

The tutorial is in several stages. The first stage imports a single 3DS file for a complex building geometry. There is an obvious error in the imported file. In the second stage, this error is repaired and the detection of solids by the Earth solver is checked. In the final stage, the single 3DS is split into separate files for each building.

The full geometry of the case is shown in Figure 1 below.

 

Figure 1. The geometry of the CAD import example

The CFD solution is not of interest for this tutorial.

A complete step-by-step guide, showing how to set the case from the default mode of operation, is provided below.

Accessing PHOENICS-VR.

From the system level:

To enter the PHOENICS-VR environment, click on the PHOENICS icon on the desktop, or click on Start, programs, PHOENICS, PHOENICS.

From the commander level:

To enter the PHOENICS-VR environment, click on the 'Run vre' icon in the left column.

 

In PHOENICS-VR environment,

 

Start with an 'empty' case - click on 'File' then on 'Start New Case', then on 'Core'', then click on 'OK'; to confirm the resetting.

 

To enter VR Editor:

 

This is the default mode of operation.

Within VR Editor.

Import the 3DS file

Click on on the VR-Editor panel (or the O icon on the tool bar) to bring up the Object Management Dialog; and then on 'Object', 'New', 'New object'.

Click on the 'Shape' tab, then on 'CAD file'.

In the file browser, browse to \phoenics\d_polis\d_wkshp\cadimprt, and select the file cfd.3ds. Click 'Open'.

On the Import 3DS Data dialog that opens, click OK to accept the setting that the converted geometry file is to be placed in the current working directory. (If this were a common geometry that was to be used in many projects, it would be better to place it in the central store so that it was easily accessible). The following dialog should appear:

Sizing the geometry

Change the 'No' next to 'Take size from CAD file' to 'Yes'. On import, the size of the current object will be reset to that read from the geometry file.

Placing the geometry

By default, the imported object will be placed at the domain origin (or wherever the origin of the current object is set to).  We want to leave 150m space around the buildings, so change the 'No' next to 'Take position  from geometry file' to 'Yes'.  

Click 'At object position' next to 'PHOENICS origin in CAD system'. It will change to 'User', and the Xorg, Yorg and Zorg boxes will be filled with the x0, y0 and z0 values shown on the dialog. These values act as an offset between the co-ordinates read in, and the co-ordinates in the Editor. (Xpos = Xpos CAD - Xorg). To move the buildings over by 150m, we reset Xorg to -458 and Yorg to -310. The dialog should now look like this:

Click OK. The converted geometry file will now be read in. The size of the new object will be set to 515.8m * 315.2m * 363.7m, at 150.0, 150.0, 0.0.

Click OK to close the Object specification dialog and OK to close the Object dialog.

On the toolbar, click the down arrow next to and select 'Fit to window'. The screen should look like this:

Checking for Obvious Errors

Click on 'Domain' in the Object management Dialog, or click on the image background to release the highlighted object.

Using the mouse, rotate, pan and zoom the image to inspect the geometry. Details of the mouse operation are given in TR/326, VR-Editor Hand-Set, Mouse Control. You should be able to find this peculiarity:

The tall building at the back appears inside out whatever angle it is viewed from.

To help diagnose the problem, click 'View', 'Show backs of objects'. This tells VR-Editor to draw both sides of each facet, not just those facing outwards. The image should change to:

The inside-out part now looks correct. This is a good indication that the facets of the affected region are pointing in the wrong direction.

Repairing the error

The utility program FacetFix can be used to repair many common errors in geometry files. Although FacetFix is defaulted to repair STL files and cannot read 3DS, it can also read and repair the converted geometry DAT files. To start FacetFix, click 'Run', 'Utilities', 'FacetFix'. The FacetFix GUI should appear:

image001.gif (7187 bytes)

Click 'Browse for input', change file type from STL to DAT, select cfd.dat and click 'Open'. Enter fix-cfd in the Output file box, then click 'Run FacetFix'. After a short while the FacetFix dialog will close, indicating that the repair is finished.

To open the corrected geometry file, double-click on the buildings in the main graphics window. This will open the Object specification dialog. Go to the 'Shape' page. Click 'cfd' next to 'Geometry'. In the file browser, browse to the current working director (by default \phoenics\d_priv1). Check that 'Files of type' is set to 'All files (*.*)'. Select 'fix-cfd.dat and click 'Open'. (It can be quicker to just type fix-cfd as the name of the file and immediately click 'Open'). On the next Geometry Import dialog just click OK, as we are only replacing the geometry for the existing object. Click 'OK' to close the Object Specification dialog.

The screen should now look like:

This should now not change when 'View', 'Show backs of objects' is turned on and off, indicating that all the facts do indeed point outwards. The colours in the image have been introduced by FacetFix. It has used a different colour for each closed volume it has found in the original data set.

Checking for Detection Problems

Having imported the geometry, it is worth checking to see if it will be detected properly by the Earth solver. Do do this, we need to set a mesh and perform 2 or 3 sweeps (iterations).

First make the domain size 150m bigger in X and Y and 50m bigger in Z. For a real calculation, the boundaries should be several times the height of the tallest building away from the buildings.

Click on the Mesh toggle on the hand-set or toolbar, then click on the image to bring up the Grid mesh Settings dialog. Reset the Domain size to 815 in X, 615 in Y and 413 in Z.

Toggle all three directions from Auto to Manual. Click on 'Edit all regions in' 'X direction. Set the number of cells and powers in the three regions as:

Region Cells Power
1 10 -2
2 100 1
3 10 2

A positive power expands the grid from the start of the region towards the end, a negative power expands the grid from the end of a region towards the beginning. Click OK, then Edit all regions in Y and make the same settings. In Z, set 50 cells in region 1 with a power of 1, and 5 in region 2 with a power of 2. Click OK twice to close the dialogs. The grid should look like this:

Click on the Mesh toggle to turn off the mesh display.

Click on on the hand-set or M on the toolbar to bring up the main Menu. Go to the Numerics page. Change the 'Total number of iterations' to 2, then Top Menu, OK to close the Main Menu.

Click 'Run' 'Solver' to make the Earth run.

Once the Solver run has finished, enter the VR-Viewer to examine the solution (Click 'Run' - 'Post processor' ,'GUI ').

In the Viewer, switch the plotting plane to Z (click Z on the handset or toolbar), and select the property-marker variable PRPS by clicking the icon on the hand-set or toolbar, then selecting PRPS from the list of variables. Switch the contours on by ticking 'Show contours' on the Viewer Options dialog, or by clicking on the hand-set or toolbar. The PRPS contours should be blue in the airspace, and red inside the buildings.

To see inside the buildings, go to wireframe mode by clicking on the hand-set or toolbar.

Moving the probe to around 18m, we can see that the buildings are detected well.

By moving the probe up and down in Z, and also scanning through the X and Y planes you can get a feel for how well the shapes have been picked up.

Saving the results.

In the PHOENICS-VR environment, click on 'Save as a case', make a new folder called 'CAD', select the new folder, and save as '3DS'.

Splitting into separate objects

If still in the Viewer, return to the Editor by clicking Run - Preprocessor.

The splitting is done by FacetFix. To start FacetFix, click 'Run', 'Utilities', 'FacetFix'. The FacetFix GUI should appear:

image001.gif (7187 bytes)

Click 'Browse for input', change file type from STL to DAT, select cfd.dat and click 'Open'. Enter split-cfd in the Output file box, tick 'Multiple files', then click 'Run FacetFix'. After a short while the FacetFix dialog will close, indicating that the repair and splitting is finished.

To open the corrected geometry files, click on on the VR-Editor panel (or the O icon on the tool bar) to bring up the Object Management Dialog; and then on 'Object', 'New', 'New object'.

Click on the 'Shape' tab, then on 'Import by group'. This button only appears for a new object. Click on 'browse for CAD/DAT files', and select all the split_cfd_n.stl files, where n goes from 0 to 8. FacetFix has split the geometry into eight objects. The -0 file is a place holder which marks the origin and size of the original single object. This must be first in the list. Due to a Windows quirk, the last file selected is first in the list, so click on split_cfd_8.stl, hold down shift and click split_cfd_0.stl. Click OK to close the file selection dialog.

To place the new objects in the same location as before click on 'Phoenics origin in CAD system' and change from 'At object positin' to 'User'. Enter -458 for X and -310 for Y as before, then click OK. Nine new objects should appear in the Object Management Dialog. After hiding the original object, B1, the screen should look like this:

image001.gif (7187 bytes)

Effect on the grid

The grid will now look very strange:

image001.gif (7187 bytes)

We had set the grid for three regions, and it is still set that way. The new objects have created many more regions, so the grid settings are no longer appropriate. Bring up the Gridmesh dialog and toggle all regions back to Auto. The grid should improve to:

image001.gif (7187 bytes)

You can go back to the grid settings for each direction and investigate how changes to the auto-mesh parameters affect the grid.