Skip to content
BadBit Documentation
Sign in Download the beta

LandXML (Civil 3D)

LandXML 1.2 is the open exchange format of surveying and road design programs: Civil 3D exports and imports project data through it. BadBit CAD reads and writes LandXML to bring from a Civil 3D project (or from another program) the points, the surfaces (the terrain model in triangles or in a grid, with boundaries and watersheds), the alignments (centerlines, with stations, profile and cross sections), the parcels, the feature lines (feature lines and breaklines), the corridors and the pipe networks, and to send back to Civil 3D the points and polylines drawn in BadBit CAD.

Commands

CommandWhat it does
LANDXMLINImports a LandXML file into the current drawing (the command names are Civil 3D's, the same in all three languages).
LANDXMLOUTExports the selected objects to a LandXML file; with no selection, it asks Select objects: like AutoCAD commands (Enter with nothing chosen means the whole model space).

Both are on the ribbon: Insert → LandXML → Import LandXML and Output → LandXML → Export LandXML.

Importing (LANDXMLIN)

LANDXMLIN opens the Import LandXML dialog and, with FILEDIA 1, the system dialog to choose the file (.xml). The path can also be typed in the File field (Enter or Read). The file is read in the background, with progress in the corner of the screen; then the dialog shows what it contains:

The Import LandXML dialog with the file read
What the file contains, with the counts, the contour interval and the units.
  • What to import: one checkbox per type, with the count in the file (points, surfaces with the number of triangles, alignments, parcels, feature lines, pipe networks and corridors). For alignments, Stations, Profiles and Cross sections; for surfaces, Watersheds. A type the file does not have is grayed out.
  • Labels and Label height: the number, elevation and description of points, the name and area of parcels, the name of the alignment and the elevation of major contours. The suggested height is a round number (1, 2, 2.5 or 5 times a power of 10) and proportional to the size of the survey.
  • Surfaces: Triangles (the terrain model, one triangle per visible face) and Contours, with the Interval (default 1 m) and Major every (default 5: a contour whose elevation is a multiple of 5 m is a major one).
  • File units: the system (metric or imperial) and the length unit of the file (LandXML's <Units>). If it is the same as the drawing's, the coordinates come in unconverted, bit for bit; otherwise, they are converted to the drawing unit (the factor appears in the dialog; the US survey foot is 1200/3937 m).

Import builds the drawing in the background (the window keeps responding) and creates everything as a single undo step: one U undoes the whole import. If the drawing was empty, the zoom goes to extents.

The drawing after LANDXMLIN
The whole file: the surface (top left), the feature lines, the parcels, the points and the alignment with the spiral and the arc.
Close up
Close up: the points with number, elevation and description; the surface with the border, triangles, breakline and contours; the parcels with name and area at the center.

What becomes a BadBit CAD object

LandXMLIn the drawingLayers
Points (CgPoints)Point (POINT) at the file's easting and northing, with the labelsLXML-PONTOS, LXML-PONTOS-NUMERO, LXML-PONTOS-COTA, LXML-PONTOS-DESCRICAO
TIN surface (Surface: Pnts and Faces)Triangles (closed three-vertex polylines), the border (closed polyline) and the contoursLXML-SUPERFICIE-TRIANGULOS, LXML-SUPERFICIE-BORDA, LXML-CURVAS-MESTRAS, LXML-CURVAS-INTERMEDIARIAS, LXML-CURVAS-ROTULOS
Surface breaklines (Breaklines)PolylinesLXML-LINHAS-QUEBRA
Alignment (Alignment: Line, Curve, Spiral)Polyline with the exact arcs; each spiral as its own object (a spline through the points of the clothoid, with the tangents at the ends)LXML-ALINHAMENTOS, LXML-ALINHAMENTOS-ROTULOS
Parcel (Parcel)Closed polyline, with the name and area at the center; with a spiral, the lines and arcs in polylines and each spiral in a spline, as in the alignmentLXML-LOTES, LXML-LOTES-ROTULOS
Feature line (PlanFeature)Polyline; with a spiral, the lines and arcs in polylines and each spiral in a spline, as in the alignmentLXML-LINHAS-CARACTERISTICAS
Alignment stationsPerpendicular tick every 20 m and, every 100 m, the larger tick with the number (0+100.00)LXML-ALINHAMENTOS-ESTACAS
Station equation (StaEquation)Stations follow the ahead numbering after it; at its place, the label 0+250.00 = 0+300.00 (back = ahead)LXML-ALINHAMENTOS-ESTACAS
Profile (ProfAlign and ProfSurf)Frame below the drawing with the design grade (vertical curves) and the groundLXML-PERFIL-QUADRO, LXML-PERFIL-GREIDE, LXML-PERFIL-TERRENO
Cross sections (CrossSects)The section line in plan, perpendicular to the centerline at the station, with the station at the end; and one frame per section below the profile, with the ground and the designLXML-SECOES, LXML-SECOES-QUADRO, LXML-SECOES-TERRENO, LXML-SECOES-PROJETO
Superelevation (Superelevation)Diagram below the profile: the slope of the outside lane and of the inside lane along the stations, with the curve side and the pivot type in the label of each regionLXML-SUPERELEVACAO-QUADRO, LXML-SUPERELEVACAO-EXTERNA, LXML-SUPERELEVACAO-INTERNA
Surface boundaries (Boundaries)Exact clipping of the TIN: the triangles, contours and border are cut at the line of the outer boundary and of the voids (islands come back); a triangle that is entirely outside disappears—
Watersheds (Watersheds)Closed polyline with the nameLXML-BACIAS
Pipe network (PipeNetwork)Structures as circles at their diameter, pipes from edge to edge of the structures, the names (the pipe with its diameter)LXML-REDES-POCOS, LXML-REDES-TUBOS, LXML-REDES-ROTULOS
Corridor (Roadway)The lines it contains (edges, feature lines)LXML-CORREDORES
  • Coordinate order. LandXML writes Northing, Easting, elevation ("N E Z"). BadBit CAD puts the easting in X and the northing in Y: a point 8127326.73 642776.21 512.41 goes to X = 642776.21 and Y = 8127326.73.
  • The elevation. The BadBit CAD drawing is 2D: the elevation of each point (and of the vertices of feature lines and of the surface) is kept with the object and appears in the label; LANDXMLOUT writes it back.
  • Contours. Computed by BadBit CAD from the triangles (each triangle cut by the plane of each elevation, the pieces chained into polylines, in parallel). They always come out closed or ending at the border of the surface; a contour that passes exactly through a surface point goes through it. Only visible faces count (those marked as invisible in Civil 3D are left out), and with a boundary the contours are cut at its line.
  • Spirals. Each spiral of the alignment is an object of its own: a spline that passes through the points of the clothoid (curvature varying with length) and leaves tangent to the neighboring line and arc, ending exactly at the end point in the file (it stays within one micrometer of the clothoid on a 100 m spiral). An alignment with spirals becomes pieces: consecutive lines and arcs in a polyline and each spiral in a spline; the first piece carries the whole alignment for LANDXMLOUT. In feature lines and parcels (rare) it is the same: each spiral becomes a spline, the first piece carries the whole object and the report says how many (the parcel area is that of the outline, with the spiral through the points of the clothoid). The spiral spline can be edited (MOVE, ROTATE, grips): LANDXMLOUT recomputes the spiral from it (see Exporting, below).
  • Grid surfaces. A grid surface becomes triangles: each four-point cell into two (and also a regular grid that comes only with the points, without faces).
  • Parcel area. Computed from the geometry (lines and arcs), in the drawing unit squared.

Stations, profile and cross sections

Stations follow Civil 3D's default style: a tick perpendicular to the centerline every 20 m and, at stations that are multiples of 100 m, the larger tick with the number in kilometers + meters (0+100.00, with the drawing's decimal separator), from the starting station of the alignment. The profile comes out in a frame below everything that was imported: the stations horizontally, at the drawing scale, and the elevations vertically with a 10× exaggeration (the Civil 3D default); the grid at the 100 m stations and at round elevations, the elevations on the left, the stations at the bottom and the profile name at the top. The design grade (design profile) carries the vertical curves (parabolas, tangent to both grades; a circular curve comes out as the parabola of the same length) and the ground, the points in the file. Cross sections appear in plan as the line perpendicular to the centerline at each one's station, from the smallest to the largest sampled offset, and each one in a frame below the profile (see below). Superelevation comes out in a diagram below the profile and goes back through LANDXMLOUT as it came.

The complete LandXML in the drawing
The grid surface with the void in the middle and the watershed, the pipe network at the top, the centerline with stations, the cross sections and the corridor, and the profile frame at the bottom.
Close up: stations, cross sections and network
The stations every 20 m with the number every 100 m, the cross sections with their station, the corridor edges and the structures and the pipe with its diameter.

Spirals, station equations, superelevation and cross sections

The centerline with the spirals and the station equation
The line, the entry spiral, the arc, the exit spiral and the line: the spirals are splines (objects of their own). At internal station 250 is the equation 0+250.00 = 0+300.00, and the stations follow the new numbering.
  • Station equation (StaEquation). At the internal station of the equation, the numbering shown restarts at the ahead station (the back station is the one it came from). The ticks every 20 m and the numbers every 100 m fall on the round stations of the new numbering; at the place of the equation there is the label "back = ahead". The stations of the cross sections and superelevation and the numbers in the profile frame come out in the numbering shown. Without staInternal in the file, the internal station is taken from the back station (assumed).
  • Superelevation (Superelevation). One diagram per alignment, below the profile: the stations horizontally and the cross slope vertically, with the 0 % and normal crown (±2 %) lines, the outside lane (red) and the inside lane (blue), pivoting about the centerline: the outside lane goes from the normal crown (−2 %) to 0 %, to full superelevation and back; the inside lane stays at −2 % until the outside lane passes +2 % and then follows it. The key points have the station below and the full superelevation is written (e = 6.00 %). LandXML does not carry the normal crown: Civil 3D's −2 % applies (assumed). The point names are those of the 1.2 schema (BeginRunoutSta, BeginOfRunoffSta, FullSuperSta, FullSuperelev, RunoffSta, StartofRunoutSta, EndofRunoutSta); without the full superelevation, the diagram says e = ?. At the top of the frame, at the start of each region, go the curve side and the pivot type ("Right curve · pivot about the inside edge"). The 1.2 schema has no field for either; BadBit CAD reads (assumed) the attribute of Superelevation, a child element with the same name or the Property (label/value) of a Feature inside it, with the names pivotType, pivot, pivotMethod, pivotPoint, rotationPoint, rotationPivot or superelevationPivot for the pivot (values with center/crown/baseline/axis = centerline, inside/inner = inside edge, outside/outer = outside edge, left/right = left/right edge; any other text appears as it came) and curvature, side, curveSide, curveDirection, direction or rot for the side (left/L/ccw = left, right/R/cw = right). Without the side in the file, the one from the geometry at the full superelevation station applies (the direction of the arc or spiral there), marked "(from the geometry)". The pivot does not change the slopes in the diagram (only the edge elevations). Both go back through LANDXMLOUT as they came, together with the superelevation kept whole.
  • Cross sections (CrossSects). One frame per station, four per row, below the superelevation diagram: the offsets horizontally (1:1, the centerline at zero) and the elevations vertically, with the smallest exaggeration of 1, 2, 5, 10 or 20 times that keeps the frame legible (written in the title, 0+040.00 (V×10)); the round grid with the numbers, the ground (orange) and the design (red).
The superelevation diagram and the cross section frames
At the top, the superelevation (the outside lane up to +6 % and the inside lane down to −6 %); at the bottom, the four cross sections, the last one at station 0+350.00 (after the equation).
The curve side and the pivot type in the diagram
The superelevation with pivotType="insideEdge" and curvature="left" in the file: the label "Left curve · pivot about the inside edge" above the diagram title.
Exact clipping by the boundary
The void in the middle of the grid: the triangles and contours are cut exactly at the line of the void, and the border shows the outline and the void.

Clipping by the boundary is exact, like the Civil 3D boundary: each triangle edge, each contour and the outline of the TIN are cut at the point where they cross the outer boundary, a void or an island (the elevation of the cut point is that of the edge, the face is planar); what is outside disappears, and a triangle that is entirely outside does not appear. The border drawn is the outline of the TIN inside the boundaries and the boundaries inside the TIN. The report says how many triangles were removed and how many were cut.

The report of the centerline with spirals
The spirals as splines, the stations, the superelevation drawn, the cross section frames and the station equation.

Pipe networks and corridors

Each structure (Struct) becomes a circle at the diameter in the file (the label height, if the file does not say), with the name beside it; each pipe (Pipe) goes from the edge of the start structure to the edge of the end structure, with the name and diameter below (T-1 Ø0.60). Rim and invert elevations, slopes and the rest of the network are kept: the first structure carries the whole network for LANDXMLOUT. From the corridor come the lines in plan it contains (the edges and the feature lines); the first one carries the whole corridor.

The LandXML import report

At the end the report appears, short: how many objects were created, what came out of each type, the spirals (splines) and what was left out.

The LandXML import report
What was created and what was left out; Copy puts the text on the clipboard.
The report of the complete LandXML
The complete file: the grid, the boundaries applied by exact clipping, the stations, the profile, the cross sections, the superelevation, the watershed, the network and the corridor.

Reading is tolerant: what BadBit CAD does not read yet is skipped and appears on a single line, with the count; unreadable numbers, faces with points that do not exist and references to points that do not exist are left out with a warning; a file that ends in the middle is read up to that point.

Exporting (LANDXMLOUT)

LANDXMLOUT opens the Export LandXML dialog with what goes into the file and the file name (next to the drawing, with its name and the .xml extension; … opens the system dialog).

The Export LandXML dialog
The selected objects (or, with no selection, the whole model), the count by type and the unit.
  • Points: those that came from a LandXML go back with the stored name, description, code and elevation, at their current position (if they were moved, with the new coordinates). Those drawn in BadBit CAD get the next free numbers, without elevation.
  • Surfaces: the border of the surface carries the whole surface (points, triangles and breaklines) exactly as it came. Select the border to export the surface.
  • Alignments, parcels and feature lines that came from a LandXML: if the polyline did not change, the original object goes back (with the spirals, the starting station and the profiles); if it changed, the elements come from the lines and arcs of the polyline, with the stored name, station and profiles. In an object with spirals, the first piece carries the object: if it changed, only its elements come from the drawing.
  • Spirals (the spline of each one): if the spline did not change, the spiral goes back as it came, bit for bit. If it changed (moved, rotated, stretched by the grips), the spiral comes out recomputed from the spline: its start and end, the PI at the intersection of the end tangents, the length, the end radii from the change of direction along it (an end that was tangent remains tangent if the clothoid fits that way), the direction and the clothoid type; the command line says how many. If the spline is no longer a clothoid (the best clothoid is more than 1/10,000 of its length away, 1 cm on a 100 m spiral — assumed tolerance), it goes as an irregular line (IrregularLine, through the points of the spline), with a warning on the command line and in the Export LandXML dialog with the name of the object and the deviation. Only a spline whose object (the first piece) also goes counts; a spline selected on its own exports nothing.
  • Polylines and lines drawn in BadBit CAD: feature lines (PlanFeature), with the layer name and a number.
  • Pipe networks and corridors: the first structure (or pipe) carries the whole network and the first line of the corridor, the whole corridor, exactly as they came (converted to the drawing unit).
  • Boundaries, watersheds, cross sections, superelevation and station equations go back with the surface and the alignment, as they came; a grid surface goes back as a TIN (its triangles).
  • What LANDXMLIN generated and has no data of its own (triangles, contours, stations, profile, cross section and superelevation frames, section lines and labels) does not go into the file.

The file is valid LandXML 1.2 (the namespace and version of the public schema, the drawing units) and the numbers go with all their digits: importing and exporting again gives the same points and the same faces, bit for bit.

Performance

A LandXML with 100,000 points and a 200,000-triangle surface (21 MB) opens without freezing the window: reading (0.2 s), the 1 m contours (0.03 s) and building the objects run in the background, with progress in the corner; the window only receives the finished drawing (measured on an Apple M2 Pro).

Not done yet

  • An edited spiral always comes out as a clothoid (or an irregular line): the bloss, sinusoid and other types go back as they came only if the spline did not change. The neighboring lines and arcs do not follow the edited spiral (if its end moves, the file is left with a step).
  • The superelevation normal crown is assumed (−2 %); the pivot type does not change the diagram (which shows the slopes, not the edge elevations).
  • Pipe profiles and the network profile view.
  • Exporting hand-drawn contours and triangles as a surface.
Search the documentation