Senin, 28 April 2008

Stage 1: AutoCAD Drawing

Introduction

Before even starting to think about creating a 3D scene from AutoCAD data, a separate simplified drawing must be created taking elements from a design drawing. The drawing below is a good example of an AutoCAD landscape design drawing. However, this is not suitable for import into MAX/VIZ as it contains hatches, text, image references, detailed blocks etc that MAX/VIZ will not use

Just those drawing elements needed for creating good surfaces, edges and objects are copied and pasted into a new AutoCAD drawing and quickly optimised for export to MAX/VIZ

NOTE: Ref: 'Key Fundamentals / Infrastructure and Landscape Modelling' for guidance on how to use good drawing methods in AutoCAD

  • In AutoCAD open Project for 3D 03.dwg. This is a much simplified drawing and is used in this tutorial. This exercise explains the steps used to create the drawing which is used as a 'buffer' drawing for importing into MAX/VIZ. This buffer drawing enables the drawing data to be optimised for use in MAX/VIZ/Key 3D and leaves the design production drawing unaltered

TIP: Keep elements in a design drawing on layers ready for easy copy and pasting to an optimised drawing for 3D to minimise any redrawing. A well organised CAD project should involve as little redrawing for 3D as possible

Download Sample Data

In order to follow this tutorial, you may want to use the supplied files. Please read the sample data instructions before downloading.

AutoCAD Drawing files: dwg_files.zip (784kb)
3ds Max Scene files: scene_files (7.8mb)

Top of page

1.1 Setup a project folder

  • Setup a project folder using the folders in the example below

Unzip the training files to the relevant folders, putting the dwg files in the Drawings folder and the scene files in the Scenes folder

  • In MAX/VIZ Customize > Configure Paths and configure paths for Import (Drawings folder) and Scenes (Scenes folder) on the General Tab
  • Open Key 3D Templates and load Key 3D Template

NOTE: It is advisable to use the Key 3D Start Template as the MAX/VIZ Start Template. This contains many quick-start features and settings. Select the Key 3D Template and press MAX/VIZ Start Template to do this. It will then appear under the MAX/VIZ Start Template group box and will open up automatically when MAX/VIZ starts

  • Save a scene to the Tutorial Files folder and name it: Key 3D tutorial 01.max. This scene file can be used throughout the tutorial and saved sequentially as Key 3D tutorial 02 / 03 / 04.max etc or pre-staged scenes can be loaded from the Scenes folder when prompted

Top of page

1.2 Copy and paste from the design drawing

Whenever creating a scene from a design production drawing always separate the data to be used for 3D work by copying into a new drawing and naming this 'buffer' drawing specifically 'for 3D'. This helps deal with issues such as optimising framework lines, simplifying blocks and moving the data nearer to 0,0. It also removes most of the drawing data that will not be used by MAX/VIZ and allows for a straight forward and comprehensive transition. Below, is an explanation of how to do this, but for the purposes of this tutorial a buffer drawing has been created

  • Select elements from the design drawing and right click > Copy
  • In a new drawing Edit > Paste to Original Coordinates. This will automatically paste the drawing elements in the correct place in world coordinates

  • Name the new drawing 'xxxxx for 3D' to identify it as the buffer drawing to import the AutoCAD data into MAX/VIZ. The drawing used in this tutorial is called 'Project for 3D'

Top of page

1.3 Layer management

  • Open Project for 3D 03.dwg
  • Look at the layers. They have been named so that anybody (the acid test) can recognise any elements when importing to MAX/VIZ

TIP: Use a template drawing with predefined layers and blocks to speed up this process

NOTE: The 'G_Framework' layer is used to help create surface boundaries using the Boundary command

Top of page

1.4 Optimise framework lines

Optimising framework lines involves inserting, deleting or moving vertices to give the appropriate amount of vertices on the lines and improving design elements such as the smoothness of curves that would benefit the 3D graphics greatly. This optimisation will, in turn, optimise the boundary lines created from the framework lines in the next stage. To optimise the framework lines they are imported into MAX/VIZ and the powerfull spline sub-object tools used before exporting back to AutoCAD to create the surface boundaries

NOTE: A feel for the correct level of detail on the lines at this stage can overcome potential problems when creating a terrain from a copy of the lines at a later stage. Lack of faces or too many faces on parts of the terrain can be avoided

NOTE: This exercise outlines quite extensive editing of the framework lines to give you a wider experience of the MAX/VIZ sub-object editing tools. In practice, more would probably be done in AutoCAD to form curves around intersections and entrances before importing the lines into MAX/VIZ

  • Open MAX/VIZ and make sure Key 3D Template is used (Ref 1.1). This contains many 'quick start' settings
  • File > Import. Choose Files of Type: AutoCAD (*.DWG, .DXF) and select Project for 3D 01.dwg
  • On the AutoCAD DWG/DXF Import dialog > Layers Tab check Select from list and tick the G_Framework and B_Play layers

TIP: Uncheck these layers and press Invert to speed up the process of selecting the layers to import

  • On the Geometry Tab uncheck all options apart from Weld at a threhold value of 0.1 This will make sure the lines will be imported as continuous lines and not a series of separate lines. Then press Ok to import the framework lines and play surface boundary lines
  • Maximise the Top viewport and select Layer:G_Framework. This spline object needs optimising by inserting and moving vertices, mainly on the rounded sections to give smoother curves and more uniform geometry at path and road intersections and entrances. Also, on straight sections to give the lines more detail when used for terrain generation

Top of page

Road framework line optimisation

Road corners

  • Select Layer:G_Framework
  • Enter vertex sub-object mode and zoom to one of the rounded corners at a road junction
  • Use Refine on the Geometry rollout to insert vertices between existing vertices where needed with a view to creating a smoother and more uniform curve

  • Select all the vertices on the curved section and change to Corner vertices

  • Move vertices to create a smoother corner, without moving the end vertices on the corner

NOTE: In this instance vertices should be added. However, some imported lines may need vertices removing if there are too many. In general, use Corner type vertices whenever possible and adjust the level of detail to suit the proximity of final viewing

Road straight sections

  • On the straight sections add vertices at uniform intervals where there are pronounced lack of vertices. This will lead to a more uniform terrain at the end of the landform mesh creation process

TIP: On longer sections where vertices need adding use the Divide tool in segment mode to quickly add uniform vertices

TIP: Be careful when selecting vertices and turning them to corner type. If you turn bezier type vertices to corner type on sections of the line that have not had vertices added then you will lose the intended geometry of the line (ie the line will not be 'anchored' with new vertices as intended). If this happens use Undo and re-select the line

  • Delete unnecessary vertices:

Top of page

Path framework lines optimisation

The framework lines for the paths within the parkland have been created using arcs in AutoCAD. The vertices on these lines are translated into bezier type vertices when imported into MAX/VIZ and typically have few vertices on the lines. To optimise these lines and vertices for use in MAX/VIZ, the amount of vertices need increasing where needed, removing where not needed and the type changing to corner type vertices. Although the curves will then be made of straight segments (as with the road corners and due to using corner vertices), this method means that you have complete control over the level of detail required in the surface mesh. Plus, auto-generation of many faces as a result of using bezier type vertices on a boundary line when cutting out inner surfaces from larger surfaces later will be avoided

NOTE: Remember that the aim here is to get complete control over the amount of face detail on the final 3D surfaces. You need high detail around curves and within the more detailed design areas and less detail in areas of less detail design such as the middle of grassed areas and the context landform. The reason you are using MAX/VIZ to do this at this stage (before exporting back to AutoCAD) is because MAX/VIZ has more efficient tools to edit vertices on lines than AutoCAD

Main path framework lines

  • Add vertices to the splines at regular intervals before turning the vertices to corner type vertices

Intersections

  • Where one path meets another delete any spline segments not needed for boundary creation
  • Add vertices where needed and move vertices to round off the path lines, remembering to cross any lines. These will be used to create closed boundaries for the grassed areas in AutoCAD and should have no gaps

Entrances

  • Finally, and when confident the geometry on the framework lines has been optimised effectively, export the framework lines back to AutoCAD:

Firstly, change the System Unit Setup settings to millimeters:

  • Customize > Units Setup > System Unit Setup button. Change the System Unit Scale to Millimeters. This will make the exported geometry the correct size when inserted into the project drawing

Then export the framework lines to AutoCAD:

  • File > Export Selected. In the Save File to Export dialog choose Save as type: AutoCAD(*.DWG)
  • Name the file Framework lines optimised.dwg and save in your training files folder
  • Save the scene as Framework.max in case it is needed later
  • When finished exporting change the System Unit Scale back to the default Inches

Top of page

1.5 Create seamless closed boundaries for surfaces

All boundaries for 3D surface creation must be drawn in AutoCAD as closed boundary polygons that have been created using accurate geometrical drawing techniques. This process has been aided by adding a framework layer that has been edited and optimised in MAX/VIZ. The Boundary command is now used in AutoCAD to create the surface boundaries and to make sure that all the boundaries are seamless

NOTE: Double lines delineating a kerb in the 2D plan are not imported into MAX/VIZ, just the seamless boundaries of one surface next to another. Kerbs are created entirely in MAX/VIZ by using the Key 3D Edging routines, involving the use of the Loft compound object. In MAX/VIZ the 3D kerb will extend over the 3D road surface which will be lowered about 150mm (as it is in real-world). Because the kerb will extend over the road it is the back of kerb line that is used for the road boundary

Insert the optimised framework lines drawing

  • In AutoCAD open Project for 3D 02.dwg. The drawing exported from MAX/VIZ called Framework lines optimised.dwg has been inserted using the Insert command. For this exercise this drawing has most surface boundaries complete except the grassed areas. Note that the lines are now optimised

Create surface boundaries

  • Turn the Framework layer on and make the B_Grass layer current (B_ prefix means that this is a surface boundary)
  • Draw > Boundary. On the Boundary Creation dialog press the Pick Points button and pick in each grassed area to create a boundary on the current layer

  • Save the drawing as Project for 3D 03 tutorial.dwg for your own use and do not overwrite Project for 3D 03.dwg

NOTE: A site boundary has been created on layer B_Site. This is used to create a site surface, thus separating the design surfaces from the context surface (which will be far less detailed)

NOTE: An advantage of creating surface boundaries using the Boundary command is that they do not contain 'intersecting vertices' (a common problem in 3D modelling work). Creating boundaries in this way also ensures that the polygons are completely closed. Closed boundaries are also useful in AutoCAD for hatching, obtaining area quantities and export to other 3rd party applications such as Corel Draw and Adobe Illustrator

Top of page

1.6 Replace detailed blocks with simple blocks for MAX/VIZ/Key 3D

Complicated 2D blocks should not be imported into MAX/VIZ if they are merely used as markers for 3D Objects or, as in this case, for replacing with 3D objects. Replacing blocks with much simpler blocks before importing into MAX/VIZ is straightforward in AutoCAD using the Block Editor. This exercise explains how this was done in the tutorial project drawings

  • In AutoCAD open Simplify Blocks.dwg. The drawing contains two complicated graphic blocks for trees and one lighting block. These have been used as part of the design production drawing, but the blocks are too detailed for import into MAX/VIZ

Redefine the tree blocks

  • Select one of the 5m tree blocks and double left click. This opens the Edit Block Definition dialog

NOTE: The Edit Block Definition dialog is a feature of AutoCAD 2007 plus. Replacing blocks in previous versions of AutoCAD entails using the Reference Edit dialog or simply 'redefining blocks'

  • Press Ok to open the block up for editing in the Block Editor
  • In the Block Editor make sure layer O_Tree 5m dia is current
  • Draw a circle from the centre of the existing block, making it the same diameter as the existing block
  • Erase the existing block entities, leaving just the new simple circle
  • Press Save Block Definition on the Block Editor toolbar and close the Block Editor dialog. All of the 5m tree blocks will be automatically redifined

  • Repeat this process to simplify the 10m tree blocks and the lighting columns, making sure that the correct layer is made current in the Block Editor. To simplify the lighting columns use the following graphic:

TIP: Another option for replacing blocks can be found on the Express Menu/Blocks. Use Replace block with another block to quickly replace a block in the drawining with another

Top of page

1.7 Move data nearer to zero if required

The AutoCAD drawing used for this tutorial is positioned close to zero on the X and Y axes. However, it is very common for land planning and architectural project drawings to be positioned far from 0,0 due to the use of Ordnance Survey georeferenced data. This can cause problems later on in the 3D project, when some modelling operations may fail and animated cameras may 'shake'

  • Refer to Key Fundamentals: Infrastructure and Landscape Modelling / Import Options / Move to Zero for detailed notes on how to move data close to zero in the buffer drawing without compromising the original production drawing

Stage 2: Create Landform Mesh


Introduction

The final type of data needed when creating a 3D scene from AutoCAD is groundmodel data. This is traditionally kept in a number of ways in AutoCAD: Levels / Contours / Triangular mesh / 3D Grid / 3D polylines (strings)

The groundmodel data we use here is a combination of Key Levels and 3D Splines. This stage explains the process of using Key Levels and creating 3D splines (called 3D polylines in AutoCAD) and creating a spline model for the whole site, including both design and site context geometry. The spline model is then turned into a terrain object to form a landform mesh (the terrain object joins the vertices of the spline model to form a mesh). It is this site landform mesh which is used in the next stage (Stage 3) to create separate surfaces using the 2D surface boundaries

NOTE: This tutorial presumes that no AutoCAD 3D data is available apart from key levels. Often, as part of infrastructure design, 3D AutoCAD design data (usually 3D strings) is available and can be used as part of this modelling process

Top of page

Download Sample Data

In order to follow this tutorial, you may want to use the supplied files. Please read the sample data instructions before downloading.

AutoCAD Drawing files: dwg_files.zip (784kb)
3ds Max Scene files: scene_files (7.8mb)

2.1 Import boundaries, and create 3D splines

The next step is to import the boundaries and detach and make copies of those splines that are to be used to create the 3D spline model

  • Open MAX/VIZ and make sure Key 3D Template is used (Ref 1.1)
  • File > Import. Choose Files of Type: AutoCAD(*.DWG, .DXF) and select Project for 3D 03.dwg
  • On the AutoCAD DWG/DXF Import dialog > Layers Tab check Select from list and tick all the layers prefixed with 'B_'. These are all the boundary layers
  • On the Geometry Tab > Derive AutoCAD Primitives by > Layer is selected and just Weld is checked to a threshold of 0.1
  • Press Ok to import the boundary lines

The boundary lines will now be used for two elements of the 3D model:

1. Production of a 3D spline model for conversion to a Terrain object
2. For cutting the landform mesh to produce separate 3D surface meshes for road, pavement grassed areas etc

  • Firstly, rename all the objects in the Modify Panel, removing the prefix 'Layer:'

To create the splines to be used for the production of the 3D spline model do the following:

Copy and rename the road boundary line

  • Select the 'B_Road' object
  • Edit > Clone - select Copy and press Ok - This creates a copy and keeps the copy selected. Rename the copy: 3Dspline_Road

Detach, copy and rename the play boundary lines

  • Select the 'B_Play' object
  • In Spline sub-object mode detach (copy) the larger surface boundary and name 3Dspline_Play 01 and detach (copy) the smaller play surface boundary and name 3Dspline_Play 02
  • Still in Spline sub-object mode detach (detach completely ie do not copy) the larger surface boundary and name Layer:B_Play 01 and detach (detach completely ie do not copy) the smaller surface boundary and name Layer:B_Play 02
  • Exit sub-object mode

Detach, copy and rename the grass boundary lines

  • Select the 'B_Grass' object
  • In Spline sub-object mode detach (copy) each surface boundary and name B_Grass 01 and B_Grass 02 etc untill all seven boundaries have been detached and renamed

Note: The original 'B_Grass' object will consist of just one boundary when six boundaries have been detached and this can simply be renamed 'B_Grass 07'

  • Select each grass boundary in turn and copy clone each, renaming the copies 3Dspline_Grass 01, 3Dspline_Grass 02 etc untill all have been copied and renamed
  • Exit sub-object mode

Rename the context boundary

  • Finally, rename the B_Context object to 3Dspline_Context. This spline will only be used to create the terrain

Top of page

2.2 Detach pavement boundaries

  • Select B_Pavement
  • Isolate Selection
  • In Spline sub-object mode select each spline and detach, renaming the detached splines B_Pavement 01, B_Pavement 02 etc
  • Exit sub-object mode
  • Exit Isolate Selection

The following objects should now be in the scene:

NOTE: This stage could be by-passed as Key 3D surfacing routines can cut and surface multiple boundaries, but because there are few boundaries it is prudent to separate them

Top of page

2.3 Interpolate splines and create a terrain

This process builds a 3D spline model from which to create a MAX/VIZ Terrain object for the overall site landform

  • Hide all objects apart from those with prefix 3Dspline...

Import level text

  • Keep in the current scene or open ACAD to 3D Stage 2a.max
  • Open AutoCAD and Project for 3D 03.dwg
  • Turn Off all layers except G_Levels
  • Save the drawing
  • In MAX/VIZ use the Legacy AutoCAD Import dialog to import the text (using Merge on the first dialog) and use the following settings:

Remove segments not needed to form the landform mesh and move 'flat' area boundaries to the correct level

  • Remove segments from splines that overlap other splines, for instance where the play areas touch the paths. Remove segments from the grass boundaries in segment sub-object mode

  • Maximise the User viewport and move 3Dspline_Play01 and 3Dspline_Play02 to the height shown on the level text within the boundaries

Interpolate the Road spline

  • In the User viewport select 3Dspline_Road01 and open Key 3D Interpolator
  • Under Options make sure Turn Snaps On/Off and Display Snap Settings are checked

  • Press Pick Key Levels. Vertex numbers will display and the Snaps Settings dialog appears
  • Just check Vertex and close the dialog

NOTE: Display Snap Settings can be unchecked once this has been set

  • Zoom to the area of road shown below and hover the cursor over vertex 257 (this may be different depending on the number of vertices added). Look at the Interpolator rollout whilst doing this and when 257 appears under Key Level One left click. The level is then entered and Interpolator is ready to enter Key Level Two
  • Hover the cursor over vertex 247 (again this will differ from the example shown) and left click when displayed under Key Level Two.

When Key Level Two is recorded then the buttons on Interpolator become active. Also, the numbers for the key levels turn green in the viewport and vertex numbers to be interpolated turn red. Only the vertices on one side of the key levels are displayed in red - these are the vertices marked for interpolation

  • Type in the level of each vertex. In this case both levels are 23

The Key Level vertices jump to their correct heights:

  • Practice changing the direction Up or Down before leaving the direction on Down as shown
  • Press Interpolate - this interpolates all vertices between the key levels. In this case, all levels are moved to a height of 23

  • Press Pick Key Levels again to repeat the process for the next section of spline

  • Change the direction Up or Down as required, then press Interpolate

  • Repeat this procedure on the other side of the road as shown below

  • Interpolate the next section which is flat at a height of 17.2

  • Interpolate the next section (both sides) from 17.2 to 17

  • Complete the interpolation of the road spline as above using the level text as reference

NOTE: If part of a spline is interpolated wrongly eg if it is interpolated up instead of down, Undo will not work. To correct mistakes the spline will need re-interpolating. Save the scene regularly (sequential saves using Save As + button is a good habit also) to minimise having to do this

Interpolate the path slines

The path splines are interpolated similarly, however levels can be automatically picked up from other splines that have been interpolated (road spline or other interpolated path splines) or put to height (play area flat boundaries). This will speed the process up as you interpolate more splines

  • Select the spline shown on the image below
  • Select key levels as shown

  • Repeat the process for all path splines, checking with 'Arc Rotate Selected' that the lines represent smooth and accurate path edges
  • Finally, attach the path splines to create one editable spline and delete the level text

Interpolate the Context Spline

The site needs a context landform. This stops the site 'floating' in mid air and is useful to apply aerial imagery or other context data

  • Interpolate the Context spline using Key 3D Interpolator - Use Get Z Height buttons to get height of vertices on the nearest 3D splines. Although no height data is available in this case, this will give an approximation of height

  • To complete the 3D spline model divide the Context spline in segment sub-object mode to give more vertex detail

Create a Terrain

  • Attach all the splines together
  • Finally create a Terrain object from the splines: Key 3D Surfaces dropdown menu > Terrain

TIP: To view the terrain and validate the road, path and play surfaces use the Facets + Highlights display mode

  • Finally, convert the Terrain to an Editable mesh (select, right click and 'Convert to Editable Mesh') and rename Landform
  • Hide the landform mesh
Name:*

Email Address:*

Feedback: