hi I have a great lisp to draw a cut off pipe end, that works in ACAD 2013-2015.....I get this error in 2017 : "Error: bad argument type: 2D/3D point: nil"....
(see attached)
..I see most people post the whole lisp here , so...
(defun c:pipe (/ plwid first second pt1 pt2 ang dis pt3 layr entl)
(setq olderr *error* *error* pipe_err)
(setq plwid (getvar"plinewid"))
(setvar"plinewid" 0)
(while (not
(setq first (entsel "\nPick first endpoint: ")))
(prompt "\nNo endpoint found. ")
)
(while (not
(setq second (entsel "\nPick second endpoint: ")))
(prompt "\nNo endpoint found. ")
)
(if second
(progn
(setq pt1 (osnap (cadr first) "qui,end")
pt2 (osnap (cadr second) "qui,end")
)
(setq ang (angle pt1 pt2)
dis (distance pt1 pt2)
pt3 (polar pt1 ang (/ dis 2.0))
)
(command "pline" pt1 "arc" "a" "100" pt3 pt2 "a" "-100" pt3 ""))
)
(setq layr (cdr (assoc 8 (entget (car first))))
entl (entget (entlast))
)
(setq entl (subst (cons 8 layr)(assoc 8 entl) entl))
(entmod entl)
(setvar "plinewid" plwid)
(setq *error* olderr)
(princ)
)
(defun pipe_err (s)
(if (/= s "Function cancelled")
(princ (strcat "\nError: "s))
)
(setvar"plinewid" plwid)
(if olderr (setq *error* olderr))
(princ)
)
anybody have a few minutes to have a look?..
thanks
Solved! Go to Solution.
Solved by Shneuph. Go to Solution.
(if second
(progn
(setq pt1 (osnap (cadr first) "qui,end")
pt2 (osnap (cadr second) "qui,end")
)
I removed these and it worked for me. IDK what snap that is supposed to be calling? Quadrant? But it worked for me w/ just "end"
EDIT:
See this thread http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/autolisp-osnap-function-2016/td-p/620...
For a better one [if I do say so myself], try CAPEND.lsp with its CE command, available here. Yours may be the same as the one I wrote that in reaction to -- at least it has the same drawbacks [it will put one across endpoints that are not on parallel objects or are not aligned, and it will draw it facing the wrong way half the time]. CE also has other end-capping options than the pipe-end shape.
I like it!......and it draws the pipe end correctly no matter which line end I pick........my lisp draws the pipe cut off upside down if I pick right to left for example and I always forget which way, as it makes a differnce if top or bottom....yours works all ways
Can't find what you're looking for? Ask the community or share your knowledge.