- (defun c:de3 (/ a lm-entmake-layer ss ss-enlst str wz wz0 wz1 wz2 wz3)
- (defun lm-entmake-layer(datalst)
- (mapcar'set '(tc co) datalst)
- (or co (setq co 256))
- (or tc (setq tc (getvar "clayer")))
- (entmake (list '(0 . "LAYER")'(100 . "AcDbSymbolTableRecord")'(100 . "AcDbLayerTableRecord")(cons 2 tc)(cons 62 co)'(70 . 0)'(6 . "CONTINUOUS")))
- )
- (defun ss-enlst (ss / enlst)
- (cond
- ((= (type ss) 'PICKSET)
- (vl-remove-if-not '(lambda (x) (= (type x) 'ENAME)) (mapcar 'cadr (ssnamex SS)))
- )
- ((= (type ss) 'LIST)
- (setq enlst (ssadd))
- (last (mapcar '(lambda (x) (ssadd x enlst)) ss))
- )
- )
- )
- (if (null (tblsearch "layer" "2_正折"))
- (lm-entmake-layer (list "2_正折" 211))
- )
- (setq a (ssget "X" '((8 . "2_正折"))))
- (foreach ty (ss-enlst a)
- (vla-put-Layer (vlax-ename->vla-object ty) "bend")
- )
- (setq ss (ssget '((0 . "*TEXT") (1 . "上DOWN*,下DOWN*"))))
- (foreach ty (vl-remove-if-not '(lambda (x) (= (type x) 'ENAME)) (mapcar 'cadr (ssnamex ss)))
- (setq str (vla-get-TextString (vlax-ename->vla-object ty)))
- (setq wz (vl-string-search "." str))
- (if wz
- (progn
- (setq wz0 (substr str (+ wz 1) 3))
- (if (= wz0 ".00")
- (progn
- (setq wz1 (substr str 1 wz))
- (setq wz2 (substr str (+ wz 4)))
- (setq wz3 (strcat wz1 wz2))
- (vla-put-TextString (vlax-ename->vla-object ty) wz3)
- )
- )
- )
- )
- )
- (princ)
- )
|