I struggle with LISP's and would greatly appreciate if someone could find or write one.
What I need is a command to cut back a line. There are a lot of lines we need to add in paper space such as grid and hand rail lines. These lines get cut back 1/16" back from where they connect to. Right now I have to click on the line, grab the grip, move the mouse back and type in 1/16" and then enter, and then repeat a bunch more time on all the other lines that require a cut back. Would it be possible to have a command that once prompted would let me click on the desired line, then click on an end point, then click in the direction that I want the line cut back, and end up with a 1/16" gap?
John S. Bernholt
I forgot to add, somtimes I need it to extend 1/16". Could the LSP mentioned above not just be able to cut the line back 1/16", but aslo be able to extend it 1/16" depending upon which side of the end point you click on?
I appreciate the respose, but I have to invoke the lengthen command and type DE everytime. I was looking for a LSP where I could just click on the line and then click the direct that needs to move by 1/16". I'm really looking for two clicks and not typing anything in. Thanks again for your time.
(defun c:LEN ()
(setvar "cmdecho" 0)
(command "lengthen" "DE" "1/16")
(defun c:LEN- ()
(setvar "cmdecho" 0)
(command "lengthen" "DE" "-1/16")
.... Would it be possible to have a command that once prompted would let me click on the desired line, then click on an end point, then click in the direction that I want the line cut back, and end up with a 1/16" gap?
....somtimes I need it to extend 1/16". Could the LSP mentioned above not just be able to cut the line back 1/16", but aslo be able to extend it 1/16" depending upon which side of the end point you click on?
If they're always only Line entities, and you don't have to deal with other-than-World Coordinate Systems or other such complications, try the code below, which lets you change Lines in either direction under the same command, and as many as you want with one invocation of it.
Select a Line, and it will Zoom in close enough to the nearer end that you can easily see the 1/16" increment, and you pick where you want that endpoint changed to, in either direction [or to the side if you wish, though I assume you wouldn't]. It turns on Snap to 1/16", aligned with the Line and with the snap origin at that endpoint, so the new endpoint location you pick will be a clean 1/16" from the old endpoint [or a multiple of 1/16" -- you can change it by more if you want, though I assume you wouldn't]. It pauses for half a second so you can see that the Change took place, and then Zooms back and asks you to pick another. Escape to get out of it, and all the settings return to what they were.
Minimally tested, and without other possible enhancements it could have, such as allowing only Lines, or conversely, working with Polylines too [much more complicated], or asking again if you miss, etc., but see what you think.
(defun C:CES ; = Change End by Sixteenths
(/ *error* snapu snapa snapb ls lin ne)
(defun *error* (errmsg)
(if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
(princ (strcat "\nError: " errmsg))
); end if
(setvar 'snapunit snapu)
(setvar 'snapang snapa)
(setvar 'snapbase snapb)
); defun - *error*
snapu (getvar 'snapunit)
snapa (getvar 'snapang)
snapb (getvar 'snapbase)
(setvar 'snapunit '(0.0625 0.0625))
ls (entsel "\nSelect Line to change end of [Esc to exit]: "); = Line Selection
lin (car ls)
ne (osnap (cadr ls) "_end"); = Near End
(setvar 'snapbase (list (car ne) (cadr ne)))
'(0 0 0)
(vlax-curve-getParamAtPoint lin ne)
"_zoom" "_c" ne 0.5
"_change" lin "" pause
Here's another method for your use (I'm in a generous mood today).
You can declare any value weather adding to the line or subtracting.
Just declare these in your favorite ACAD**.MNL/LSP file and have the attached file loaded.
(if (findfile "STR_TRIM.lsp") (load "STR_TRIM"))
(defun c:T16 () (STR_TRIM -0.0625)) ;trims 1/16 inch.
(defun c4 () (STR_TRIM 4.0)) ;stretch 4 inch.
(defun cB () (STR_TRIM 5.5)) ;stretch 5 1/2" for brick.
...populate with any other distances you see fit.
If you select something else besides a LINE, you will be asked to try again.
The nearest endpoint of where you selected will be the end that is edited.
The program lets you know if the trim value is greater than the line's length.
This program does not loop.
Access a broad range of knowledge to help get the most out of your products and services.