start4444 发表于 2018-7-23 17:10:48

本帖最后由 start4444 于 2018-7-27 12:20 编辑

maxli 发表于 2018-6-22 08:50
另外可以加矩形的么?
刚好我也用到这个,把方框选择加上,原图上的选框感觉保留比较好,比例为1时省去最后的尺寸比例处理,程序可以顺点

(DEFUN C:tt5()
(setq oldos (getvar "osmode"))
(setvar "osmode" 0)      
(PRINC "\n局部放大图-【默认圆形选区/方框选区(空格)】: ")
(if
(SETQ pt (getpoint "\n请指定圆心点: "))
(progn
(command "circle" pt pause)
(command "chprop" (entlast) "" "lt" "DASHED" "s" "1" "c" "252" "")
(SETQ e(entlast)
PC (cdr (assoc 10 (entget E)))
P(getpoint "\n请指定视图放置点: ")
K(getreal "\n请指定放大比例 <1>: ")
r(cdr (assoc 40 (entget e)))
)
      (if (= nil k) (setq k 1))
(command "copy" "cp")
(setq n 0)
(repeat 180
    (command (polar pc (/ (* 2 n pi) 180) r))
    (setq n (+ n 1))
)
(command "" "" pc p)
(setq n 0)
(setvar "pickbox" 5)
(command "circle" p r)
(setq ep (entlast))

(command "trim" ep "")
(repeat 180
    (command "f" (polar p (/ (* 2 n pi) 180) (* r 1.01)))
    (setq n (+ n 1))
    (command (polar p (/ (* 2 n pi) 180) (* r 1.01)) "")
)
(command "")
      (command "erase" ep "")
(if (/= 1 k)
(progn
(command "scale"
    "c"
    (list (- (car p) r) (- (cadr p) r))
    (list (+ (car p) r) (+ (cadr p) r))
    ""
    p
    k
)

;;;;;;;;;;;;;;;
      (setq ss (ssget "p" '((0 . "dimension"))));此处过滤出标注对象
(command "erase" ep "")
      (if ss
(progn
   (setq oldds (getvar "dimstyle"))
   (command "_dimstyle" "restore" "" (ssname ss 0))
   (setq oldfac (getvar "dimlfac"))
   (SETVAR "DIMLFAC" (/ oldfac k))
   (COMMAND "DIMSTYLE" "_APPLY" ss "")
   (command "-dimstyle" "r" oldds)))
                              ))
)
(progn
         (PRINC "\n【方框选区】: ")
(SETQ pt1 (getpoint "\n请指定第一点: ") pt2 (getcorner pt1 "\n请指定第二点: "))
(command "RECTANG" pt1 pt2)
(command "chprop" (entlast) "" "lt" "DASHED" "s" "1" "c" "252" "")
(SETQ e(entlast)

P(getpoint "\n请指定视图放置点: ")
K(getreal "\n请指定放大比例 <1>: ")
)
(if (= nil k) (setq k 1))
(command "copy" "c" pt1 pt2 "" pt1 p)
(command "RECTANG" p (polar p (angle pt1 pt2) (distance pt1 pt2)))
(setq ep (entlast))
------------------------------
(command "OFFSET" 1 ep (list 0 0) "")      
(setq en2 (entlast))

(setq Lst (mapcar 'cdr (vl-remove-if '(lambda (x) (/= (car x) 10)) (entget en2)))
      s1(nth 0 Lst)
      s2(nth 1 Lst)
      s3(nth 2 Lst)
      s4(nth 3 Lst))      
(command "TRIM" ep "" "f" s1 s2 s3 s4 s1 "" "")
(command "ERASE" ep en2 "")      
      
(if (/= 1 k)
      (progn
                              (command "scale" "c" s1 s3 "" p k )
                              (setq ss (ssget "p" '((0 . "dimension"))));此处过滤出标注对象
(command "erase" ep "")
      (if ss
(progn
   (setq oldds (getvar "dimstyle"))
   (command "_dimstyle" "restore" "" (ssname ss 0))
   (setq oldfac (getvar "dimlfac"))
   (SETVAR "DIMLFAC" (/ oldfac k))
   (COMMAND "DIMSTYLE" "_APPLY" ss "")
   (command "-dimstyle" "r" oldds)))
      ))
      ))
(setvar "osmode" oldos)
(princ)
)

maxli 发表于 2018-7-27 09:27:23

start4444 发表于 2018-7-23 17:10
刚好我也用到这个,把方框选择加上,原图上的选框感觉保留比较好,比例为1时省去最后的尺寸比例处理,程 ...

非常谢谢!!!!

追寻 发表于 2021-7-12 11:56:22

兰同学 发表于 2023-12-18 05:21:55

学一下,希望好用
页: 1 [2]
查看完整版本: 局部视图放大后 标注不变的问题