| LISP ROUTINES | |
![]() |
![]() |
[ PAUG Home | Members Home | Blipmodes | LISP Routines | Members Database | PAUG Web Stats ]
For example, you can select a wall, door, and window to create a new series of layers for A-WALL-TNNT, A-DOOR-TNNT, and A-GLAZ-TNNT all at once. You can designate whether the objects should be changed (Moved), or duplicated (Copied) to those new layers. You can choose colors for the new layers; either No Change, Wash out Colors, Prompt for Each, or all a New Color. If some of the selected objects are already on a layer with the new suffix or prefix, you can designate that they should not have the suffix or prefix tacked on a second time by checking on the Skip layers with prefix/suffix already in place box. |
|
![]() |
|
|
|
|
SL Set layer current |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1998
Received in E-mail to PAUG posted 2/98 Click
here to download BOM.ZIP by Rodney Estep
Received in E-mail to PAUG posted 2/98 Click
here to download LV.EXE by Wilfried Nelkel
Received in E-mail to PAUG posted 2/98 Click
here to download CS49.PAT or here to download CS29.PAT
by Chas Sweeney
|
| The new WIPEOUT command in AutoCAD R14 is a nice new addition to those of us wish blank certain items from view and plots such as an area under text to blank out a portion of a contour line. |
| In the December 1995 issue of Blipmodes, when I was editor, I published a routine by David Hoekstra called TBOX.LSP that created closed polyline boxes around text. Then if you had a plot driver that would plot white or near white you could blank out drawing objects underneath the text. I was recently called upon to update the drawings that I had created in R13 to R14 format. The WIPEOUT command worked great for changing the closed polylines from the TBOX.LSP but only would convert one polyline at a time to a wipeout area. |
| This lisp routine which I wrote to turn all selected polylines into wipeout areas is called MWIPE.LSP. MWIPE.LSP can be loaded by (load"mwipe") after being placed in the support path of AutoCAD R14. The run command is "MW". |
|
|
| An extra routine since I missed one in the June 1997 issue of blipmodes. |
| This routine uses AutoCAD R14's DRAWORDER command to set the drawing order by layer. You can select up to 9 levels. Since the routine puts every layer on top of the others you can run the routine multiple times if you have more than 9 levels in your drawings. |
|
|
| This lisp routine is useful when creating 3d solid models. I was working on a project where I was continually using the subtract command but didnt want the item I was subtracting area from to be removed from the drawing. The first couple of times of issuing a wblock command to save the object I wanted to keep in my drawing to disk so I could just reinsert it back into the drawing after I subtracted its area from another object I decided to write the short lisp routine. |
| This lisp routine is rather crude in that you must first create a TEMP.DWG file in your ACAD root directry before using it. If one of our more profficient lisp writers would like to improve this routine I would be glad to provide an udate to our readers in a future issue. |
| This program will do a 3d solid sutract command by creating a write block to the file name "temp.dwg" of the entities used to subtract and reinsert them. Thus leaving the entities used to subtract from in the drawing. |
| NOTE: The Temp.dwg file must already exist |
|
|
| Places incremented values of text in columns at any angle. This version of AUTONUM has been heavily modified to increase the versatility of the program. The program allows you to place a column of text that contains incremented values of text (ie 10, 15, 20, 25, etc) at any spacing or angle. The program will prompt for starting point of the first number, alignment (any of the the 9 AutoCAD points), style, height and rotation angle. The program will ask for a starting, ending and increment value for the numbers to place in the text column. You may choose to have the numbers decrease to the ending number. It will then ask for a string to place in front of every number and one to place after every number, as well as the number of decimals to display the numbers at, and if you wish to put commas every third digit. The program then ask for actual distance beween each number and the direction at which to place the column of numbers (any angle). |
|
|
| SQ.LSP is written by David V. Sherrill. The routine is used to produce a sequence of lines that are perpendicular to each other when digitizing. This is very useful when digitizing photographs that contain structures such as buildings and homes. When using SQ.LSP to digitize the exterior lines of structures the buildings will have square walls instead of sloppy skewed angle walls. |
|
|
| PAD.LSP is written for R13 AutoCAD only. It is modified lisp routine from Cadence Magazine. It's purpose is to purge a drawing file of unused elements without having to enter the "yes" command for each element. The routine in Cadence did a save first then purged all elements of an AutoCAD drawing. I changed the routine to eliminate the save feature and to purge all entities except dimension styles. I didn't want dimension styles purged because it's a real pain to reset dimension styles in AutoCAD R13 when using variations of the "parent" dimension style. Run command is "PAD. |
|
|
| Import an ASCII text file into columns. After specifying a text file to input, the user is prompted for the locations of the columns. The first line of the text file is presented on the second line of the text screen and the user inputs a 'template' below that. The template indicates which characters are to be pulled from the file, and how they are to be justified. If a column starts with R - right justified, C - center justified and L - left justified. After ; the justification code, place '>' to indicate additional characters to be added to the column. A space (or any other character) indicates that character in the line will be discarded. The user is then prompted for the Justification Point of the first row and column, then the X value for each of the other columns defined. The program will then input the rest of the file, showing each line in the display directly below the original template entered. |
|
|
| With AutoCAD R13 for Windows there is now the ability to have add ons to the AutoCAD menu. Thus, if you have custom menus there no longer is the need to modify the AutoCAD menus. You can simply make an addition to the AutoCAD menu as shown on the cover page. The problem is that when you start AutoCAD for the first time (or each additional session of AutoCAD) you must load your menu. Since this menu load is only required when you first load AutoCAD there is no good way to load your menu automatically. So I wrote this very short lisp routine in order to load my menu. The lisp routine contains to parts the lisp routine itself which I call LOADMENU.LSP (Start command LM) and a line which is added to the the end of the ACAD.LSP file. This additional line runs and loads the LOADMENU.LSP only when you need it without taking up valuable memory if you not using it. |
| Shortcut line to add to ACAD.LSP: (defun c:lm ()(load"loadmenu")(c:lm)) |
|
|
| This is a collection of routines for manipulating blocks. The last LISP routine is extremely useful for changing xreferences into blocks. the blocks can be exploded and purged and you end up with a clean file with layer names that no longer contain a reference to the original drawing file. |
| BLKCG2.LSP: CHANGES OLD BLOCKS TO NEW BLOCKS. |
| BLKEQUAL.LSP: UPDATES BLOCKS PICKED TO FILE OF SAME NAME IN ACAD SEARCH PATH. |
| BLKSCALE.LSP: CHANGES SCALE OF OLD BLOCKS TO SCALE OF SELECTED BLOCK. |
| PKBLKCG.LSP: CHANGES OLD BLOCKS TO NEW BLOCKS THRU PICKS. |
| WBPK.LSP: WBLOCK A PICKED BLOCK WITH SAME NAME TO WORKING DIRECTORY. |
| XREF2BLK.LSP: CHANGE XREF's TO BLOCKS. |
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TBOX.LSP is used for creating closed polylines around text entities. This is useful for blanking out entities under text when plotting with a plot driver that supports closed polyline fills. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Multiple Copies at Any Angle or Distance: ANGMCOPY.lsp makes multiple copies (user specifies how many copies) of selected entities at any specified angle and distance. The distance and angle may be specified at the command prompt or selected from the entities in the drawing. The routine is loaded by: (load@angmcopy@) and ran with the command CA. The user selects objects to be copied, enters number of desired copies, enters or selects the desired angle, and enters or selects the desired distance. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| The GRVECS function is used to draw temporary vectors on the screen. It accepts a list of vector lists and an optional transformation matrix. The vector lists consist of a color integer and two point lists. GRVECS uses this vector list to paint lines on the screen, which disappear the next time you redraw. This comes in handy when you want to show an object on the screen without actually creating an entity. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| This example draws a red line from (1,2) to (1,5) and a yellow line from (2.2) to (2,5): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (grvecs ' ( 1 (1 2) (1 5) 2 (2 2) (2 5) ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| The optional transformation matrix lets you change the location and proportions of the vectors defined in your vector list. This is how it looks : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ' (( Xs 0.0 0.0 Xc ) ( 0.0 Ys 0.0 Yc ) ( 0.0 0.0 Zs Zc ) ( 1.0 1.0 1.0 1.0 ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Where Xs, Ys and Zs are the X, Y and Z scale factors, and Xc, Yc, and Zc are the X, Y, and Z coordinates. The remaining values (shown as zeros) are used for rotation. If you understand Matrix math you can use them as you like. Just leave them as zeros for now and don't worry about it. The fourth row (shown as ones) does nothing and can be used to store anything. This example draws a green line from (3,2) to (3,5) and a cyan line from (4,2) to (4,5), then scales both lines by 2 in the X direction and 3 in the Y direction, and moves them 12 units in the X direction and 8.5 units in the Y direction. : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (grvecs ' ( 3 (3 2) (3 5) 4 (4 2) (4 5) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ' ( ( 2.0 0.0 0.0 12.0 ) ( 0.0 3.0 0.0 8.5 ) ( 0.0 0.0 1.0 0.0 ) ( 1.0 1.0 1.0 1.0 ) ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
You may notice that it scaled them times 1.0 and moved them by 0.0 in the Z direction. Ok, now you're saying, gee, that's cool, but I don't want to have to type out vector lists for every little thing I want to draw on the screen. Well, you don't have to. Here is a simple lisp routine that allows you to draw whatever you want on the screen and then just read it into a text file in a format that GRVECS can use. You must use LINEs, no other entities are allowed. You must set the lines COLOR. Color = ByLayer is not allowed. And you should draw your object so that the UCS Origin point is its insertion point. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| KEY.LSP - ASCII Key Redefinition: KEY.lsp Redefines the function of a key in DOS. Return prompts you to restore the original function of the key. You must restore any keys before exiting AutoCAD or they may still be set in the next program you run. (You can use a script to set and reset several keys at once.) Feel free to modify EXC ; the list of keys that can NOT be changed. A list of Ascii Values follows. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| After loading KEY.lsp just type Key at the Command: prompt and you will be prompted to type in an Ascii Value from this chart, and the text that you want assigned to that key. The text you assign to a key can be as long as you like, just remember that spaces are treated as returns just like in a script. KEY.lsp won't work in Windows. Use recorder or the new key definitions in the R13 menus. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FPL.LSP is used to Fillet 2 Polylines in the same manner that the FILLET command works on 2 Lines, without having to EXPLODE them. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1994 Blipmodes 12/94 Click here to download P2C.LSP by Lyle Flansburg
Using Existing Entities as templates for changing entity properties. AutoCAD doesn't give us any standard way of setting entity properties to match other existing entities. We have all seen examples of various simple routines to do this. All you have to do is read the desired property from an entity's Association List using the proper DXF code and modify any other entities that you want to match it. You find an entity's Association list by using the ENTGET function on that entity's name. You get an entity's name using (CAR (ENTSEL)) or (SSNAME (SSGET) 0). Then you use the ASSOC function to select the property you want. The best way to explain this is simply to show you the finished code. The following is an all purpose "Pick to Change properties" function. If you don't want the entire program, you can use any of the subroutines in it as separate functions simply cutting them out and putting a "C:" in front of their names.
Blipmodes 10/94 click on file name below to download each routine.
CAS.LSP: Changes our text string to all upper or all lower case. ATL.LSP: Aligns our text string with a line. Thus, rotates text to match the angle of a Line. BTX.LSP: Will Break our Text String into two Strings. EMT.LSP: Explodes non-proportional text string into single words. Redraws text as current style in current layer. JTX.LSP: Joins our 2 Text Strings Back Together. TBX.LSP: Text boxer.
Blipmodes 6/94 Click here to download SLOPEIND.LSP by David Hoekstra
SLOPEIND.LSP is program to draw slope indicator triangles (rise over run).
1993 Blipmodes 10/93 Object Snaps and others by Lyle Flansburg. Click on file name below to download each routine.
HALF.LSP: Osnap to Half way Between Points. FRAC.LSP: Osnap to (Enter Decimal Fraction) Between Points. OEND.LSP: Osnap to Other end of Arc Line or Pline. STO.LSP: Store up to 5 Sel. Sets. Recall as !S1, !S2, etc. GET.LSP: Places a Mark (!ENAM) at the Last Entity Created, then Puts all Entities Created since the Mark in the Previous Selection Set.
Blipmodes 3/93 Polyline Routines by Dave Kramer and Don Ennis. Click on file name below to download each routine.
CPL.LSP: Allows the user to continue drawing a 2D or 3D polyline. It sets the layer of the picked PLINE to current layer. The routine can g\be enhanced to include all the standard PLINE prompts. JPL.LSP: Joins SIMPLE 2D & 3D PLINES that do not necessarily touch. If the PLINES do not touch it uses the MEAN of the two endpts for the new endpt. Needs non-fit-curved non-splined plines. DOES NOT test for simple arc-tangent PLINES and therefore will destroy this type of PLINE. OFP.LSP: Will offset a 3D PLINE by xy, xyz, slope %. Must be simple 3D PLINES (not splined). BRP.LSP: Will break a simple 3D PLINE. Will not work with splined 3D PLINES.
Blipmodes 2/93 Layer Routines by Mark Crab and Dave Hagler. Click on file name below to download each routine.
SL.LSP: SETS CURRENT LAYER TO LAYER OF OBJECT PICKED. CTL.LSP: CHANGE TO LAYER, CHANGES PICKED ITEMS TO PICKED LAYER. CTCL.LSP: CHANGE TO CURRENT LAYER. FL.LSP: Freezes layer(s) of entity(s) picked, all selections allowed. FLC.LSP: Freezes layer(s) of object selected using any of the normal ACAD selection set modifiers, i.e., "crossing" or "window". Also builds frzsav, a list of layers frozen, for later thaw by TLP.LSP. FLE.LSP: Freezes all layer except the current layer and those layers selected. TLP.LSP: Thaws layers previously frozen with FLC.LSP. Uses frzsav, (list of layers previously frozen with FLC.LSP).
Back to Members Only Home Page
E-Mail PAUG at mail@paug.org.
Send Comments or Questions about this Web Site to webmaster@paug.org
Revised: January 07, 2004.