本帖最后由 夏生生 于 2023-12-5 19:51 编辑
试试
 - (defun c:tt (/ str->l a b lst pt str1 str2)
- (defun str->l (Str Key / i s lst)
- (while (setq i (vl-string-search Key Str))
- (setq s (substr Str 1 i)
- Str (substr Str
- (+ 1
- (strlen key)
- (if i
- i
- 0)))
- Lst (cons s Lst)))
- (vl-remove "" (reverse (cons str Lst))))
- (setq str1 (getstring "\n横向尺寸(a,b,c..):")
- str1 (mapcar 'atof (str->l str1 ","))
- str2 (getstring "\n纵向尺寸(a,b,c..):")
- str2 (mapcar 'atof (str->l str2 ","))
- pt (getpoint "\n插入点:")
- a 0
- lst (mapcar
- '(lambda (x)
- (setq a (+ a x)
- b 0)
- (mapcar '(lambda (y) (list (setq b (+ b y)) a))
- (cons 0 str1)))
- (cons 0 str2)))
- (foreach n lst
- (mapcar
- '(lambda (x y)
- (entmake
- (list '(0 . "line")
- (cons 10 (trans (mapcar '+ pt x) 1 0))
- (cons 11 (trans (mapcar '+ pt y) 1 0)))))
- n
- (cdr n)))
- (setq lst (apply 'mapcar (cons 'list lst)))
- (foreach n lst
- (mapcar
- '(lambda (x y)
- (entmake
- (list '(0 . "line")
- (cons 10 (trans (mapcar '+ pt x) 1 0))
- (cons 11 (trans (mapcar '+ pt y) 1 0)))))
- (cdr n)
- n)))
|