TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Big G on May 01, 2007, 09:59:33 PM

Title: Top 10 MUST HAVE Lisp Routines...
Post by: Big G on May 01, 2007, 09:59:33 PM
Read a thread recently on Top 10 Firefox Extensions, thought this would be a good one.
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: Jeff_M on May 01, 2007, 10:49:42 PM
Dellayer by Me! I wrote this sometime in the last 15% of the last century (long before Bonus/Express tools) and I still use it most every day.

I quit posting it long ago since ET's is more robust, but I still prefer it for it's simplicity.
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: LE on May 02, 2007, 12:09:00 AM
In my Top Ten list the one in the top is DP.LSP - (to read the distance between two parallel lines)

It is a very simple and old lisp, from the early days at cadence or in the Harry's Hot Tips... don't remember.

I use it every day, every time... for at least the past 20 years...
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: CADaver on May 02, 2007, 12:42:48 AM
DVP.lsp I posted here a couple of years ago that allows quick DVIEW slices of 3D models.
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: Strucmad on May 02, 2007, 12:48:48 AM
I'm fairly new to the lisp thing but dlf.lsp Ive found very handy.
- deleting layer filters -  they really blow file sizes out
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: Didge on May 02, 2007, 04:59:44 AM
An interesting thread Big G, after careful consideration my top 10 ranked according to time savings would be:

1. MULTI-SECTION - a terrain & pipework longsection generator. Basically I draw a pipe route on a digital map using a polyline, select it and voila, a series of drawings each showing a plan (aligned to the pipe-route) and a corresponding long section beneath. This little baby can generate a dozen A1 drawings within a minute.  :-)

2. MAP CONVERSION - this one automatically reconstructs missing symbology in digital map data imported from a proprietry GIS system. This one doesn't sound very interesting but it saves many hours of tedious manual editting.

3. TERRAIN MODELLING - this is a combination of numerous 3D ground modelling routines such as TIN creation, breaklines, surface drapes & burrying etc.

4. RESAMPLE OBJECT - this routine effectively traces over existing objects using a user-defined number of vertices. I use this to remove excessive polyline vertices and to convert arcs, circles & ellipses to polylines.

5. REVERSE OBJECT - Does what it says on the tin.

6. BATCH LISP PROCESSING - this little app will allow me to run any lisp routine on a whole folder of drawings, including sub-folders if desired.

7. AUTO MATERIAL ASSIGNMENT - this one allows me to select a pre-dined material (concrete, asphalt etc) from a drop-down list box and then apply these by object, layer or by a bounding polyline.

8. DRAW ORDER BY LAYER

9. COPY OBJECTS TO LAYER

10. ANI-MATE - this is a sweet little animation routine, it's been around for a decade now and looks suspiciously similar to the one introduced in Acad2007.  :|

Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: jbuzbee on May 02, 2007, 09:06:06 AM
A routine I wrote to apply external Layer States to the current drawing or individual xrefs.  Invaluable if you have company layer standards.  I noticed 2008 (2007?) has "double click editing" in the CUI.  I've had that since 2000i!!   
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: ronjonp on May 02, 2007, 09:16:12 AM
_layfrz.....I'm kinda lost without that one :)
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: Keith™ on May 02, 2007, 09:40:34 AM
ENDIT.LSP
Quote
Features:
Layer filter deletion
Purge unused items (layers, blocks, linetypes, etc.)
Saves drawing

Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: ronjonp on May 02, 2007, 10:07:34 AM
ENDIT.LSP
Quote
Features:
Layer filter deletion
Purge unused items (layers, blocks, linetypes, etc.)
Saves drawing



I use that one daily Keith :)
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: Keith™ on May 02, 2007, 10:25:53 AM
I am glad someone besides me gets some use from it ...
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: T.Willey on May 02, 2007, 11:13:13 AM
My own 'ed'.  Works on attributes and text.  My 'CopyLayers' that I've posted here before.  And my simple 'pua' routine which used the comamnds purge and audit, just so I don't have to answer the prompts.  One I like when I have to use it is the one I wrote that will match an xrefs (with in a file) layers to the original file of the xrefs.
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: LE on May 02, 2007, 11:29:34 AM
Here are the only autolisp routines names or shortnames I use on a daily basis and in there are included my top 10.
Quote
(mapcar '(lambda (lsp)
(load lsp nil))
(list
"brk"
"df"
"di" #8 distance at command line between two points
"dp" #1 distance at command line between two paralell lines
"ee" #7 quick erase
"era"
"f0"
"fc" #2 fillet by window crossing
"hl"
"go"
"jp"
"k[2]"
"lay"
"le" #3 line from nearpoint to endpoint
"lee"
"lint"
"lm"
"ln"
"lp" #9 line from nearpoint to perppoint
"ls" #4 layer set command line
"m0"
"mp"
"n" #10 osnaps toggle
"i" #5 zoom in
"rc"
"uc" #6 turn off the ucsicon
"xw"
))
Title: Top 10 MUST HAVE Lisp Routines...
Post by: terrycadd on May 02, 2007, 11:51:36 AM
The poll here at work came up with 2 of our favorites.
One for actual work and the other just for fun.

 :kewl:  c:DS - Dimension Styles creates and sets our dimstyles
by just selecting the desired scale.
http://web2.airmail.net/terrycad/LISP/DimStyles.lsp
http://web2.airmail.net/terrycad/LISP/DimStyles.dcl
http://web2.airmail.net/terrycad/LISP/Dcl_Tiles.lsp (also required)
http://web2.airmail.net/terrycad/LISP/GetIcon.lsp (also required)

 :-D  c:AM - AutoCAD Messenger for sending Windows messages back
and forth without going through the company email system.
http://web2.airmail.net/terrycad/LISP/Messenger.lsp
http://web2.airmail.net/terrycad/LISP/Messenger.dcl
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: TimSpangler on May 02, 2007, 12:46:01 PM
Well I would have to say:

IL = Isolate Layer(s)
OA = UnIsolates layer(s) Obviously used in cunjuction
Some of the first lisps I wrote in R14 From macros.
EA = Single line attribute edit
XLH = Xline hoizontal on a non-plot layer
XLV = Xline vertical on a non-plot layer

These are the most used (at least once a day).  There are others that I use but these are the mose used
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: efernal on May 02, 2007, 01:27:41 PM
Code: [Select]
;; mine is one that, after i have selectet objects, writes a code like above...
;; e.fernal

(IF (NULL (TBLSEARCH "BLOCK" "CHANGE_IF_NECESSARY"))
  (PROGN
    (ENTMAKE '((0 . "BLOCK") (2 . "CHANGE_IF_NECESSARY") (70 . 0) (10 0.0 0.0 0.0))
    )
    (ENTMAKE '((0 . "CIRCLE")
               (100 . "AcDbEntity")
               (67 . 0)
               (8 . "0")
               (100 . "AcDbCircle")
               (10 32.7391 54.8242 0.0)
               (40 . 19.2041)
               (210 0.0 0.0 1.0)
              )
    )
    (ENTMAKE '((0 . "LINE")
               (100 . "AcDbEntity")
               (67 . 0)
               (8 . "0")
               (100 . "AcDbLine")
               (10 14.3361 60.3962 0.0)
               (11 28.6723 -3.73585 0.0)
               (210 0.0 0.0 1.0)
              )
    )
    (ENTMAKE '((0 . "LINE")
               (100 . "AcDbEntity")
               (67 . 0)
               (8 . "0")
               (100 . "AcDbLine")
               (10 28.6723 -3.73585 0.0)
               (11 40.5152 56.0377 0.0)
               (210 0.0 0.0 1.0)
              )
    )
    (ENTMAKE '((0 . "LINE")
               (100 . "AcDbEntity")
               (67 . 0)
               (8 . "0")
               (100 . "AcDbLine")
               (10 40.5152 56.0377 0.0)
               (11 52.9814 -3.73585 0.0)
               (210 0.0 0.0 1.0)
              )
    )
    (ENTMAKE '((0 . "LINE")
               (100 . "AcDbEntity")
               (67 . 0)
               (8 . "0")
               (100 . "AcDbLine")
               (10 0.0 0.0 0.0)
               (11 14.3361 60.3962 0.0)
               (210 0.0 0.0 1.0)
              )
    )
    (ENTMAKE '((0 . "LINE")
               (100 . "AcDbEntity")
               (67 . 0)
               (8 . "0")
               (100 . "AcDbLine")
               (10 -24.3091 77.2075 0.0)
               (11 0.0 0.0 0.0)
               (210 0.0 0.0 1.0)
              )
    )
    (ENTMAKE '((0 . "CIRCLE")
               (100 . "AcDbEntity")
               (67 . 0)
               (8 . "0")
               (100 . "AcDbCircle")
               (10 13.4211 32.5117 0.0)
               (40 . 16.9081)
               (210 0.0 0.0 1.0)
              )
    )
    (ENTMAKE '((0 . "ENDBLK")))
  )
  nil
)



Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: deegeecees on May 02, 2007, 02:26:22 PM
1. ET's Layer Isolate (working in 3d constantly, this is used the most)
2. Layutil.lsp (my own creation, all my layer setups, utilities, etc., still a W.I.P.)
3. CABs' PlotTabs082306.LSP (couldn't goof-off w/o this one)
4. batch_anything.lsp (another of mine, self explanatory)
5. acad200(?)doc.lsp

Just the ones used the most.
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: Dinosaur on May 02, 2007, 03:36:38 PM
I used to have several routines for dealing with single pieces of dtext (pre r12 days).  Two of these are still getting regular use: "djm" yields a middle justified piece of dtext (current style, layer and other properties) at the pick point a any angle I specify - great for little area notes or material callouts and "cx" will let me change any text string in multiple dtext objects to a new string.  I also keep "ofc" that will offset most entities a specified distance and place the results on the current layer.  This was added ootb a few releases back but I like mine better and "ppl" which will draw a line from a picked point perpendicular to a chosen line.
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: jonesy on May 02, 2007, 03:40:31 PM
LayerFilterDelete was a must at the old company I worked for.
another regular was one for a rotated rectangle which Stig wrote,
theres many more including one huge time-saver written by Kerry Brown which helped me move cross-sections into place and change the layering to suit our standards
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: Tom on May 02, 2007, 05:30:19 PM
While not a lisp Chucks Hotkeys are one routine used everyday
Kerry's Xplate for 3D solid square & rectangles is also handy
Alot of simple 3 key commands for automating everyday things
eg
;;----- draw line from x to y using snaps
(defun c:lee  ()
    (command "_line" "_endp" pause "_endp" pause "")
    (princ)
    )
(defun c:lei  ()
    (command "_line" "_endp" pause "_int" pause "")
    (princ)
    )
(defun c:lie  ()
    (command "_line" "_int" pause "_endp" pause "")
    (princ)
    )
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: Derwin on May 02, 2007, 10:16:54 PM
'LM'           LineMid:       enter length, enter axis, pick midpoint for new line.
'LTT'          LineTanTan  line from tan to tan
'COPYAD'    CopyAccumulatedDisplacement. pick objects, pick axis, 1st offset, 2nd, 3rd, etc.
'QX'           SaveFlattenedDXF: outputs a 2D dxf without AcadDB rubbish adding N Kb.
'OA' + 'SA'  OpenAs + SaveAs: takes just a company acronym and builds automagic filenames.
'JU'            justify, re-orient lower left corner to 5,5.

all mine.
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: Didge on May 03, 2007, 08:21:26 AM
Quote
c:AM - AutoCAD Messenger for sending Windows messages back
and forth without going through the company email system.

Thank-you very muchly Terry - what a great little app.

You've raised a fair few smiles (and un-repeatable messages) this end.  :-)
Title: Top 10 MUST HAVE Lisp Routines...
Post by: terrycadd on May 03, 2007, 10:09:00 AM
Its funny here in that, the boss was out of the loop of included recipients, as we thought he wouldn’t like the idea. He finally found out about it by one of the drafters, who suggested he try Terry’s AM routine to send quick messages other than wait for us to open up our emails.  He loves it now, and uses it a lot for short messages like: [I need your time sheets by noon.], [When you get back from lunch, let’s go over your project.]

However, that’s not what we use it for.  Ours is sometimes on the lighter side to help pass the day.
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: GDF on May 03, 2007, 02:32:43 PM
I quess mine would be my setup routine for: units, insunits, lunits, textstyle, dimstyles, dimscalle, ltscale...
"all in one" thru a dialog box interface.

;;;ARCH#UNIT is set to "Ci" = IMPERIAL Decimal
;;;ARCH#UNIT is set to "Mm" = METRIC Millimeter
;;;ARCH#UNIT is set to "Cm" = METRIC Centimeter
;;;ARCH#UNIT is set to "Ar" = IMPERIAL Architectural
;;;ARCH#UNIT is set to "Me" = METRIC Meter   
;;;ARCH#UNIT is set to "En" = IMPERIAL Engineering
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: GDF on May 03, 2007, 02:39:05 PM
Then I would say the BEST overall routine would be Tim Willeys's Xref2Block.lsp routine.
Life would be miserable without this one. Thanks Tim.
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: GDF on May 03, 2007, 02:46:17 PM
One more time...

BrowseForFolder.lsp routine is also one of my favorites, by Tony Tanzillo.
Title: Re: Top 10 MUST HAVE Lisp Routines...
Post by: T.Willey on May 03, 2007, 02:47:34 PM
Then I would say the BEST overall routine would be Tim Willeys's Xref2Block.lsp routine.
Life would be miserable without this one. Thanks Tim.
Glad you still find it useful Gary.

One more time...

BrowseForFolder.lsp routine is also one of my favorites, by Tony Tanzillo.
x2.  I use it so much in most of my routines.