Archive for the 'Map 3D how do' Category

Plain Text from Object Data

Have you ever imported ESRI SHP files or other GIS files and need to create some simple text labels for that data? Do you have some object data attached to entities that you now need to display that data in the drawing? One method of displaying or labeling those entities is by using Map Annotation Blocks or use FDO. But what if you need something quick and as plain text?

I see questions on how to do this or can Map3D do this. Yes it can be done. You can use the Map3D display manager to query the current drawing then create a “Map3D” text style in the display manager.  

So lets look at the drawing I have for the example.

OD_Info

It’s a simple parcel map imported from an SHP file and object data was created on the import. What I need is to label each parcel  from that object data with the Watershed1 value.

The first step is opening the Map3D Task Pane and using the Display Manager tab. If the task pane is not open use the command MAPWSPACE and select ON at the command line.

Add_Layer

Now click on the Data icon in the display manager, scroll down to “Add Drawing Data”  then select “Query Current Drawing”

The Define Query dialog will open allowing you to define the query. I want to query on my object data so I select “Data” for the query type. The Data Condition dialog will open allowing me to select the data to query on. I select “Object Data” make sure I have the correct Table listed (Parcels), select the field I want the label to display (Watershed1) then for the Operator and Value I use = (equal sign) and * (the wildcard expression).

query

As soon as I click OK it populates the upper part of the Define Query dialog. Clicking OK in this dialog takes me back to my drawing.

I now have a new object or a Map3D Display Manager Layer listed in the Task Pane.

new_Layer

The next step is to add  a text style to display the text that is being queried in on that new layer. TIP: When we say Layer in Map3D Display Manager it is NOT an AutoCAD layer and has no relationship to the layer manager or any of the AutoCAD layers.

To create our text style for our data labels we right click on the layer name in the Display Manager and select “Add Style” then “Text”.

Add_TextStyle

We now have another object in the Display Manager under the “Current Drawing Element” layer named “Text Style”.  Highlight the “Text Style” in the Display Manager and look at the properties of it in the property palette. (Right Click and select Properties to open the property palette.)  This is where we tell it to display the values from the Object Data table.

Select the Value- Text Label to show the ellipsis icon (the 3 dots) Click on the icon to open the Expression Chooser. 

TextStyle_default

In the Expression Chooser, expand the tree to get to the Object Data field to label from. Select the field and click OK.

expression 

Back it the Property Palette set the Height as needed and any other property you wish. Notice I changed the Height to 10 and provided a better fitting name for the text style.

Text_Final

Notice as you start to make changes in the property palette for the Text Style the labels change instantly allowing you to see the changes as you make them.

Labed_Drawing

Now back in the drawing we have labels for all of the parcels and they are plain AutoCAD text objects. No FDO text style, no Civil3D label and no Map Annotation blocks.

Add Custom Toolbars or Commands

Ever need to create your own toolbar or command in AutoCAD? Maybe you have some custom lisp routines you been using for years and need to add them to your current version of AutoCAD MAP3D. Even if I’m pro-ribbon there may be a time when a toolbar may be easier to get to those custom routines.

To do so we need  to check a few things and think out what we want. Most all commands now will allow to to link a icon to them. So first we need the icons and a folder to store them. For this the icons need to be bmp format and 64×64 pixies work fine for me. Next is the folder these need to be in. Look at the Options and see where it looks for them.

IconFolder

Next is the folder that your lisp files or scripts are located in. Again these need to be in the support path and I like to them all in their own folder on my local drive. (network location if you want to share them same for the icons.) Keeping them separate from the program files/ AutoCAD directory makes it easy to upgrade or do a repair, you don’t have to worry about them getting deleted on a uninstall.

Now after you create your icons, paint works fine for me, and the folders set up we start in the Customize Users Interface or CUI. The CUI command will open it for you. The first step I do is create a new CUIX file, again this is one of the safe ways to keep your custom toolbars/ribbons etc. from being deleted and allow sharing. In the CUI (expand it) click on the transfer tab at the top. Then on the right side select click on the icon to create a new Customization file. (looks like a new folder icon) Provide a name for the CUIX and set the location in the folder you have listed in your Options Support files.

CUI_Location

Once you create the file go back to the left and click on the Customize tab at the top. All you did was create an empty CUIX file so now we need to load it and add our toolbars or ribbon tabs/panels. To load it scroll down to the Partial Customize Files in the tree to the left side and right click > Load Partial Customized File. Browse to the file you created and load it. 

load_Partical

Once you load it that partial CUIX should be the one listed in the drop down list at the top.  If not switch to it. This is where we want to create you custom toolbar.

partical

Expand the tree for the toolbar section, right click on the Toolbar and select New Toolbar.

newToolbar

The right side of the CUI changes it’s display and allows you to name the tool. The default name is Toolbar1, just rename it by typing over the name. The rest of the parameters for it can stay with the defaults.

Now we just need to create the commands to add to our toolbar. To do so at the bottom section of the CUI is where the commands are for the custom CUIX file. By default it has none in the list. So click on the icon to create a new command. (the icon with a STAR and orange color sun on it)

command1

As the right side changes display we start to fill in our parameters for that command. Provide a name for the command, set the Macro to run the custom command, this can be the command to run a lisp routine or create your own macro if you know how to use macros. Next select the image(s) to use for that command.

commandSetup

Now we have a complete command in the command list. The next step it to add that command to the toolbar. Select the command and drag it to the toolbar above.

Add2TB

Now create the rest of your commands and drag those up to your toolbar as well. When you have all of your custom commands create switch to the All Customized Files at the top in the drop down list. Highlight your current workspace in the tree on the left, then on the right side expand the tree for the toolbar and you should see your new toolbar.

check

If not you can load that toolbar into the workspace by Clicking on Customize Workspace button on the right, then expand the partial customize files on the left, expand your custom CUIX and place a check mark in the box for the tool.

 addtoolbar

When you are done click the Done button on the right side.

Click the Apply button at the bottom to close the CUI and you should have your new toolbar in AutoCAD MAP3D. These same steps will allow you to create a new ribbon tab and panel with your custom commands as well. Just remember a command goes in a Panel, a Panel goes goes in a TAB of the ribbon. Create the Tab then the Panel, place the commands on the Panel then drag the Panel to the Tab. 

Using AutoCAD MAP3D Document View

As promised here is a sample of using the Document View functions in Map3D. To set the stage for this we set the scenario as so. We GPSed the utility power line with a handheld GPS unit. As we GPS the pole we also took a picture of the pole, we tag or named the image file the same as the pole number. When we got back into the office we downloaded the images into their own folder on the server alone with the GPS points and data we collected in the field. We then imported the points and created the object data tables from the point data. So now we want to link those images to our points or poles block in the map so as we click on a pole we can view the photo we took in the field.

This is a good example of using the document view tool. The first step is making sure the OD table has the correct information and fields in it and that the images are in a folder that we can get to.

OD_Table

Image_Folder

Looking at my example we see the OD table has a field value that matches the image file names.

Once those two steps are complete we have to define the Document View. In order to do this we need to be in the Classic Map workspace. Looks like whoever created the default Ribbons for Map3D forgot these commands or thought we didn’t need them. Using the Map menu pulldown select the Define Document View from the Object Data section.

menu

In the Define Document View Dialog (Yes the old style dialog that you can not resize) We set up the parameters Map3D uses to open/display the images.

Define

1. Give the definition a name and description.

2. For the expression in my example I use the PoleNumber field from my Pole_No_OD Object Data Table. You can use the Expression button to browse and select your expression. (Do not confuse that with the FDO expression builder)

3. Select the folder where your documents are stored, you can use the browse button to get to it.

4. Type in the file extension for the type of document you want to view. In my example its jpg but you can also use word documents or (almost) any type of document to view.

5. Next you need to provide the command line for the application used to open and view the documents. Again use the browse button and browse to the exe file that will open the document. With my example and images as my documents I selected my installed IrfanView application, I could used Paintbrush as well but I like the speed of IrfanView.

6. Click the ADD button to add it to the list at the top.

Now the Update button is nice if you need to go back and change one of the parameter. Nice to have for the first few tries, you do not have to start over if something does work the first time, edit and update.

Now that you have the document view defined, to use it select the View Associated Document from the Map menu Object Data section and select the object with the OD table attached. If everything works you should have that document open up in it’s own application.

 

The sample in action.

Greek or Nerd (Using links in OD Tables)

To start I’ll say I’m one of those geo-cache hunters that spends my free time looking for Tupperware hidden out in the woods using million dollar satellites. If you don’t know what a geocaching is here is a link. So thinking I would tie it into AutoCAD MAP3D and have a little advance over the next guy, I like viewing those little hidden treasure location in a map and see them all at once and in relation to each other.  As doing so I figured I would share a little solution that many Map3D users have asked over the years. That is how can I open a hyperlink from my data.

To start here’s a look at my map and the object data I have attached to my geocache points.

OD_Data

The points are the standard AutoCAD points with object data attached. The data contains a field with a value to a web site page. So how can I open the web page up to view it with out the old copy from the OD table and open my web browser and paste the value into it. Simple. Just use a little lisp routine that I’ll show you how you can customize to fit your Object Data table and fields names.

Here’s my version of the lisp file;

(defun c:FL (/)
  (setq ent (car (entsel “\nSelect point to follow link”)))
  (setq link (ade_odgetfield ent “waypoints” “url” 0))
  (command “Browser” link)
)

All you need to do  change the table name and field name to meet your meets. In my sample my table name is WAYPOINTS and field name is URL. Just write your lisp file with those changes after the (ade_odgetfield ent in line 3 of my example. Save the lisp file, load it in your drawing, then use the command FL to Follow your Links.

Now if you need to link to a image file or another file on your network I will post about using the object data document view tools that works for those later.

A quick video of it in action.

Custom Line Types with Data Connect

A number of users have been asking about using custom line types in their maps with features from the data connect, both in the AUGI forums and the Map3D Discussion Group. I would answer with a yes BUT replied. Why? Cause it’s not as simple as loading a lin file like you can with AutoCAD objects then set that object’s layer to use those line types from that lin file. So can it be done? YES. Here’s how in some simple as I can make steps. It takes a little preplanning but here is what I want to do in my example.

I have a SDF file (line type) that represents a 3 phase electrical power line, I want to display it with 3 vertical tic marks (perpendicular).

3Phase_Standard

The original display.

  • First enable enhanced stylization in Map3D.
  • Add your feature data (line type) using the enhanced stylization.
  • Save that data layer to a layer file.
  • Edit the layer file.
  • Then add that layer file back into your map.

So to start we need to edit the windows registry to enable the enhanced stylization. To do this edit the key in the registry named;

“KEY_CURRENT_USER\Software\Autodesk\AutoCAD\R18.0\ACAD-8002:409\Applications\AcMapDataConnectUI”  Note: the numbers may vary depending on the version of Map3D or Civil 3D you are using.

Set the value to 1 to enable it.

Next open up Map3D and make the connection to the SDF file, but instead of using the Add To Map or Add to Map With Query , we now have an additional  option “Add to Map with Enhanced Style”.

AddToMap

Add the SDF data with the Enhanced Style option. Notice if you try to style that SDF layer using the normal style editor you will see that everything is grayed out and you can not change how it is displayed, add a scale range or create labels . As of right now there is no graphic users interface (GUI) to edit it.

Next step is to save the SDF layer out to a layer file. Right click on the layer in the display manger and select Save Layer.

SaveLayer

Save the layer to a location you can get to easily for now while you are experimenting with this and give it a new name.

SaveLayerAs

  Now remove the SDF layer from the Map display and disconnect from the SDF data file.

Next we start to edit the layer file we just saved, the layer file is in xml format and we can open and edit it with Windows Notepad. I suggest users stay away from some of the XML editors out there and edit with Notepad. With the layer file open scroll down to the line:

<Geometry> M 0.0, 0.0 h 4.0 </Geometry>

Layer 

This is where we start editing the file. The geometry tag is telling Map3D how to display or draw the line for this data feature. It starts at 0,0 and draws a straight line 4 units horizontal. The syntax is a little different than what you use in creating a line definition for a lin file, but the same principal. The “m” stands for move to  0.0,0.0. It is the coordinate to start drawing the line at. The next part is “h” for a horizontal line then the 4.0 is for 4 units. That is all, a simple straight horizontal line 4 units long. What I want is a line with 3 vertical lines in the center of it.  First I change the 4.0 to 10.0 to make my line longer so the vertical lines are not too close to the end points.  Next I use the “m” to move to a new starting place of 4.5, -0.5, or 4.5 units to the right of the starting point of the line and 0.5 units under the line. Now I tell it to go vertical one unit up by using “v” 1.0. That draws the first vertical line one half of  a unit left from the center of the horizontal line up one unit. Next I use M 5.0, –0.5 V 1.0 for the second line and for the last line M 5.5, -0.5 V 1.0.

Edits 

If you notice my screen capture of the edited file I formatted it to make it easier to read and edit, that’s what I like about Notepad other xml editors may give you errors when you try it this way.

Now there’s one other edit we need to make to get this new line to look right, I changed the length of the first horizontal line from 4 units to 10 units. So I need to change how often the line repeats though out the line segments in Map3D. Scroll down to the <Repeat> 4.0 </Repeat> tag and change the 4.0 to 10.0. I also changed the color to a red tint, the color tags <Linecolor>xxxxxxxx</Linecolor> uses a HEX value so if you need to change the color you need to know the HEX color values.

Edits_2

There is my editted layer file, now save the file and drop and drag onto the display manager or load it into Map3D with the load layer command. The results look like this:

OurStyle

The edited display.

So there you have it, custom line types for a data connect line feature. But don’t leave yet there’s more to follow in the next few weeks, not only can we create lines types like above we can create custom point markers or use a point marker in a line definition or create flow arrows in your lines and how about depression marks for contour lines?  More to come and if you try this you may notice your lines features may need some more editing to get them just right.

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.

Raster, Raster, Who has a Raster

From time to time I see users asking what is the best method to insert a raster file into Map3D or Civil 3D. There are a 4 known methods to insert a raster file into a drawing. First the standard AutoCAD insert, then there is the Map image insert command, and now with FDO there is the data connect method. Last we can use the Object Link and Embedding (OLE) method.  So what method do I suggest? My standard reply is what format and type is the raster and what do you want to do with the raster afterwards?

First lets review on what a raster file is and how they advanced over the years. A raster file contains cells or grids called pixels. The number of pixels is determined by the resolution of the raster.   A simple 300 x 300 resolution raster has 300 pixels on the X axis or horizontal and 300 on the Y axis or vertical for a total of 90,000 pixels. Each pixel has values or attributes assigned to it. One of the attribute is the location or pixel number in the file. It may be as simple as 1,1 for column 1 row 1, or 1 for the first location in the file.  Another attribute is the display value for that pixel. In the beginning the value was either 1 or 0 for on or off.  This is know as a bi-tonal raster. As technology progressed so did the values and attributes of the pixels, where today we have a color attribute and even elevation attributes along with a host of other attributes assigned to a pixel.  Just like vector objects in a dwg have attributes known as object properties like Layer, Color and custom properties such as object data, pixels have data attached to them.

Wow lets back up, did I say elevation, as in 3D? Yes I did. The technology has advance from the old DOS bmp days to create 3D raster. ESRI has been doing it for a few years now with their 3D analysis add-on for the ArcGIS programs. Some DEM files are nothing more that raster files with an elevation assigned to pixels. Same for the newer TIFF and Jpeg formats. Now when we throw multi-spectral images, know as remote sensing into this pot we not only have another a different ballgame but also a whole different ball field to play on. Multi-spectral images are made up of multiple files with each file being from a different spectrum of the light range.

The kicker to all this is not only can the pixels in a raster contain various attributes but the file extensions can all be the same. A TIFF is a TIFF. Example,  a picture we take with our Kodak Easy Share camera can have the same file extension as a image taken from a satellite orbiting the earth miles away. It is not until we open the image or raster file in the application or software that the attributes are exposed, then only part of them depending on the application used to open the file.

Using Windows Photo Galley works good to edit those family pictures from the Kodak to remove red eye, adjust the colors and print a 8 x10  photograph, but using the same application to work with a raster file that contains an elevation attributes to display as 3D will not work. It also works the other way around. Using a high end application designed for working with multi-spectral images to crop and print the Kodak Easy Share file is not only over kill but the results may not be what you expect and performance will suffer with the program stumbling over the simple attributes. To use a metaphor example of this lets say we have an acre of grass to mow with our little Briggs & Stratton powered mover. We know that if we use a high octane gasoline in an internal combustion engine the performance is increased. However if we use gasoline with 106 octane in the mower we may not get a very well cut yard. Either the engine is running too fast to get a good even cut of the grass or by the time we get half way done the engine locks up and we end up with the job half way complete. We need to use the right tool with the right material to complete the job successfully. 

So if you are still reading here are my suggestions on how to add that raster file to you drawing/map.

OLE - Only use it if you working in AutoCAD LT
AutoCAD Insert – For adding your company logo to a title block or to add simple images (including renderings) as a detail to your project, where placement and scale may not be of importance.
AutoCAD Map3D Image Insert – Simple aerial images that are geo-referenced and you need them to align with your line work.
AutoCAD Map Data Connect (FDO) – Raster files that contain elevations, Multi-spectral images or high end aerials images.

Now how do you tell if the raster file is a simple aerial or a high end aerial? Most likely if you downloaded it from the Internet and it’s over 3 years old it is a good chance it’s a simple aerial unless you get the meta-data with it and it states otherwise.


Archives

Readers Locations

Top Rated posts

Chat room


Follow

Get every new post delivered to your Inbox.

Join 31 other followers