Archive for the 'Tips or Trick' Category

Points to Blocks

With the survey tab of the map task pane we can bring points into a map and style them with our blocks to get the look that we may need, or when we import a point type shape file or any other format we can assign a block to the points on the import. (provide block name matches the attributes) But what if you have existing drawings that you have been using for the past few years that have AutoCAD points or they are standard AutoCAD drawing, or from some one else. ? What is the easy and quick way to insert blocks at those points? Well if those points are on there respective layers the Display Manger maybe the quick and easy way. Here is how.

Looking at my sample waterline map we have points that represent wells, both active and abandoned that reside on their own layers. 

points

First we start by creating a few new “Map Layers” in the display manager. To do this switch to the Display Manager tab, and select ” Add Drawing Data > Drawing Layer”. 

AddDWGLayer

Select one of drawing layers the points reside.

Layer1

Then click OK, we want to create the map layers separately so when we assign a block to the points we can control what blocks goes to what points. repeat to create all the new map layers as needed.

 

mapLayers

Once we have the map layers created we style them with a symbol by right clicking on the map layer and select “Add Style > Symbol”.

AddStyle

The symbol used is a default symbol of a square with and X inside it. To change it to the block we want we select the “Symbol Style” element in the display manager under the map layer and select properties.

StyleProperties

In the property palette for that element we chose the block to use for that map layer.

SetBlock

You can also set the scale of the block to your scale, leaving the scale at the default of (* 20 (VIEWSCALE)) will scale the block 20 times the view scale. The default scale will scale the block up/down as you zoom in and out of the drawing and regenerate. Change the name of the element to represent the blocks. Repeat the steps for the remaining map layers.

To go a another step further in the display manager we can change the symbol shown in the display manger and for a legend if you decide to create one later on.   Do this by selecting the map layer in the display manager and go to it’s properties in the property palette.

setSymbol_legend

 

In the property palette, change the Thumbnail Preview to Block and select your block.

Thumbnail LegendBlocks

Repeat for your remaining map layer.

Now your points display as your blocks.

blocks

If you need to share the map to standard AutoCAD users you can use the tool icon and Save Current Map to DWG.

The Sample Folder or A Few LISP Files to Use

When was the last time you looked at the files in the Sample folder that gets created in the Program Files/ AutoCAD Map3D 20xx ? If you have not looked in years then let me point out a few lisp files (.lsp) that are there and may be of some use to you. Some of them are just samples and meant to be samples of what you can do with lisp programing and Map3D, however there are a few that you may want to use once in a while.

The first one I like is the makegrid.lsp.  What this does is create a grid from rectangular polylines with numbers/text inside each rectangle. It allows you to select the base point for the grid, the number of rows and columns and the size of each. With the number inside the rectangles it allows you to add a prefix and the number of digits for the number. So what do I use it for? A number of different uses but one is for creating a grid for a mapbook. Other times I may use it to create a grid if I’m creating a new line type or AutoCAD shape. Having a grid of 1×1 makes it easy to know when and where my pen up or pen down will be writing out the file.

The next one I like and use every once in a while is the copy_OD.lsp. This allows you to copy object data from one object to another. If you ever exploded a multi-segment pline to individual lines you found out the OD attached doesn’t get copied. This sample allows you to copy that OD to each line segment afterwards.

The listpt.lsp writes out the vertices of a polyline to the command line. If you use it notice it has the points inside parenthesizes  ( ), this is an “Autolisp list” but you can still it if you need to check the vertices of a polyline.

Need to see what direction an object  is going or where the start point is? Then the dirarrow.lsp is what you need to use. This sample will show a directional arrow pointing in the direction the object (Lines, Plines, Arcs) is headed. The sample uses the grdraw function which draws the directional arrow on the screen and not in the dwg file, A regen or redraw action removes the arrows from the screen.

If you are not familiar with using a lisp file with these you can drop and drag them from windows explorer into the AutoCAD editor window and the command to use them is printed to the command line. Done of them have a fancy dialog box or any help files on using them remember they are just samples but you might find some use for them. Or if you like to get into learning lisp they make  a good starting point. 

Transparency of Images

If you tried to set an image transparent with the normal transparent tools you found out it only works with one color. If fact all it does is turn off that color you select and is not really making anything transparent. Transparent as defined by Merriam-Webster is “fine or sheer enough to be seen through”. There is no see though when you just turn off a color. Using the data connect with FDO we can make polygon features transparent should we be able to do the same for images? Well we can with a little trick.

First we need to use the data connect to add the image to our map. Then save the image layer to “LAYER” file. When you save the layer it creates a file with an extension of layer,  If you are not aware of what a layer file is, it’s an xml file that contains information on the data file as to how it is connected to the map, the data it contains (spatial & data),  and how it is displayed or theme. Once you saved the image file to a Layer remove that image layer from the display manager and disconnect from the file(s) in the data connect palette.

Now browse to the image.layer file you created and open it in “Notepad”. Scroll down until you see the tags;

 “<FeatureName>rasters:Name</FeatureName>”  “<Geometry>Image</Geometry> “

Now insert between the two tags

<Opacity>0.5</Opacity>

layer_edit

Save the file after you edited it. The number 0.5 is the amount of transparency with the larger the number the more transparent the image will be. 0.9 is almost translucent and 0.1 is of little transparency. Now use the Load Layer tool from the Data Icon in the Display Manager to add the image to the map.

So why would anyone need an image to be transparent to start with when we can place it at the bottom of the draw order and make all the other layers transparent?  First off, how often have you reopened the map to find out the draw order was not as you had it set when you closed the map drawing? Another reason you may want to set an image to be transparent would be if you have overlapping images in the map. Maybe you have an current aerial image and an aerial of the same are that is 10 yeas ago and you need to do a time lapse study of the area. Toggling the images on and off can get frustrating after a while, where as having one transparent will allow you to see though it to do the analysis a lot easier.

Here are a few before and after screen captures of the results.

Normal 

How we normally do it with the image layer at the bottom of the display draw order and the polygon with transparency.

image_Transparency

Here is with the image with transparency at 0.5 and the image layer at the top of the display draw order.

closer_look

A closer look of the above. Notice how the street centerlines show though the image file.

If you look close enough you will see a grid pattern in the image after we make it transparent, I only guess that is the way Map3D renders the image but after a test print of the map the grid is not getting plotted so I see no harm in it being there. Also do not forget about the MAPPLOTTRANSPARENCY command if you want to plot with transparency.

Negative Buffer Values

A while back the question came up if anyone used negative values to create a buffer in another forum. I thought WHAT? Most of  the buffers I create are with point or line type objects, if you do a -10 distance buffer of a point or line object what do you get? Nothing! However you can create a negative buffer from a polygon object. Michael Schlosser from  the Autodesk north of the border team shows how to use it and provides a good example of why you might want to here on his blog.

Raster Images problems?

Are you having trouble printing with images files inserted into you maps? There are a few things that may help that are not documented very well. First there’s two system variables you may want to change. The first one is “RASTERPERCENT” (Sets the maximum percentage of available virtual memory that is allowed for plotting a raster image.) That’s all the Help file tells you about it. The second one is “RASTERTHRESHOLD” and the only help info is; “Specifies a raster threshold in megabytes. If the plotted raster image exceeds this threshold, the availability of system memory is checked. The plot is aborted if the image is too big for the available memory.” Now that last statement sounds like what a lot of users are reporting, the plot cancels out when they have a large image in the drawing. So just how can these two variables be fined tuned? Up the value for both of them , I heard replies from others that setting them to 90 and 100 respectively works wonders. However keep in mind they set or reserve a percentage of your virtual memory for images locking up that memory for other objects. You may want to try 30-40 for the settings then if you need to go up from there until you get the plot right.  The values are stored in the registry so once set they are retained until you set them to a different value.

Another area to check is in the plotter property settings for the plotter you are sending the drawing to. Most plotter/printers have the Raster Graphics settings that you allow you to set the resolution down a little to get the plot size down to a manageable size by moving the slider to the left.

Plotter_property

In the settings for my HP PSC 1200 printer if I move the slider to the left a few clicks it makes the plot size smaller thereby not requiring that much memory, yet the quality of the plot is not effected to a noticeable degree once it is plotted on a sheet. Each plotter’s model and brand will be a little different with the drivers used having a part in this as well, so there’s no way to have a one size fits all here. All you need to do is experiment with all of these settings and do a little trial and error.

Rotation of Blocks or Text

Do you need to export text or blocks to a GIS format and then try to data connect to that exported data and fine that if the blocks or text features are rotated that the rotated value you used on the export does not match the rotation for the features in the original drawing? The reason is when you export with the rotation property it is in Radians not Degrees. So if you need to rotate the symbols in the data connect to  the original rotation angle the rotation value in the data table needs to be converted.

Here is a dwg with the text as AutoCAD text objects.

TheDWG

Here what happens when you label those features with no expression in the style editor for the data connect.

NoRotation

Here they are using the default “ROTATION” property from the data table.

Rotation_Property

Not what we expected, is it?
So how can you convert them from the radians to degrees? Simple an expression in the expression builder will do it.

( 180.0 * ( ROTATION  /  3.14))

Expression

Now when they get labeled the rotation is the same as the original drawing objects was.

Rotation_by_Expression

This also works with blocks you have rotated in a drawing that you later connect to with data connect. If you find yourself with a lot of features from different files that need this expression, don’t forget about the option to export that expression allowing you to later import it to use for any feature file that has the “ROTATION” property.

Exporting to SHP with Civil 3D and Errors

A few Civil 3D users are getting errors and the quick exit  out of Civil 3D when they try to export to ESRI shp format with Civil3D 2009. One thing they need to check is the mapexport.ini file located in the C:\Documents and Settings\All Users\Application Data\Autodesk\C3D 2009 folder. The ini file can be opened and edited in Notepad or any text editor. Look for a section called [SHP]

[SHP]
File=True
Rootname=False
EntTypes=All
FeatureClass=Single
CreateClassBy=None
SupportsAppend=False

If it looks like the above then edit the value for EntType to Type instead of all.

So that it looks like this:

[SHP]
File=True
Rootname=False
EntTypes=Type
FeatureClass=Single
CreateClassBy=None
SupportsAppend=False

Save the changes and close the file. Now when you call the mapexport command in Civil 3D you will get the old dialog back that allows you to select the object types. You will need to select the object types (point, lines, polygon,  or text)  to export.

The reason the ALL value is causing errors is ALL = ALL to include the Civil 3d objects, and as we all know Civil3D objects do not play nice with Map3D. If you are still getting errors on the export review the post here  and watch the file names or here for a little tip about exporting text. 

Update for 2010 Civil 3D : Looks like the issue is in the 2010 version also.

Good Looking Annotation Blocks

Tired of the plain looking annotation blocks used for labels? Annotation blocks can contain geometry along with the data tags or attributes. A lot of users forget the annotation blocks are blocks and do not think about adding complex objects to them.

So if you want your labels to stand out and look more like “That Other Software” then think about creating your blocks with some symbols.

In my example I have a road map that has an Interstate highway in it. Instead of having a text label of “I-24” I created my annotation block with the interstate shield and the data value as the number.  The Red and Blue colors are solid hatch and the INTERSTATE letters are polylines. The Express Tools “Explode Text” works good for creating the letters.

clip_image002

The Interstate Shield Marker

Start with your marker or shield in this case, create it as you would a normal block and save the block definition. Hint, I create all my blocks and symbols in one file then use the design center to drag and drop as need in my maps.

Once you have the shield/marker created then go about creating the annotation template as you normally would.

clip_image004

Once you get into the block editor, before you create the Annotation Text, insert and explode the shield block you create. Do not forget you have all the AutoCAD commands and tools in the block editor, you can create layers, insert blocks, create text or most anything else you would do in AutoCAD. Now with the marker placed you where need it, go ahead and create the annotation text.

clip_image006

You need to keep in mind the text style, height, justification and the color for the annotation text. To simulate a white color I use color 255, a light gray, this way if I use a white/black background scheme in the drawing editor the color will stay.

clip_image008

With the annotation text placed, you may need to set the draw order of it to the front to ensure it is always over top of the hatching in the marker.

Now save and close the block editor then label away.

clip_image010

The finished Annotation Block in used, getting the text value from my OD table and using a nice symbol to label my Interstate Highways. You are not limited to just the interstate marker there’s plenty of road sign markers you can use in your maps. US Route or State signs can be created also, or how about speed limit signs or even city street signs.

For a refresher on getting some symbols to use and not having to start from nothing, http://map3d.wordpress.com/2006/02/25/want-those-esri-symbols-in-your-autocad-map/

Label Those Lot Lines

Do you ever have the need to label lot lines in Map3D? Civil3D users have the parcel labels but with just Map3D it was always the old text command. Try using the map annotation block features instead. Here’s how you can create a annotation template that makes it a little easier. First the lot or parcel lines need to be lines or single element plines. So if you need to use the drawing cleanup tool first to break those polygons or closed plines into single element plines.
We start with creating an annotation template then use the property value “Length” for the value for our length tag. But we need to add a few extras to make it look right. First thing we don’t want all the labels to be 8 decimal places long, two is the standard most places, and second we need to add the FT (single quote) mark at the end.

length_tag

So to accomplish this the value should look like this
(STRCAT (RTOS .LENGTH 2 2) “‘ ” )
The RTOS converts the real (Length) value to a string value with the first 2 being the units type as Decimal and the second 2 as the precision. The STRCAT and the “‘ ” (double quote, single quote, double quote) then takes that length value and adds the single quote mark at the end. If you work in Meters you can replace the single quote with Meters, just make sure you keep it inside the double quotes. For the text options use your text style you need and for the height use the value that will meets your standards. Keep the rotation at 0 but set the justification at Middle Center. Use you own standards on the object properties for layer,, color and lineweight. 
When you click OK and are asked for” Specify middle-center of text: ” go with 0, “your text height” this places the tag at it’s proper location with the justification at middle center.
Now for the bearings part of the annotation. Start a new annotation tag and for the value we use the angle property of the line but convert it to a string.

Bearing_tag

We do this because the angle property returns the angle in Radians not in degrees. So the value will be (ANGTOS .ANGLE 4 3).
The ANGTOS converts the radian value to a string and the 4 tells it what angle type to use in this case Surveyors and the 3 is the precision, taking it all the way down to seconds. Set the text options the same as for the length tag and the object options to your standards. This time when you are asked “Specify middle-center of text:” use 0, – “your text height”, to place it below the length tag.
Save your template and use the annotation tools in Map3D to label your lot lines. When you insert the annotation blocks is when you need to set the rotation value so use the expression .ANGLE to set it. Doing it here makes for cleaner labels and keeps the two lines aligned.

Rotation

 

Now for a couple of disclaimers: The annotation angle will be in the direction that the line was created. Most surveys start at the POB and go around in one continuous path. The labels need to follow that rule, that’s the way I was taught years ago and that’s the way I taught for years. However if your drawing is from a source that doesn’t follow that rule or you used the drawing cleanup tools the line may not be drawn in the proper order and will need to be adjusted. Another thing is the text may be upside down or on some of them the length is on the inside with the bearing on the outside while others are vise-versa. By setting grips enable for blocks and using the two tags instead of a multiline attribute tag allows you to move and adjust the placement as needed.

Labels

The Finished project.

Annotation Blocks Manipulation

Do you need to use annotation blocks to label some of your features and want to combine different values. For example you want a label with the value coming from an object data table field 1 & field 3 and maybe you want to add extra text at the end of the value. Maybe you want to use the area property of a polygon but need to round the value up.

Well you can with using a couple LISP functions in the value expression. Do not worry about having to write a lisp routine, it’s not that hard just keep in mind the parentheses matching must follow a set of rules. Sort of like in a math expression you need the same number of right parentheses to match the number of left parentheses and AutoCAD process them in matching groups or list. The one important item of using object data or object properties in an annotation block expression is the field or property type. Integers, character, real or point for object data type and integer or strings for the object properties.

In my example I have OD with a field for house number (house_num) and a field for the street name (street_nam) in an OD table named Parcels. I want to create a label with the complete address such as 123 Main. To do this with a lisp expression I use the STRCAT function like so:

(STRCAT :house_num@parcel “ “:street_nam@parcel)

What this means in layman terms or something you might understand is the first part is the left parentheses ( followed by STRCAT, strcat stands for string concatenation, the next part :house_num@parcel get the house_num field value from the parcel OD table. Next we have two double quotes with a space between, this will place a space between the two OD field values, otherwise we have 123Main, next we have :street_nam@parcel, this returns the street name from the parcel OD table, last we close it out with the right parentheses.

Now let’s say we need a label that lists the area of a polygon but instead of having all those places behind the decimal we want to round it up or down to the closest whole number. In this case we use the lisp function RTOS, RTOS stands for Real TO String, with the area property of a polygon the value type is a REAL so we convert it to a string and tell it what format and the number of decimal places to use for the string. It would look like this:

(RTOS .area 2, 0)

We start again with the left parenthesis ( followed by RTOS then .area. The (dot) .area will return the property area of the object. Next we have two numbers separated by the comma, the first number is for the unit format we want the value to be converted to.

1-Scientific 2-Decimal 3-Engineering (feet and decimal inches) 4-Architectural (feet and fractional inches) 5-Fractional

The second number is for the precision, if we use 0 it rounds the value to the nearest whole number, 1 will be one decimal place,2 will be two decimal places, and etc. Then we close it with the right parenthesis

How if you want to combine the STRCAT and RTOS functions together we can, say we want the area of the polygon and a suffix of Sq Ft. We can use something like this:

(STRCAT (RTOS .area 2, 0) “ Sq Ft”)

Notice the (RTOS .area 2, 0) is grouped together then it is grouped inside the STRCAT “ Sq Ft” list. This returns the area in decimal format with no decimal places and then concocts it with the Sq Ft string.

So there you have it a few simple lisp expressions that will allow you to manipulate your expressions values to create some labels with out having to fiddle with multiple attribute tags and text justification. Note these work in the annotation blocks and if you try using them in the style editor for data connect (FDO) data they do not work, I’ll post a few tips to get good looking labels using FDO later.

Next Page »


Archives

Readers Locations

 

November 2009
S M T W T F S
« Oct    
1234567
891011121314
15161718192021
22232425262728
2930