- (defun c:gczbh1 (/ p qianzhui blc zg ss i lst e kkkk ptlst ff )
- (setq blc (getint "\n请输入比例尺1:"))
- (setvar 'userr1 blc);设置比例尺
- (setq zg(* 0.002 blc));字高
- (defun get_inpoint (blockname)
- (setq in_point(cdr (assoc 10 (entget blockname))))
- in_point
- )
- (setq ss (ssget '((0 . "insert"))) )
- ;(setq jidian (getpoint "请选择基点:"))
- ;(setq fangx (getpoint jidian "请选择方向点:"))
- ;(setq angle1 (* (angle jidian fangx) 1))
- ;(command "_.rotate" ss "" jidian "r" jidian fangx (polar jidian 0 100))
- (setq i 0)
- (setq lst '())
- (repeat (sslength ss)
- (setq insert_name (ssname ss i))
- (setq e(get_inpoint insert_name))
- (setq lst (append lst (list e)))
- (setq i (1+ i))
- )
- ;(setq ptlst (HH:ssPts:Sort lst "xyz" 0.0))
- ;@树櫴希德 点表按照特定点逆时针排序~
- (setq p (getpoint "\n指定排序方向"))
- (setq qianzhui (getstring "\n请输入前缀:"))
- ;(setq ptlst(mapcar 'cdr (vl-sort (mapcar 'cons (mapcar '(lambda(x) (angle x p)) lst) lst) '(lambda (x y) (< (car x) (car y))))))
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- (setq ptlst (vl-sort (reverse lst)
- ;以下根据x坐标对表排序
- '(lambda (e1 e2)
- (< (car e1) (car e2) )
- (= (angle e1 p)) ) ) )
- ;;;;;;;;;;;;;;;;;-----------------------------------
- (initget "1 2")
- (prompt "\n坐标是否缩小1000倍:")
- (setq kkkk (getkword "\n 1. 不用缩小1000倍 \ 2. 缩小1000倍:<1>"))
- (if (= kkkk nil) (setq kkkk "1"))
- (setq ii 1)
- (setq ff (open (getfiled "请输入要保存的数据文件名" "" "dat" 1) "w"))
- ( cond ((= kkkk "1")
- (progn
- (foreach n ptlst
- (entmake (list '(0 . "text") (cons 10 n) '(7 . "HZ") (cons 40 zg)(cons 1 (strcat qianzhui (rtos ii 2 0)) )))
- (write-line (strcat qianzhui (vl-princ-to-string ii)"," ","(vl-princ-to-string (car n)) ","(vl-princ-to-string (cadr n))","(vl-princ-to-string (caddr n))
- ) ff)
-
- (setq ii (1+ ii))
- )(close ff) ))
- ( (= kkkk "2")
- (progn
- (foreach n ptlst
- (entmake (list '(0 . "text") (cons 10 n) '(7 . "HZ") (cons 40 (* 1000 zg))(cons 1 (strcat qianzhui (rtos ii 2 0)) )))
- (write-line (strcat qianzhui (vl-princ-to-string ii)"," ","(vl-princ-to-string (/ (car n) 1000)) ","(vl-princ-to-string (/ (cadr n) 1000))","(vl-princ-to-string (/ (caddr n) 1000))
- ) ff)
-
- (setq ii (1+ ii))
- ) (close ff)
- )
- )
-
- )
-
-
- )
|