Lisp routine for Abbv. table

Lisp routine for Abbv. table

woolyb30
Explorer Explorer
388 Views
7 Replies
Message 1 of 8

Lisp routine for Abbv. table

woolyb30
Explorer
Explorer

I worked at a place that had a lisp program that found all the abbreviations in a drawing and made the table for them. I seem to be missing something since when I run it in Civil 3D it tells me it can't do it. Thanks any help is appreciated. 

 

What I had:

(defun (command "abbv" (index predicate))
("find" ((setq leglist (index
'("AC " "AC\t\t\tASPHALT CONCRETE" nil)
'("AS" "AS\t\t\tARROW STRAIGHT" nil)
'("AL" "AL\t\t\tARROW LEFT" nil)
'("AR" "AR\t\t\tARROW RIGHT" nil)
'("ASL" "ASL\t\t\tARROW STRAIGHT LEFT" nil)
'("ASR" "ASR\t\t\tARROW STRAIGHT RIGHT" nil)
'("ANC" "ANC\t\t\tANCHOR" nil)
'("BRG " "BRG\t\t\tBRIDGE" nil)
'("BM " "BM\t\t\tBENCHMARK (AS NOTED)" nil)
'("BO" "BO\t\t\tBOLLARD" nil)
'("BFP " "BFP\t\tBACK FLOW PREVENTER" nil)
'("BL" "BL\t\tBREAKLINE" nil)
'("BLDG " "BLDG\t\tBUILDING" nil)
'("BC" "BC\tBACK OF CURB" nil)
'("BK" "BK\t\tBIKE LANE" nil)
'("BUSH" "\t\t\tBUSH" nil)
'("FC" "FC\tFACE OF CURB" nil)
'("CBOX" "\t\t\tCALL BOX" nil)
'("CCAB" "\t\t\tC.A.T.V. CABINET" nil)
'("CATVFLG" "\t\t\tC.A.T.V. FLAG" nil)
'("CHH" "\t\t\tC.A.T.V. HANDHOLE" nil)
'("CPED" "\t\t\tC.A.T.V. PEDESTAL" nil)
'("CAS" "\t\t\tC.A.T.V. SIGN" nil)
'("CAB" "CAB\t\tCABINET" nil)
'("CLD" "CLD\t\tCL DITCH/CREEK" nil)
'("CB " "CB\t\tCATCH BASIN" nil)
'("CBW" "CBW\t\tCINDER BLOCK WALL" nil)
'("CHW" "CHW\t\tCONCRETE HEADWALL" nil)
'("CLF" "CLF\t\tCHAIN LINK FENCE" nil)
'("COMM" "COMM.\tCOMMUNICATION" nil)
'("CFLG" "\t\t\tCOMM. FLAG" nil)
'("CMH" "\t\t\tCOMM. MANHOLE" nil)
'("CMRK" "\t\t\tCOMM. MARKER" nil)
'("CVLT" "\t\t\tCOMM. VAULT" nil)
'("MON" "(CM)\t\tCONTROL MONUMENT" nil)
'("CMP" "CMP\tCORRUGATED METAL PIPE" nil)
'("CO" "CO\t\tCLEAN OUT" nil)
'("CONC" "CONC\t\tCONCRETE" nil)
'("CPP" "CPP\t\tCORRUGATED PLASTIC PIPE" nil)
'("CP" "CP\t\tCONTROL POINT" nil)
'("CRW" "CRW\t\tCONCRETE RETAINING WALL" nil)
'("CTB" "CTB\t\tCONCRETE TRAFFIC BARRIER" nil)
'("CWL" "CWL\t\tCROSSWALK LIGHT" nil)
'("CL" "CL\t\tCL ROAD" nil)
'("DE" "DE\t\tDRAINAGE EASEMENT" nil)
'("DOC." "DOC\t\tDOCUMENT" nil)
'("DS" "DS\t\tDOWN SPOUT" nil)
'("DWL" "DWL\tDASH WHITE LINE" nil)
'("DYL" "DYL\tDASH YELLOW LINE" nil)
'("EC" "EC\tEDGE OF CONCRETE" nil)
'("ELEC" "ELEC\t\tELECTRIC" nil)
'("ECR" "ECR\t\tELEC. CONDUIT RISER" nil)
'("ECP" "ECP\t\tELEC. CONTROL PANEL" nil)
'("EB" "\t\t\tELEC. BOX" nil)
'("EG" "EG\tEDGE OF GRAVEL" nil)
'("EP" "EP\tEDGE OF PAVEMENT" nil)
'("EFLG" "\t\t\tELEC. FLAG" nil)
'("EMH" "\t\t\tELEC. MANHOLE" nil)
'("EW" "\t\t\tEDGE OF WATER" nil)
'("EM" "\t\t\tELEC. METER" nil)
'("EMP" "\t\t\tELEC. METER POLE" nil)
'("EOUT" "\t\t\tELEC. OUTLET" nil)
'("EPED" "\t\t\tELEC. PEDESTAL" nil)
'("ERACK" "\t\t\tELEC. RACK" nil)
'("EVLT" "\t\t\tELEC. VAULT" nil)
'("EMW" "EMW\t\tENVIRONMENTAL MONITORING WELL" nil)
'("ESMT." "ESMT\t\tEASEMENT" nil)
'("FC" "FC\t\tFILM CODE" nil)
'("FCP" "\t\t\tFENCE CORNER POST" nil)
'("FGP" "\t\t\tFENCE GATE POST" nil)
'("MISC" "MISC\t\tMISCELLANEOUS" nil)
'("MW" "\t\t\tMONITOR WELL" nil)
'("NO" "NO\t\tNUMBER" nil)
'("N_" "N_\t\tNOTE SHOT" nil)
'("NOS" "NOS\t\tNUMBERS" nil)
'("OCS" "OCS\t\tOUTLET CONTROL STRUCTURE" nil)
'("OHP" "\t\t\tOVERHEAD POWER" nil)
'("OHPT" "\t\t\tOVERHEAD POWER/TELEPHONE" nil)
'("OHT" "\t\t\tOVERHEAD TELEPHONE" nil)
'("PED." "PED\t\tPEDESTAL" nil)
'("PF" "PF\t\tPIN FLAG" nil)
'("PG" "PG\t\tPAGE" nil)
'("PLM" "PLM\t\tPIPELINE MARKER" nil)
'("PLMS" "PLMS\t\tPIPELINE METER STATION" nil)
'("PLV" "PLV\t\tPIPELINE VENT" nil)
'("PM" "\t\t\tPARKING METER" nil)
'("POB" "POB\t\tPOINT OF BEGINNING" nil)
'("POC" "POC\t\tPOINT OF COMMENCING" nil)
'("PIV" "PIV\t\tPOST INDICATOR VALVE" nil)
'("SE" "SE\t\tSEWER EASEMENT" nil)
'("SET" "SET\t\tSAFETY END TREATMENT" nil)
'("SFMARV" "SFMARV\tSANITARY FORCE MAIN AIR RELEASE VALVE" nil)
'("SH" "SH\t\tSPRINKLER HEAD" nil)
'("SGN" "\t\t\tSIGN (AS NOTED)" nil)
'("SL" "SL\t\tSANITARY LINE" nil)
'("SMW" "SMW\t\tSANITARY MONITORING WELL" nil)
'("SNS" "SNS\t\tSTREET NAME SIGN" nil)
'("SPW" "\t\t\tSAMPLE POINT WELL" nil)
'("SQFT" "SQ. FT.\tSQUARE FEET" nil)
'("SRW" "SRW\t\tSTONE RETAINING WALL" nil)
'("SRF" "SRF\t\tSPLIT RAIL FENCE" nil)
'("SW" "SW\t\tSIDEWALK" nil)
'("SP" "SP\t\tSIGNAL POLE" nil)
'("ST" "ST\t\tSTORM LINE" nil)
'("STM." "STM\t\tSTORM" nil)
'("STK" "\t\t\tSTAKE" nil)
'("STMH" "\t\t\tSTORM MANOLE" nil)
'("STMRK" "\t\t\tSTORM MARKER" nil)
'("SSMRK" "\t\t\tSANITARY SEWER MARKER" nil)
'("SV" "S.V.\t\tSEWER VALVE" nil)
'("SWBT" "SWBT\tSOUTHWESTERN BELL TELEPHONE" nil)
'("TCB" "TCB\t\tTRAFFIC CONTROL BOX" nil)
'("TANK" "\t\t\tTANK (TYPE UNKNOWN)" nil)
'("TCAB" "\t\t\tTELE. CABINET" nil)
'("TCS" "\t\t\tTELE. CABLE SIGN" nil)
'("TFLG" "\t\t\tTELE. FLAG" nil)
'("TB" "\t\t\tTOP OF BANK" nil)
'("TBOX" "\t\t\tTELEPHONE BOX" nil)
'("THH" "\t\t\tTELE. HANDHOLE" nil)
'("TMH" "\t\t\tTELE. MANHOLE" nil)
'("TMRK" "\t\t\tTELE. MARKER" nil)
'("TPED" "\t\t\tTELE. PEDESTAL" nil)
'("TPOL" "\t\t\tTELE. POLE" nil)
'("TEL" "\t\t\tTELE. (PUBLIC)" nil)
'("TSB" "\t\t\tTELE. SERVICE BOX" nil)
'("TSPLICE" "\t\t\tTELE. SPLICE" nil)
'("TVLT" "\t\t\tTELE. VAULT" nil)
'("TL" "\t\t\tTREE LINE" nil)
'("TR" "\t\t\tTREE" nil)
'("1TS" "\t\t\tTRAFFIC SIGN" nil)
'("UGT" "UTB\t\tUNDERGROUND TELE" nil)
'("UTCB" "UTCB\tUNDERGROUND TRAFFIC CONTROL BOX" nil)
'("UTP" "UTP\t\tUNDERGROUND TELE. PAINT" nil)
'("UV" "UV\t\tUNDERGROUND VAULT" nil)
'("UVE" "UVE\t\tUNOBSTRUCTED VISIBILITY EASEMENT" nil)
'("UWP" "UWP\t\tUNDERGROUND WATER PAINT" nil)
'("VLT" "\t\t\tVAULT (TYPE UNKNOWN)" nil)
'("VOL." "VOL\t\tVOLUME" nil)
'("VP" "VP\t\tVERTICAL PIPE" nil)
'("WBOV" "WBOV\****ER BLOW-OFF VALVE" nil)
'("WC" "WC\t\tWOOD COLUMN" nil)
'("WELL" "\t\t\tWELL (TYPE UNKNOWN)" nil)
'("WF" "WF\t\****ER FAUCET" nil)
'("WIF" "WIF\t\tWROUGHT IRON FENCE" nil)
'("WLND" "\t\t\tWETLAND FLAG" nil)
'("WLE" "WLE\t\****ER LINE EASEMENT" nil)
'("WLV" "WLV\t\****ER LINE VENT" nil)
'("WM" "WM\t\****ER METER" nil)
'("WALL" "WALL\t\t\tWALL" nil)
'("WME" "WME\t\****ER METER EASEMENT" nil)
'("WMV" "WMV\t\****ER METER VAULT" nil)
'("WV" "WV\t\****ER VALVE" nil)
'("WL" "WL\t\****ER LINE" nil)
'("WW" "WW\t\****ER WELL" nil)
'("WWE" "WWE\t\tWASTEWATER EASEMENT" nil)
'("WWLE" "WWLE\tWASTEWATER LINE EASEMENT" nil)
)

(defun create-abbreviation-block (abbv-list)
(let ((block""))
(dolist (abbv abbv-list)
(setf block (concatenate "string block)
(format nil "~A: ~A~%" (car abbv)
(cdr abbv)))))
block))
(DEFUN MAIN ()
(let abbreviation-block (create-abbreviation-block
*ABBREVIATIONS*)))
(format t "ABBREVIATION:~%~%~A" abbreviation-block)))
(main)

0 Likes
389 Views
7 Replies
Replies (7)
Message 2 of 8

paullimapa
Mentor
Mentor

I can’t even see this code even loading let alone running in even vanilla AutoCAD. Are you sure this worked for you before?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 8

woolyb30
Explorer
Explorer

The last time I worked with lisp was 1997- I copied part of it and edited part of it. It says error when running through the debugger and won't load. So, I please need help figuring out how to make it work? 

I edited the beginning:

(defun abbv ()

(setq (command "abbv"))

)

((setq abblist strcase "ABBREVIATIONS"))

 

0 Likes
Message 4 of 8

Kent1Cooper
Consultant
Consultant

If it ever worked in AutoCAD, it would at least have required some definitions for functions that are not in AutoLisp [e.g. let, dolist, setf, format].  Are there other files that went along with it, that would need to be loaded first in order for this to run?

And the things you edited at the beginning are structured all wrong.  Is the intent that there is a command named ABBV that you would type in?  That would at least start with:

(defun C:ABBV ()

Or is ABBV meant to be a function, used as a sub-routine in other things, not a type-it-in command name?
And you can't use a (command) function as the first argument in a (setq) function [read about it].

And I don't see where the last line is going, but at the very least the (strcat) function needs an opening left parenthesis.  But given that, it's turning into all uppercase a text string that's already all uppercase.  And why would a variable whose name suggests it's about a list contain only a text string?

Kent Cooper, AIA
Message 5 of 8

Sea-Haven
Mentor
Mentor

If you explain more where the abbreviations are coming from then maybe we can help, are they layer Names  or what ?

0 Likes
Message 6 of 8

komondormrex
Mentor
Mentor

@woolyb30 

that is common lisp actually. can't be run with autolisp interpreter.

Message 7 of 8

woolyb30
Explorer
Explorer

The abbreviations are all survey points or text in the drawing. 

0 Likes
Message 8 of 8

Sea-Haven
Mentor
Mentor

Some more questions, are the points Civ3D Cogo points ? They can have a description.

 

It may be easier to have a text file rather than have all the abbreviations in the code. EB,Edge of Bitumen. This is similar to create a legend of blocks & linetypes used in a dwg.

 

In saying DWG need a sample one, please post. 

0 Likes