AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

Here is another version of pclose with the ability to enter "c" or "space"/"enter" for the prompt. Also it cleans up the prompts on the command line.

Mike Melichar

;CODING STARTS HERE
;---------------------------------------------------------------------
; draw pline and close with c, enter or space
;---------------------------------------------------------------------

(defun c:pclose (/ pt1 pt2)
(setq cmdecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq pt1 (getpoint "\nStart point: "))
(setq pt2 (getpoint pt1 "\nNext point: "))
(command "PLINE" pt1 pt2)
(while pt2
(initget "Close")
(setq pt2 (getpoint pt2 "\nNext point or [Close/Enter]: "))
(if (or (= pt2 "Close") (= pt2 nil))
(progn
(command "c")
(setq pt2 nil)
)
(command pt2)
)
)

(setvar "cmdecho" cmdecho)
(princ)
)
;CODING ENDS HERE

The AutoLisp/Visual Lisp/VBA Resource Website

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website