Importing Shx Files Into Autocad
Attribute values can be extracted from drawings, which is another reason why you should consider using blocks with attributes.
To Import SHP FilesClick Insert tab Import panel Map Import.In the Import Location dialog box, under Files Of Type, select shp.Select the file or folder to import. How to add a font file to AutoCAD. AutoCAD supports TrueType and SHX fonts. Installing an SHX font: Copy.shx files into the Fonts folder within the AutoCAD program folder: C:Program FilesAutodeskAutoCAD 20xxFonts Note: PostScript fonts (.pfb) and shape files (.shp) can be converted to.shx by using the COMPILE command in AutoCAD.
- use the Attext command to extract attribute values to either a comma delimited file (CDF) or space delimited file (SDF).
You must create a template file (in ASCII format) to control which attributes are extracted and how they are formatted in the output file.
- a record (line in the output file) is made for each selected object and each line in the template file controls one field in the record.
- begin each line with one of the 15 BL field names or an attribute tag, add one or more spaces & then a type the Format Code.
- you can include any or all BL fields and you must have at least one attribute tag (numeric or character) in the template.
The first character of the Format code in template files specifies whether the data is characters (C) or numeric (N).
- the next 3 characters in the code control the total number of characters to use in that field (i.e. the field width).
- you control the number of decimals to include for numeric data using the last 3 characters of the format code.
For example, you could create a template file called T207_dsk.txt for the DESK block example from the previous exercise.
- the first line (BL:NAME) would generate a field in each output file record that includes the block name (i.e. DESK)
- the format code for this line (C008000) specifies that the block name is character data and you would like to use 8 characters.
- the 2nd & 3rd lines specify tag names (DESKTYPE & DESKMAN) and field widths for the attribute values to extract.
When you specify field widths & the number of decimals for numeric values you must take care to use ONLY digits in template files.
- the letter O looks like the number 0 but using letters results in error messages and your attribute extraction will fail.
If you want to import the text from the output file back into AutoCAD you may want to choose the SDF file format.
- use the Mtext command and select the Import Text button to import the output file directly as a single MTEXT object.
- use a font in AutoCAD in which the width of every character is the same (or your field columns will not be aligned).
- these special fonts normally have “mono” in the font name.
If you want to import the data into spreadsheets or databases you may want to choose the CDF file format instead.
- then you can sort, analyze & generate reports using this data.
Some third party applications use attributes in block inserts to automatically generate bills of materials (BOM) or schedules.
- facility management
- material schedules in construction
- parts lists for mechanical assemblies – etc.
Data can also be explicitly attached to objects as extended entity data without having to define and use blocks with attributes.
- this requires custom programming to attach, extract and then manipulate the data.
- however, you have more flexibility using this approach.
PRACTICE EXTRACTING ATTRIBUTES VALUES
- If you completed the more practice section of the last exercise you can continue in the same drawing. (otherwise Open the T207_5.dwg drawing in your personal folder).
- Type ATTEXT at the keyboard to invoke this command. Select the Space Delimited File (SDF) File Format. Pick the Template File button and select T207_dsk.txt file in your personal folder and pick Open to return. Pick the Output File button and type My results in your personal folder and pick Save to return. Pick the Select Objects button and type ALL then press <enter> to return. Pick OK to extract the attributes and create the output file.
3) Pick Format + Text Style. Pick the New button and type Mono as the text Style Name & pick OK. Select Monospace821 BT TrueType font (or Monotxt.shx) as the Font Name and pick Apply. Then pick Close.
You are about to import the output file back into the drawing as an MTEXT object and you will want the columns to align.
» 4) Pick Draw + Text + Multiline Text. Pick a point near P1 by eye. Enter W to invoke the Width option & enter . Pick the Import Text button. Select My results.txt in your personal folder & pick Open to return. Then pick OK.
Command: MTEXT ↵
Current text style: “Mono” Text height: 2.4000
Specify first corner: <Osnap off> (pick by eye near P1)
Specify opposite corner or [Height/Justify/Line spacing/Rotation/Style/Width]: W ↵
Specify width: 0 ↵
(continue as per instructions)
5) Type ATTEXT again. Change File Format to Comma Delimited File (CDF). Change the Template File to T207_all.txt in your personal folder. Change the Output File to My records in your personal folder. Pick Select Objects and enter ALL then press <enter> to return. Pick OK extract the attributes using this new template file.
7) Open the My records.txt file in MS Excel or import this file into another available spreadsheet application. (Most spreadsheet applications allow importing text files in CDF format.) Then Close the file without making any changes.
8) Save the changes you made to the current drawing then Close the file.
Please, also take a look at the following updated (MAY18) video:
Please, watch the video:
Many AutoCAD users who handle geospatial information need to work with ESRI Shapefiles (SHP), by downloading these files from the web or by collaborating with others GIS users, and their basic need is to import these kinds of files into AutoCAD by transforming the Shapefiles features into AutoCAD objects
Import Shx To Autocad
A Shapefile (SHP) is a digital vector storage format for storing geometric location and associated attribute information. Shapefiles (SHP) are simple because they store the primitive geometric data types of points, lines, and polygons. They are of limited use without any attributes to specify what they represent. Therefore, a table of records will store properties/attributes for each primitive shape in the Shapefile. Shapes (points/lines/polygons) together with data attributes can infinitely create many representations about geographic data
Shapefile to CAD
When converting SHP to CAD files the following considerations have to be taken into account:
· 3D features in the Shapefiles must be converted to 3D CAD objects (Points, Polylines, etc.) or to pseudo-3D CAD objects considering the elevation and the thickness of the objects
· When importing Point features It is very interesting to use complex CAD objects (such as Block references in AutoCAD) which can include variable text information (such as Attributes in AutoCAD)
· We must also consider the importing of complex Polygon features, which may include more than one internal or external ring, and convert them to appropriate CAD objects (such as Hatches in AutoCAD)
· What is also very interesting is the automatic distribution of the objects across the drawing depending on the values associated to the Shapefile features (using, for example Layers in AutoCAD)
· Finally, we consider some systemableto import anddisplay the features alphanumeric data (such as Extended Entity Data -EED or XDATA- in AutoCAD)
Import shapefile into AutoCAD – Data in the XDATA viewer palette
Import Shapefiles to AutoCAD
Spatial Manager™ for AutoCAD lets you import graphic objects into AutoCAD from a large number of GIS sources including ESRI shapefile format
The application detects what type of information the shapefile contains to import (points, lines or polygons) and presents to the user only those import options that are valid for that type of object. In the case of polygonal objects, the closed borders can be automatically filled by using AutoCAD Hatches, or import not only the border of the polygons but also their centroids by using Points or AutoCAD Blocks
For any imported table or file, regardless of its format or type, it is possible to automatically subdivide the imported objects into various AutoCAD Layers, according to the value of a field in the source data table
How to import shapefiles into AutoCAD
This example shows how to import Shapefiles into AutoCAD using Spatial Manager™ for AutoCAD. In the video you can see how an SHP Parcels file is imported onto a drawing, which already contains other Objects belonging to a city
Import Shx Into Cad
The import process fills every Parcel using a Solid transparent Hatch, distributes every Parcel into new Layers according to the zones to which each Parcel belongs and applies random colors for every new Layer created. The alphanumeric data of every Parcel is also imported using AutoCAD Extended Entity Data (EED or XDATA)!