(setq max_x (car (car pt_list)))
(setq min_x_pt_list nil)
(setq max_x_pt_list nil)
(foreach val pt_list
(if(= (car val) min_x)
(setq min_x_pt_list (cons val min_x_pt_list))
)
(if(= (car val) max_x)
(setq max_x_pt_list (cons val max_x_pt_list))
)
)
(setq min_x_pt_list (vl-sort min_x_pt_list (function (lambda (e1 e2) (< (cadr e1) (cadr e2))))))
(setq min_x_pt (car min_x_pt_list))
(setq max_x_pt_list (vl-sort max_x_pt_list (function (lambda (e1 e2) (> (cadr e1) (cadr e2))))))
(setq max_x_pt (car max_x_pt_list))
;;; (prin1 min_x_pt)
;;; (prin1 max_x_pt)
(setq dd (- max_x min_x))
(setq dd (fix dd))
;;;(prin1 dd)
)
;;;;;;;;不同图幅图纸,图号字符提取
;;;;;;------------A0----------------------
;;;(defun a0_tufu (/ sss0 en endata)
;;; (command "zoom" "W" (list (- 1144 25) (- 60 5)) (list (+ 1144 25) (+ 60 5)))
;;; (setq sss0 (ssget "W" (list (- 1144 25) (- 60 5)) (list (+ 1144 25) (+ 60 5)) '((0 . "TEXT"))))
;;; (setq en (ssname sss0 0))
;;; (setq endata (entget en))
;;; (setq tuhao (cdr (assoc 1 endata)))
;;;)
;;;;;;------------A1----------------------
;;;
;;;(defun a1_tufu (/ sss1 en endata)
;;; (command "zoom" "W" (list (- 796 25) (- 60 5)) (list (+ 796 25) (+ 60 5)))
;;; (setq sss1 (ssget "W" (list (- 796 25) (- 60 5)) (list (+ 796 25) (+ 60 5)) '((0 . "TEXT"))))
;;; (setq en (ssname sss1 0))
;;; (setq endata (entget en))
;;; (setq tuhao (cdr (assoc 1 endata)))
;;;)
;;;
;;;
;;;;;;------------A2----------------------
;;;(defun a2_tufu (/ sss2 en endata)
;;; (command "zoom" "W" (list (- 549 25) (- 60 5)) (list (+ 549 25) (+ 60 5)))
;;; (setq sss2 (ssget "W" (list (- 549 25) (- 60 5)) (list (+ 549 25) (+ 60 5)) '((0 . "TEXT"))))
;;; (setq en (ssname sss2 0))
;;; (setq endata (entget en))
;;; (setq tuhao (cdr (assoc 1 endata)))
;;;)
;;;
;;;;;;------------A3----------------------
;;;(defun a3_tufu (/ sss3 en endata)
;;; (command "zoom" "W" (list (- 380 25) (- 55 5)) (list (+ 380 25) (+ 55 5)))
;;; (setq sss3 (ssget "W" (list (- 380 25) (- 55 5)) (list (+ 380 25) (+ 55 5)) '((0 . "TEXT"))))
;;; (setq en (ssname sss3 0))
;;; (setq endata (entget en))
;;; (setq tuhao (cdr (assoc 1 endata)))
;;;)
;;;
;;;;;;------------A4----------------------
;;;(defun a4_tufu (/ sss4 en endata)
;;; (command "zoom" "W" (list (- 170 25) (- 55 5)) (list (+ 170 25) (+ 55 5)))
;;; (setq sss4 (ssget "W" (list (- 170 25) (- 55 5)) (list (+ 170 25) (+ 55 5)) '((0 . "TEXT"))))
;;; (setq en (ssname sss4 0))
;;; (setq endata (entget en))
;;; (setq tuhao (cdr (assoc 1 endata)))
;;;)
(defun get_rowandcolumn(/ pt3 pt4 ss_row ss_column)
(setq pt3 (getpoint "\n输入第一角点:"))
(setq pt4 (getcorner pt3 "\n输入第二角点:"))
(setq ss_row (ssget "C" pt3 (list (car pt3) (cadr pt4)) '((0 . "LINE"))))
(setq m (sslength ss_row)) ;计算横行数
(setq ss_column (ssget "C" pt3 (list (car pt4) (cadr pt3)) '(