Encyclopaedia Index

WORKSHOP - CAD Import: Importing Multiple STL Files


The aim of this tutorial is to show:

The tutorial is a continuation of 'CAD Import: Importing and Repairing STL Files'.

In the earlier tutorial, a single STL file for a complex building geometry was imported. An obvious error in the imported file was repaired, but the geometry was still not detected correctly. This was because the various elements of the geometry penetrated each other, especially the towers and their podiums. This situation can only be handled correctly if the interpenetrating parts are separate objects. In this final stage, the single STL is replaced by individual STL files for the various elements of the geometry.

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 STL 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 'Import by group'. Note that this button only appears for a new object. It does not appear for pre-existing objects.

On the group CAD import dialog, click 'Browse for CAD files'.

In the file browser, browse to \phoenics\d_polis\d_wkshp\cadimprt, and select the following files:

land.stl, main-pod.stl, pod-el-1.stl, pod-el-2.stl, slopes.stl, towers.stl, wheel.stl.

Click 'Open'.

In the STL files, the co-ordinates are given in millimetres, but we want to work in metres. Enter 0.001 in the 'Geometry scaling factor' entry box.

In the CAD co-ordinate system, the buildings are situated at around (-2700, -3600, -123)m relative to the origin. PHOENICS works in the positive quadrant, so we need to off-set the CAD co-ordinates by an appropriate amount.

The relationship used is of the form:

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

Click 'At object position'  next to 'PHOENICS origin in CAD system' to change it to 'User'. Enter  -2800 for Xorg, -3700 for Yorg and -123.3 for Zorg. This will place all the imported files relative to (-2700-(-2800)),(-3600-(-3700)),(-123.3-(-123.3)), which is (100,100,0) in the PHOENICS system.

Click OK. The geometry files will now be converted and read in.

Click OK to close the Object specification 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. Click 'Settings', 'Near Plane', 'Reset' to ensure the image appears correctly.

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 dark building to the left of the wheel appears inside out from 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. 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 wheel.dat and click 'Open'. 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 wheel in the main graphics window. This will open the Object specification dialog. Go to the 'Shape' page. Click 'wheel' 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 'wheel_0.dat and 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).

Click on the Mesh toggle on the hand-set or toolbar, then click on the image to bring up the Grid mesh Settings dialog. Toggle all three directions from Auto to Manual.

Click on 'Edit all regions' for X, and click 'free all'. Set the Number of cells to 100. Repeat for Y and Z, but only set 50 cells for Z. Click OK to close the dialog, and 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 up to around 75m, we can see that the tower blocks are now detected correctly. A CFD solution can be made for this geometry. This is the topic of the next tutorial.

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 'STAGE_2'.