明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3697|回复: 13

付费,寻找懂视口的高手制作一个插件

[复制链接]
发表于 2017-8-8 13:10 | 显示全部楼层 |阅读模式
本帖最后由 lwl450 于 2017-8-20 22:22 编辑

付费,懂视口的高手制作一个插件.       根据布局视口自动更改标注,类似下面动图的   QQ:450739275

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2019-6-7 15:23 | 显示全部楼层
可以使用注释性。不过我是把标注改个标注样式的,也很快,当然也希望有大佬能做个插件
回复 支持 1 反对 0

使用道具 举报

发表于 2019-12-16 22:34 | 显示全部楼层
;;师兄 QQ361865648 Tel:13736698134于2019/12/16
;;闲来无事发一贴刷下存在感
(defun c:Vscl (/        center         curitm          dimscale ent            entdat
               etype        extcode         extinfo  extp1           extp2    hei
               i        j         len          lst           maxx            maxy
               minx        miny         msphei          mspwid   n1            n2
               newdat        newext         newextinfo           pickent  scale
               sclalecode         ss          vporthei wid            x
               y
              )
  (command "_.Pspace")
  (setq pickent (VL-CATCH-ALL-APPLY 'entsel '("\n拾取布局视口: ")))
  (if (VL-CATCH-ALL-ERROR-P pickent)
    (VL-EXIT-WITH-VALUE 0)
  )

  (setq ent (car pickent))
  (setq        entdat (entget ent)
        etype  (cdr (assoc 0 entdat))
  )
  (if (/= etype "VIEWPORT")
    (VL-EXIT-WITH-VALUE 0)
  )

  (setq lst (entget ent))
  (setq        wid         (cdr (assoc 40 lst)) ;_布局视口宽
        hei         (cdr (assoc 41 lst)) ;_布局视口高
        center         (cdr (assoc 12 lst)) ;_视口中心点wcs
        vporthei (cdr (assoc 45 lst))
        scale         (/ hei vporthei) ;_视口比例
        mspwid         (/ wid scale) ;_模型空间范围宽度
        msphei         (/ hei scale) ;_模型空间范围高度
        x         (car center)
        y         (cadr center)
        minx         (- x mspwid)
        maxx         (+ x mspwid)
        miny         (- y msphei)
        maxy         (+ y msphei)
        extp1         (list minx miny) ;_模型空间左下角点
        extp2         (list maxx maxy) ;_模型空间右上角点
  )
  (command "_.mspace")
;;;(command "_.zoom" "W" extp2 extp1)
  (setq        ss (ssget "_c"
                  extp2
                  extp1
                  (list (cons 0 "DIMENSION,LEADER,ARC_DIMENSION"))
           )
  )
  (setq dimscale (/ 1.0 scale)) ;_新的标注比例
  (setq i 0)
  (if ss
    (repeat (sslength ss)
      (setq ent        (ssname ss i)
            i        (1+ i)
      )
      (setq entdat (entget ent '("ACAD")))
      (setq extinfo (assoc -3 entdat))
      (setq sclalecode (cons 1040 dimscale))
      (cond
        (extinfo
         (setq extcode (cadr extinfo))
         (setq n1 (VL-POSITION (cons 1070 40) extcode))
         (setq n2 (VL-POSITION (cons 1002 "{") extcode))
         (setq j      0
               newext nil
               len    (length extcode)
         )
         (cond
           (n1
            (repeat len
              (setq curitm (nth j extcode))
              (if (= j (1+ n1))
                (setq newext (cons sclalecode newext))
                (setq newext (cons curitm newext))
              )
              (setq j (1+ j))
            )
           )
           (n2
            (repeat len
              (setq curitm (nth j extcode))
              (if (= j (1+ n2))
                (setq newext (cons sclalecode newext))
              )
              (setq newext (cons curitm newext))
              (setq j (1+ j))
            )
           )
         )
         (setq newext (REVERSE newext))
         (setq newextinfo (cons -3 (list newext)))
         (setq newdat (subst newextinfo extinfo entdat))
        )
        (t
         (setq newdat (REVERSE entdat)
               newdat
                      (cons
                        (cons
                          -3
                          (list        (cons "ACAD"
                                      (list
                                        (cons 1000 "DSTYLE")
                                        (cons 1002 "{")
                                        (cons 1070 40)
                                        (cons 1040 dimscale)
                                        (cons 1002 "}")
                                      )
                                )
                          )
                        )
                        newdat
                      )
               newdat (REVERSE newdat)
         )
        )
      )
      (entmod newdat)
      (entupd ent)
    )
  )
  (command "_.Pspace")
)






































 楼主| 发表于 2019-12-17 08:22 | 显示全部楼层
caiqs 发表于 2019-12-16 22:34
;;师兄 QQ361865648 Tel:13736698134于2019/12/16
;;闲来无事发一贴刷下存在感
(defun c:Vscl (/        center         ...

师兄厉害,架构构思有了看来有希望弄成自己想要的了,谢谢师兄了
发表于 2017-8-8 22:46 | 显示全部楼层
dimlfac 的变量控制.
update一下.
发表于 2017-8-9 10:17 | 显示全部楼层
关键是从布局取得模型标注对象
 楼主| 发表于 2017-8-9 12:58 | 显示全部楼层
zzyong00 发表于 2017-8-8 15:49
貌似可做。。。。

是可以做,就是拾取的对象麻烦点

点评

如果只是麻烦点儿,就自己做吧,何必付费呢  发表于 2017-8-9 21:32
发表于 2017-8-9 22:03 | 显示全部楼层
vb.net做的!标注样式和比例要提前设置

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2017-9-13 07:22 来自手机 | 显示全部楼层
用lisp做简单
发表于 2019-3-19 16:22 | 显示全部楼层
cad 2006 就可以用注释标注了,不同比例视口显示同一尺寸,比例不一样
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-4-26 21:41 , Processed in 0.645112 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表