乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: JeepMaster

[编程交流] Scaling dwg from 1:100 to 1:50

[复制链接]

11

主题

117

帖子

133

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
52
发表于 2022-7-6 12:27:13 | 显示全部楼层
You mean annotative.  Yes, it's an electrical power plan for a building, so it will have text, electrical symbols, notes with leaders, etc.
 
Lee, the only thing I can't figure out is how to include the arrowhead on the leaders so the arrowhead size will be scaled up/down too.  Right now after I run the lisp, I'll have to select all the leaders and manualy change the arrow head size to the correct size from the properties window.  DIMASZ only works if the leaders are drawn afterwards.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:30:22 | 显示全部楼层
Ok, not sure if this suits?
 
  1. (defun c:sclAll (/ *error* BLKS DOC ENT I MA MI OBJ PTLST SCL SS UF) (vl-load-com) (defun *error* (msg)   (and uF (vla-EndUndoMark doc))   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")       (princ (strcat "\n** Error: " msg " **")))   (princ)) (setq blks (vla-get-Blocks              (setq doc (vla-get-ActiveDocument                          (vlax-get-acad-object))))) (initget 7) (setq scl (getreal "\nSpecify Scale Factor: ")) (if (setq i -1 ss (ssget "_:L"))   (progn     (setq uF (not (vla-StartUndoMark doc)))     (while (setq ent (ssname ss (setq i (1+ i))))       (setq obj (vlax-ename->vla-object ent))       (cond (  (eq "INSERT" (cdr (assoc 0 (entget ent))))                (if (not (eq :vlax-true                           (vla-get-isXRef                             (vla-item blks (vla-get-Name obj)))))                                    (vla-ScaleEntity obj                    (vla-get-InsertionPoint obj) scl)))             (  (wcmatch (cdr (assoc 0 (entget ent))) "*TEXT")                (vla-ScaleEntity obj                  (vlax-get-property obj                    (if (eq "AcDbText" (vla-get-ObjectName obj))                      (if (eq acAlignmentLeft (vla-get-Alignment obj))                            'InsertionPoint 'TextAlignmentPoint) 'InsertionPoint)) scl))             (t (vla-getBoundingBox obj 'Mi 'Ma)                (setq ptLst (mapcar (function vlax-safearray->list) (list Mi Ma)))                (vla-ScaleEntity obj                  (vlax-3D-point                    (polar (car ptLst)                              (apply (function angle)    ptLst)                           (/ (apply (function distance) ptLst) 2.))) scl)                (if (wcmatch (cdr (assoc 0 (entget ent))) "*LEADER")                  (vla-put-ArrowHeadSize obj (* (vla-get-ArrowHeadSize obj) scl))))))          (setq UF (vla-EndUndoMark doc))))  (princ))
回复

使用道具 举报

11

主题

117

帖子

133

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
52
发表于 2022-7-6 12:34:18 | 显示全部楼层
Thanks Lee for the quick response, this seems work for the arrow head sizing, but the leaders are back to being screwy again like what happen from the first version of this lisp.  The middle points of the leader are moved.  Maybe if you can use the same method on the arrowheads only but added to the previous version. This lisp is way above my skills.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:37:01 | 显示全部楼层
 
Bear in mind that the other LISP doesn't scale the leaders at all... This one scales the Leaders using the mid-point of the bounding box.
 
I shall try one more
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:40:55 | 显示全部楼层
If this doesn't work, then I don't know what to do...
 
  1. (defun c:sclAll (/ *error* BLKS DOC ENT I MA MI OBJ PTLST SCL SS UF) (vl-load-com) (defun *error* (msg)   (and uF (vla-EndUndoMark doc))   (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")       (princ (strcat "\n** Error: " msg " **")))   (princ)) (defun vlax-list->3D-point (lst)   (if lst     (cons (list (car lst) (cadr lst) (caddr lst))           (vlax-list->3D-point (cdddr lst))))) (setq blks (vla-get-Blocks              (setq doc (vla-get-ActiveDocument                          (vlax-get-acad-object))))) (initget 7) (setq scl (getreal "\nSpecify Scale Factor: ")) (if (setq i -1 ss (ssget "_:L"))   (progn     (setq uF (not (vla-StartUndoMark doc)))     (while (setq ent (ssname ss (setq i (1+ i))))       (setq obj (vlax-ename->vla-object ent))       (cond (  (eq "INSERT" (cdr (assoc 0 (entget ent))))                (if (not (eq :vlax-true                           (vla-get-isXRef                             (vla-item blks (vla-get-Name obj)))))                                    (vla-ScaleEntity obj                    (vla-get-InsertionPoint obj) scl)))             (  (eq (cdr (assoc 0 (entget ent))) "LEADER")                (vla-ScaleEntity obj                  (vlax-3D-point                    (last                      (vlax-list->3D-point                        (vlax-safearray->list                          (vlax-variant-value                            (vlax-get-property obj 'Coordinates)))))) scl)                               (vla-put-ArrowHeadSize obj                  (* (vla-get-ArrowHeadSize obj) scl)))             (  (eq (cdr (assoc 0 (entget ent))) "MULTILEADER")                (vla-ScaleEntity obj                  (vlax-3D-point                    (last                      (vlax-list->3D-point                        (vlax-safearray->list                          (vlax-variant-value                            (vlax-invoke-method obj 'GetLeaderLineVertices 0)))))) scl))                              (  (wcmatch (cdr (assoc 0 (entget ent))) "*TEXT")                (vla-ScaleEntity obj                  (vlax-get-property obj                    (if (eq "AcDbText" (vla-get-ObjectName obj))                      (if (eq acAlignmentLeft (vla-get-Alignment obj))                            'InsertionPoint 'TextAlignmentPoint) 'InsertionPoint)) scl))             (t (vla-getBoundingBox obj 'Mi 'Ma)                (setq ptLst (mapcar (function vlax-safearray->list) (list Mi Ma)))                (vla-ScaleEntity obj                  (vlax-3D-point                    (polar (car ptLst)                              (apply (function angle)    ptLst)                           (/ (apply (function distance) ptLst) 2.))) scl))))          (setq UF (vla-EndUndoMark doc))))  (princ))
回复

使用道具 举报

11

主题

117

帖子

133

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
52
发表于 2022-7-6 12:42:03 | 显示全部楼层
Thanks Lee again. It seems like the mid point is moved further away from the original spot than the previous version.  Maybe whatever you did, do it the opposite?!?  Or maybe I'm just talking out of my @ss.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:45:10 | 显示全部楼层
I just the start vertex of the Leader Line, i.e. the arrow point.
 
I shall try the end, as its not too hard to incorporate.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:48:31 | 显示全部楼层
Above code updated.
回复

使用道具 举报

11

主题

117

帖子

133

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
52
发表于 2022-7-6 12:52:15 | 显示全部楼层
Doesn't seem to work either.  Leaders are still getting wired mid point.  Its ok if it's too much.  I don't want waste too much of your time. Thanks for trying Lee.
回复

使用道具 举报

41

主题

301

帖子

265

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
209
发表于 2022-7-6 12:55:30 | 显示全部楼层
 
Blocks(symbols), Text, Leaders, all will work in annotative
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-5 10:26 , Processed in 0.436871 second(s), 70 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表