MENGZE 发表于 2012-2-20 21:45:42

求完善!!!!!!!

(defun c:kK()

(arxload "geomcal.arx")

(setq chk (tblsearch "layer" "1"))(if (= chk nil)

(command "-layer" "n" "1" ""))

(setq chk (tblsearch "layer" "00"))

(if (= chk nil)

(command "-layer" "n" "00" ""))

(command "-layer" "c" 1 "1" "")

(command "-layer" "c" 212 "00" "")

(setq ss (ssget '((0 . "LWPOLYLINE"))))

(setq xb_height (getreal "\n输入高度(mm): "))

(setq base_pt (getpoint "\n插入点: "))

(setq xb_jj (getreal "\n间距(mm) : "))

(setq dimx_pt (list (/ (- 0 xb_height) 2) 0 0))

(setq dimy_pt (list 0 (/ xb_height 10) 0))

(setq i 0)

( while (setq ssi (ssname ss i))

(setq i (+ i 1))

(setq ssi_list (entget ssi))

(setqpt_list
   
(vl-remove-if-not '(lambda(num) (= (car num) 10)) ssi_list)

)

(setq pt_list (mapcar '(lambda(num) (cdr num)) pt_list))

(setq pt1 (car pt_list))

(setq pt2 (cadr pt_list))

(setq pt3 (caddr pt_list))

(setq pt4 (cadddr pt_list))

(setq l1 (distance pt1 pt2))

(setq l2 (distance pt1 pt3))

(setq xb_width (if (> l1 l2) l1 l2))

(setq xb_id (strcat "" (itoa i)))

(command "-layer" "s" "00" "")

(command "text" "j" "mc" (cal "( pt1 + pt3 ) / 2") (/ xb_height 5) "" xb_id)

(setq bl_pt base_pt)

(setq dt_pt (list xb_width xb_height 0))

(setq dtx_pt (list (+ xb_width xb_jj) 0 0))

(setq tr_pt (cal "base_pt + dt_pt"))
   
(command "-layer" "s" "00" "")

(command "text" "j" "mc" (cal "(bl_pt + tr_pt) / 2") (/xb_height 5) "" xb_id)

(setq base_pt (cal "base_pt + dtx_pt"))
(command "-layer" "s" "1" "")

(command "rectangle" bl_pt tr_pt)


)
(princ)
)


求归位大师帮忙!!!
问题是,1)尺寸不准确,2)是否可以将文字固定大小。
页: [1]
查看完整版本: 求完善!!!!!!!