Import / connect ESRI Shape file and separate data into layers based on att.

Import / connect ESRI Shape file and separate data into layers based on att.

hgj1357
Enthusiast Enthusiast
3,834 Views
12 Replies
Message 1 of 13

Import / connect ESRI Shape file and separate data into layers based on att.

hgj1357
Enthusiast
Enthusiast

I have shape file street data with a field for PASER rating. This is a number from 1-10.  I need to get the streets into Civil 3D in 10 layers (1,2,3...10) based on the PASER rating number.  I have tried mapimport and connecting the shape file data but have been unable to separate the streets based on this attribute.

 

Thanks

0 Likes
Accepted solutions (2)
3,835 Views
12 Replies
Replies (12)
Message 2 of 13

tcorey
Mentor
Mentor

If you post the drawing, it would be easy to create a LISP routine that will move those objects to layers, based on the value of that attribute/object data field -- assuming you created object data upon import.



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Platinum Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
0 Likes
Message 3 of 13

hgj1357
Enthusiast
Enthusiast

I have not created object data.

 

Basically, I have the shape file.  I'm asking how to get it into C3D such that I can separate by esri attribute.  I don't care if I have to qselect, copy and paste out to another drawing. As long as I can separate by attribute.

0 Likes
Message 4 of 13

tcorey
Mentor
Mentor

Those attributes won't be available inside AutoCAD if you don't have the import routine create object data. Once you do that, a simple five minute LISP routine can be written and it will do the layer separation for you. Other than that, I don't know what to tell you. If you post the shp file, I can write the LISP for you.



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Platinum Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
0 Likes
Message 5 of 13

hgj1357
Enthusiast
Enthusiast

Shape file belongs to a client.  I can't post it on a public forum.

0 Likes
Message 6 of 13

tcorey
Mentor
Mentor

If you want to send to me directly: tcorey at Shasta dot com.



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Platinum Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
0 Likes
Message 7 of 13

Anonymous
Not applicable

You definitely want to create object data when importing the shape files.

 

another way using OOTB tools would be to bring in the shape file, then query the drawing looking at object data. You could bring in everything with PASER=1, put it on a layer, query everything with PASER=2, put it on another layer, etc. it wouldn't be as slick as @tcorey 's method, but it would work.

0 Likes
Message 8 of 13

tcorey
Mentor
Mentor
Accepted solution

I tend to think in terms of how I can solve an issue programmatically, but @Anonymous's post reminded me that you can do this with Query and have the software automatically separate the objects onto layers based on Object Data properties.

 

Import your .shp into a .dwg with Object Data. Save and close the drawing.

 

Open a new drawing. Type MECOMMNAND and then IDM_DRAWING_ATTACH. Attach the drawing you just saved and closed. If it's not on the C: drive, you will likely need to create an alias.

 

Once back in the drawing, use ADEQUERY command. Pick the Location button, set to All and press OK. Pick the Alter Properties button, then the Layer radio button. Pick the Expression button, expand Object Data, expand your object data table and then select the field you want to use for the layer. Press OK.

 

The Expression box will now have something like :Fieldname@tablename, only with your values. Press Add and then OK. Back on the Query dialog, change Query Mode to Draw, then press Execute Query. The linework will come in on layers based on the value of the field you chose. No LISP needed, but I will still post one for you when I get a chance.

 

 



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Platinum Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
Message 9 of 13

sirjoelsph
Collaborator
Collaborator
Accepted solution

Got one easier - in the mapimport dialog box, highlight the drawing layer name and then click on the ellipsis that shows up next to it.  This will bring up the layer mapping dialog box which gives you the option to assign the entities to a layer name based on the object data directly.  No query - No lisp.  I don't have your data to test with, but it worked on some other simple data I had.  Just select the field that holds your PASER number in this Layer Mapping dialog box and import everything else as you normally would.

Shape Layer.PNG

-JOEL
Message 10 of 13

tcorey
Mentor
Mentor

That's one I didn't know about. Thanks!



Tim Corey
MicroCAD Training and Consulting, Inc.
Redding, CA
Autodesk Platinum Reseller

New knowledge is the most valuable commodity on earth. -- Kurt Vonnegut
0 Likes
Message 11 of 13

ChicagoLooper
Mentor
Mentor

This can be easily done as long as you have a shapefile with the necessary data contained in the dbf. You don't need code, you don't need to get fancy-schmancy with the shapefile, you don't need steel toes or a hard hat either.

 

Example: I have a point shapefile. The shapefile has an attribute, a field, which is called NAME. I want to create multiple layers based on the 'value' of the attribute in the field called NAME. If an object has Value-A in the NAME field, it will be placed on a layer called Value-A. If another object has Value-B in its NAME field, then it will be placed on a layer called Value-B, and so forth and so on, so all objects with the same field value are all on the same layer.

 

This video will show how it's done using MAPIMPORT command from Planning & Analysis workspace. Click >HERE<< to watch video. (Or click the attachment and watch the video.)

Chicagolooper

EESignature

0 Likes
Message 12 of 13

ChicagoLooper
Mentor
Mentor

This can be easily done as long as you have a shapefile with the necessary data contained in the dbf. You don't need code, you don't need to get fancy-schmancy with the shapefile, you don't need steel toes or a hard hat either.

 

Example: I have a point shapefile. The shapefile has an attribute, a field, which is called NAME. I want to create multiple layers based on the 'value' of the attribute in the field called NAME. If an object has Value-A in the NAME field, it will be placed on a layer called Value-A. If another object has Value-B in its NAME field, then it will be placed on a layer called Value-B, and so forth and so on, so all objects with the same field value are all on the same layer.

 

This video will show how it's done using MAPIMPORT command from Planning & Analysis workspace. Click >HERE<< to watch video. (Or click the attachment and watch the video.)

Chicagolooper

EESignature

0 Likes
Message 13 of 13

hgj1357
Enthusiast
Enthusiast

How do I add a new query?

 

I can add new categories, but when I edit the query definition, it redefines both categories.  I want one query to bring in roads and one to bring in text. Place each on a layer and change the color.  I can define the query, but how do I get two different queries?

0 Likes