我想的是如果能够不跳出来继续执行下一个圆就好了,请问该怎么办?

(defun c:ad() ;;;;程序选择可以求几个圆的面积,并在圆框内写出面积大小。
(defun *error* (msg)
(print msg)
(setq ccxx (strcat "求面积失败!!!第" i0 "个面积求取不成功。")); ccxx:出错信息
(alert ccxx)
(princ)
)
(setvar "osmode" 0)
(setvar "cmdecho" 0)
(while (/= 0 (getvar "cmdactive")) (command ""))

(setq yorn "" i 1 i0 "1")
(while (eq yorn "")
(setq pt (getpoint "选取点: \n"))
;;;;以下在点圆中取一个点,并获取面积
(command "bpoly" pt "") 
(setq en (entlast))
(command "area" "o" en)
(setq mj (getvar "area"))
(setq mj (rtos mj))
(command "text" "j" "mc" pt "0" mj "")
;;;;获取面积成功并写出
(setq i (1+ i) i0 (itoa i))
(setq yorn (getstring (strcat "添加第" i0 "个点?回车确认或输入n后回车中止选点:")))

)
屏幕上有20个圆,我在圆内点1个点,就会在点的位置显示圆的面积,然后继续点下一个点。
问题是,如果我有一个点点在圆外,程序的(command "bpoly" pt "") 语句就会出错,然后就跳出来了,我想的是如果能够不跳出来继续执行下一个圆就好了,请问怎么办

千万里不及你
浏览 74回答 1
1回答

烙印99

;圆具有面积属性,没有必要生成一个边界再来求面积;选取圆后自动标注面积(可单选、多选或框选)(defun c:bzymj()(vl-load-com)(setq cm (getvar "cmdecho") os (getvar "osmode"))(setvar "cmdecho" 0) (setvar "osmode" 0)(command "_undo" "be")(while (progn(princ "\n请选取圆:")(setq ssa (ssget '((0 . "circle")))))(setq i 0)(repeat (sslength ssa)(setq ent (ssname ssa i)obj (vlax-ename->vla-object ent)pt (vlax-get obj "Center")mj (rtos (vlax-get obj "area") 2 3)Hig (* (vlax-get obj "diameter") 0.618)i (1+ i))(command "_text" "j" "mc" pt Hig 0 mj)))(command "_undo" "e")(setvar "osmode" os) (setvar "cmdecho" cm) (princ)) 
打开App,查看更多内容
随时随地看视频慕课网APP