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