Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

lisp error

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Anonymous
962 Views, 5 Replies

lisp error

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

 

 

5 REPLIES 5
Message 2 of 6
Shneuph
in reply to: Anonymous

(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...

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 3 of 6
Anonymous
in reply to: Shneuph

thanks Shneuph!.........works in 2017 now......I'll leave my original as it works in other versions,
Message 4 of 6
Kent1Cooper
in reply to: Anonymous

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.

Kent Cooper, AIA
Message 5 of 6
Anonymous
in reply to: Kent1Cooper

thanks, I give it a try
Message 6 of 6
Anonymous
in reply to: Kent1Cooper

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.

Post to forums  

State of Sustainability Webinar


AutoCAD Inside the Factory