Tuesday, January 27, 2009

AutoCAD Map 3D: Creating Calculations with Expressions

You can use operators and functions to calculate a new value based on existing property values. You can use the resulting value to filter or select data. For example, you can calculate the area of parcels and then select parcels whose areas are above a certain area value.

In AutoCAD Map 3D, you can store the resulting calculation as a new property in the Data Table. The calculated property is stored with the map, but is not written back to the original data store. To save the property to a data store,export the layer to an SDF file.

The syntax for calculations varies, depending on whether you use operators or functions.

There are two special calculations you can perform: finding the area of a polygon and finding the length of a linear feature.

You must be online and connected to the data store that contains the data for the calculation in order to create or manage calculations.

For some calculations, values do not update automatically because their underlying functions are not supported by their data providers. Instead, the values display as read-only properties. If you do not see a new calculated value immediately, refresh the layer manually. Right-click the layer in Display Managerand click Refresh Layer.

To perform a calculation using an operator

1. Select the command for which you want to create an expression.

2. In the expression area, do one of the following:
■ Enter a property name manually.
■ Click Property. Select the property you want.

3. To insert an operator, do one of the following:
■ Enter an operator for this property manually.
■ Click an operator button.
■ Click Operators. Select the operator you want.

4. Select or enter the value to evaluate.

For example, if you are multiplying the value of the property, enter the number or insert a property to multiply by.

5. Specify any further conditions for the expression.

To create a complex property evaluation, insert an AND or OR operator,and then insert another operator/property combination.

To perform a calculation using a function:

1. Select the command for which you want to create an expression.

2. In the expression area, click one of the following and select a function:
■ Math Function
■ Text Functions
■ Date Functions

3. Click Property and select the property to apply the function to.



4. Click OK to apply the expression.

To find area or length

1. Select the command for which you want to create an expression.

2. In the expression area, enter or insert the geometric function (Area2D or Length2D).

3. Insert the property Geometry in parentheses after the function.

The Geometry property may have a different name in your data store. It is always listed under Geometry Properties in the Property list. Insert the property from the list. Do not change it manually or substitute a value for this property.

4. Click OK to apply the expression.

Monday, January 19, 2009

AutoCAD Map 3D: Troubleshooting Validation Errors in Expressions

When you save an expression, it is always checked to be sure it is valid. You can also check whether your expression is valid before you save it.

The validation checks the syntax of the expression, whether the properties you specified are present in the current data store, and whether the values for those properties are valid.

When possible, the validation operation displays a message describing the errors it finds. Often, you can click this error message to place the cursor at the problem spot so you can correct it.

Validation might fail for one of the following reasons:

■ A separator character is missing or invalid. For example, you may use a function with arguments that need to be separated by commas. Perhaps one of the commas is missing, or you entered a semicolon instead of a comma.

■ An operator or property is missing. This is common in expressions with multiple conditions. For example, the expression PARCEL_VALUE > 100000 AND <> 100000 AND PARCEL_VALUE <>

■ A character or property is the wrong type. You may have used an operator that requires a numeric value and inserted a text character instead. You may have used a function that requires a hexadecimal value and supplied a numeral instead. You may have used a text property when a numerical one was required.

■ A required value is missing or “empty.” Perhaps you failed to insert a property value or a value for an argument.

■ The expression is missing a bracket, quotation mark, or parenthesis character. For example, there is an opening bracket that has no related closing bracket. This is common in complex expressions.

The validation process can help you avoid many errors, but it cannot guarantee that your expression will work the way you intend when it is applied. Validation does not execute the query against actual data, it only checks that the expression syntax is correct and that the properties and values are valid for the current data store.

Thursday, January 8, 2009

AutoCAD Map 3D: The Blog

Thanks for stopping by. Please take a look at the Blog Archives in the right hand column for great information regarding FDO, Database Linkage, Drawing Cleanup, Object Data, and Rubbersheeting. If you have any topics that you would like discussed please contact me at: geospatialtech@gmail.com

AutoCAD Map 3D: Overview of Expressions

An expression is the part of a query that specifies its
conditions. A query evaluates data and returns only the
subset of data that meets the query’s conditions.

For example, an expression might specify all parcels on
a particular street whose area is larger than 4000 square
feet. Only parcels that meet those criteria are displayed
or selected by a query containing this expression.

A complete query also specifies the set of data to which
the conditions are applied and the action to apply to
the data that meets the conditions. For example, you
can query a particular feature layer in a map and either
display or hide data in that layer, depending on whether
it meets the query conditions or not.

In practice, you specify the data set by selecting the
feature class or layer to query before you build the
expression. You specify the action to apply when you
select the command that lets you build the expression.

The title bar for the dialog box in which you create
expressions will be different, depending on the
command you choose. The contents of the dialog box
are much the same, no matter what it is called.

Use expressions to filter geospatial data, select a
subset of data, calculate values, or convert data from
one data type to another. Use text expressions to format
text strings for display, for example, as labels. Use
numeric expressions to apply math functions to
properties with numeric values.

Basic Steps for Creating Expressions

To create an expression, follow these basic steps:
■ Specify the data to which the expression will be
applied. For example,select the layer to filter.
■ Select a command that can use an expression.
For example, right-click a layer and select Filter To Select.
■ Use an expression to specify the conditions for the command.
For example, create an expression to specify the subset
of features on the layer to select.