6 Sep, 2006

### For years, AutoCAD hasn't worked well with large coordinates in civil engineering and survey drawings. Here, we offer some workarounds.

There's a bug in AutoCAD that's been around for years: AutoCAD doesn't work well when using large coordinate values. Hatches won't fill, the Trim command doesn't always work and other annoying "gotchas" can occur.

So what is a "large" coordinate value? We're referring to x,y values in the millions. Of course, this is not a problem for the many users who work with much smaller coordinate values. But if you do work with large coordinate values, we have some workarounds to help you overcome AutoCAD's shortcomings.

Why Use Large Coordinate Values?
Civil engineering and surveying CAD users generally draw objects with endpoints that correspond to precise locations in the real world. The x,y coordinates correspond to some set standard of Easting and Northing coordinates, usually State Plane. This answers the question for all you noncivil/survey types -- no reflection on your personality, we assure you -- who have ever wondered why in the world DWG files received from civil engineers or surveyors have x,y coordinates in the millions.

State Plane Coordinates
So what exactly are state plane coordinates? Well, the University of Minnesota defines state plane coordinates as "A system of x,y geographic coordinates defined individually for each state. Locations are based on the distance from a unique origin for each state or portion of a state." According to the Kings County, California GIS knowledge base, the State Plane Coordinate System was developed for surveyors and mappers by the U.S. Coast and Geodetic Survey back in the 1930s to establish a common reference system.

To sum up: Civil engineers and surveyors commonly use state plane coordinates to create objects in DWG files that surveyors can then precisely stake on the job site. In Southern California, state plane coordinates are in the 6,100,000 Easting (x coordinate) by 1,900,000 Northing (y coordinate) range.

Note: This is also why civil/survey DWG file scales must be set to 1 AutoCAD unit = 1 foot. Move a building in a civil/survey DWG file from its state plane coordinates to 0,0 and you'll build it 1,000 miles somewhere out in the Pacific Ocean.

And why do the State Plane Coordinate Systems use such large coordinate values? Simple. Back in the 1930s, engineers and surveyors wanted to be sure they never had to work with negative numbers -- too hard to calculate by hand or by early mechanical calculators such as the Curta "pepper grinder."

Large Coordinate Problem
Now that we've established why civil engineers and surveyors must use large coordinates in their DWG files, let's examine the challenge this creates. Look at the following parking island under construction. Note the yellow-highlighted state plane coordinates -- which establish where in the real world this island will be built -- the typical method of creating this island. Parallel lines and arcs are offset at specified distances, then circles are constructed tangent to those lines and arcs.

 A typical AutoCAD drawing indicating the real-world location of the project.

To complete the island design, we then trim the construction lines to each other. Because we created the objects tangent, perpendicular or parallel with each other, trimming and/or extending lines and arcs should be easy -- but it's not. In this example, one of the tangent-tangent circles presents a problem. Neither construction line, nor the circle itself, will trim properly, resulting in the need for a workaround.

 When the drawing coordinates are large, AutoCAD gets hung up trying to trim construction lines to each other.

Before establishing a workaround, it would be prudent to determine exactly why tangent lines, circles and arcs occasionally won't trim to each other. In fact, those same lines, circles and arcs will trim to each other, but only if the objects reside at a location where coordinate values are much smaller. To prove this, I moved the entire parking lot near 0,0 then repeated the island design process. That last circle did trim. This issue is the result of using state plane coordinates -- or more correctly stated, it's the result of working in locations where AutoCAD coordinate values are very large.

You might have heard that AutoCAD calculates values to 16 decimal places. As it turns out, AutoCAD calculates objects based on a maximum number of 16 total digits. In other words, an x or y coordinate can only comprise a maximum of 16 digits, not a group of numbers to the left of the decimal point plus 16 numbers to the right of the decimal point. For example, using a small coordinate value such as 1.234567890123456, gives 15 decimals points of precision -- a lot of numbers to the right of the decimal point. In contrast, using a large state plane coordinate value such as 1,234,567.890123456 gives only nine decimal points of precision, or nine numbers to the right of the decimal point. This means that the more digits you have to the left of the decimal point, the fewer digits you can have to the right of the decimal point -- therefore, less precision.

When AutoCAD calculates objects near 0,0, it calculates with a six-decimal precision advantage over objects calculated near 6,100,000;1,900,000. That resulting large coordinate rounding error causes AutoCAD to see some objects as not actually intersecting and, therefore, it won't trim them.

This very annoying issue has been around for a long time. But to be fair, this exact example in AutoCAD 2000 would have resulted in three errors rather than the one error you'll encounter in AutoCAD 2006 and AutoCAD 2007. And in AutoCAD 2000, the error was measurable. In my example, the distance between the end points of trimmed lines, points that should have had the exact same values, was 0.00000563. Today the same measurement yields a value of 0.00000000.

Although partially resolved and less frequent in the current release of AutoCAD, this problem nevertheless persists and is still frustrating users. It's especially bothersome for someone trying to accurately draw objects using common commands such as Trim and Extend and is compounded by the fact that AutoCAD offers no measurable evidence or warnings that it sees those objects as nonintersecting. The command simply fails to execute.

If you'd like more technical information about the cause of this issue, check out two of Shaan Hurley's Autodesk blogs related to 64-bit computing. The first one explains the rounding problem in detail. The second examines the impact on AutoCAD.

Making It Work
So far we've established that civil engineers and surveyors must use large coordinates, and that large coordinates sometimes result in AutoCAD operational issues. Now what? Following are some tips and tricks that will help you work successfully in AutoCAD when you need to use large coordinates in your drawings.

• Use state plane coordinates, but draw additional trim lines whenever the issue is encountered. (Compare the figure below to the previous version.) This option works, but is annoying to use because of the extra effort required.

 You can work around the large coordinates issue in AutoCAD by drawing additional trim lines when you encounter the problem, but it's a cumbersome option.

• Use state plane coordinates, but temporarily move your site closer to 0,0 while you are designing it. This option will create issues when others xref your site into their drawings or if you forget to move the site back to the correct coordinates when the design process is complete. Accidentally moving the site to the wrong coordinates is also a very real concern.

• Use state plane coordinates and momentarily move your specific work area close to 0,0. In our example, we would move the island area to 0,0, execute the Trim command, then move the finished island back to state plane coordinates. Again, accidentally moving the island to the wrong coordinates is a real possibility.

• Develop a LISP routine so that you may use state plane coordinates as your working basis while the routine temporarily moves your trim objects to 0,0, then moves them back when the trim operation is complete. This is an extremely sophisticated workaround that requires a high level of expertise -- or a buddy who happens to be an AutoLISP expert.

• Set up your entire project using truncated coordinates. In other words, set up your project so your design team knows that 0,0 actually represents 6,100,000;1,900,000 and have your survey team translate the values. This option requires everyone on the project team to understand that the DWG coordinates are truncated and must ultimately be adjusted prior to field construction.

• Don't use state plane coordinates. Use a per-project coordinate system based on a generic coordinate pair (such as 5000,5000 or 10000,10000) located at a major landmark such as a street intersection. This option makes a translation to state plane coordinates very complicated because the adjustment will likely result in a fractional value.

• Set up your Autodesk Land Desktop Northing and Easting as state plane coordinates while your AutoCAD world coordinates are 0,0. This option requires the use of Land Desktop and a shared Land Desktop database by all team members to correctly obtain coordinates. Everyone must understand that the AutoCAD WCS (world coordinate system) is not being used. This option requires coordinating all project drawing files and frequent communication with team members.

• Define an AutoCAD UCS (user coordinate system) to read state plane coordinates while the AutoCAD WCS reads 0,0. This option once again requires complicated continued coordinate-management for the life of the project in all DWG files.

• Contact Autodesk customer support and provide product feedback about the problem and request a fix. After all, you pay for subscription each year to get a better program the next year, right?

• Join AUGI (Autodesk User Group International) and submit this issue as a Top Ten Wish List candidate for future AutoCAD improvements. Membership is free.

• Don't use a coordinate system. Draw objects at will. This option is easy and gets around the large coordinate issue, but will likely get you fired if no one else uses "your" coordinate system.

By understanding how AutoCAD works with large coordinates, you can determine the work process necessary to successfully complete your civil engineering/survey drawing. It's up to you to choose a solution that will meet the needs of your project, your in-house team and your external project collaboration group. This ongoing problem doesn't appear to be going away any time soon, so make a decision that will serve you well long-term.

# About the Author: Michael Partenheimer

More News and Resources from Cadalyst Partners

For Mold Designers! Cadalyst has an area of our site focused on technologies and resources specific to the mold design professional. Sponsored by Siemens NX.  Visit the Equipped Mold Designer here!

For Architects! Cadalyst has an area of our site focused on technologies and resources specific to the building design professional. Sponsored by HP.  Visit the Equipped Architect here!