lengxiaxi 发表于 2014-12-2 20:55:12

局部视图放大后 标注不变的问题

局部视图放大程序来自 黄儒明大师。

最近看到一个黄大师的帖子,视图局部放大。lsp做的很好,针对圆形,曲线范围的局部放大视图的生成,很方便和实用。

    我的问题是这样的:现在图纸的比例因子是1:1。把一个局部视图放大两倍,那么放大两倍后,标注数值也会显示两倍。例如:一个直径10的圆,局部视图放大两倍后,再标注,直径会变为20.有没有一个lsp能实现框选标注,输入缩放比例数值,使框选范围内的标注按比例放大或缩小。使得放大后的局部视图标注数值,与未放大的实际数值一致??

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)
)

hlx9611 发表于 2018-7-5 08:17:42

对象捕捉被关了,改一下


(DEFUN C:ffs()
(setq oldos (getvar "osmode"))
(setvar "osmode" 0)
(PRINC "\n局部放大图: ")
(SETQ pt (getpoint "\n请指定圆心点: "))
(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请指定放大比例: ")
r(cdr (assoc 40 (entget e)))
)
(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 "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 e "")
      (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时省去最后的尺寸比例处理,程 ...

非常谢谢!!!!

自贡黄明儒 发表于 2014-12-2 20:59:04

你要看G版那个,放大后内部文字尺寸再按比例缩回去

AMTONNY 发表于 2014-12-7 18:16:08

给你这个看看
(DEFUN C:ffs (/ E P PC K R N EP)
(setvar "osmode" 0)
(PRINC "\n局部放大图: ")
(SETQ pt (getpoint "\n请指定圆心点: "))
(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请指定放大比例: ")
r(cdr (assoc 40 (entget e)))
)
(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 "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 e "")
      (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)))

(princ)
)

maxli 发表于 2018-6-22 08:49:46

AMTONNY 发表于 2014-12-7 18:16
给你这个看看
(DEFUN C:ffs (/ E P PC K R N EP)
(setvar "osmode" 0)


你这个相当好用

maxli 发表于 2018-6-22 08:50:05

AMTONNY 发表于 2014-12-7 18:16
给你这个看看
(DEFUN C:ffs (/ E P PC K R N EP)
(setvar "osmode" 0)


另外可以加矩形的么?

maxli 发表于 2018-6-22 08:50:22

AMTONNY 发表于 2014-12-7 18:16
给你这个看看
(DEFUN C:ffs (/ E P PC K R N EP)
(setvar "osmode" 0)


另外可以加矩形的么?

fcrosstour 发表于 2018-6-23 22:20:32

maxli 发表于 2018-6-22 08:50
另外可以加矩形的么?

同问,可以加矩形吗

start4444 发表于 2018-7-17 17:31:40

lijiao 发表于 2018-7-18 08:33:34

关于局部放大图,建议你用专业软件去处理,比如mechanical等,不用费神去写哪那么多程序,把主要精力用在工作中。
页: [1] 2
查看完整版本: 局部视图放大后 标注不变的问题