乐筑天下

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

[编程交流] 更改圆形块的比例

[复制链接]

5

主题

956

帖子

963

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-5 16:14:23 | 显示全部楼层
是的,同意如果块居中,则很容易修改X和Y比例特性或lisp。
  1. (mapcar ''((x) (vlax-put obj (strcat x "Effectivescalefactor") scl)) '("X" "Y"))

 
 
好主意和塔瓦的包围盒想法
这是测试
 
  1. [color="green"];rescale bubble test[/color]
  2.   (defun c:bubsc (/ bn scl ss blk bo scl s2 dp p i ip lo st isblk)
  3.     ;hanhphuc 28.05.2018
  4.     (initget 7)
  5.     (and
  6.   (setq bn [color="purple"][b]"test"[/b][/color][color="green"] ; <-- block name to modify [/color]
  7.                scl (getreal "\nSpecify scale factor : "))
  8.   (setq        blk ((lambda (doc) (foreach x '(ActiveDocument Blocks) (setq doc (vlax-get doc x))))
  9.               (vlax-get-acad-object)
  10.               )
  11.         ss  (ssget "X"
  12.                    (list '(-4 . "<OR")'(-4 . "<AND")'(0 . "INSERT")(cons 2 bn)'(66 . 1)'(-4 . "AND>")
  13.                          '(0 . "LINE")'(-4 . "OR>")'(410 . "Model")
  14.                          )
  15.                    )
  16.         )
  17.   (progn
  18.          (setq s2 (vl-remove-if-not ''((x) (= "LINE" (cdr (assoc 0 (entget x))))) (acet-ss-to-list ss))); grid line
  19.          (repeat (setq i (sslength ss))
  20.            (and (setq bo  (vlax-ename->vla-object  (ssname ss (setq i (1- i)))))
  21.                 ;(= (vla-get-Name bo) bn )
  22.                 (setq isblk (= (vla-get-ObjectName bo) "AcDbBlockReference"))         
  23.                 (vlax-invoke bo 'scaleentity
  24.                   (setq
  25.                     ip ((lambda        (obj / a b)
  26.                           (vla-getboundingbox obj 'a 'b)
  27.                           (apply 'mapcar
  28.                                  (cons ''((a b) (/ (+ a b) 2.0)) (mapcar 'vlax-safearray->list (list a b)))
  29.                                  )
  30.                           )
  31.                          bo
  32.                          )
  33.                     )
  34.                   scl
  35.                   ) ;_ end of vlax-invoke
  36.            ) ;_ end of and
  37.            (foreach x s2
  38.              (setq lo (vlax-ename->vla-object x)
  39.                    dp (vl-sort (mapcar ''((x) (cons (distance ip (setq p (vlax-get lo x))) p)) '(StartPoint EndPoint))
  40.                                ''((a b) (< (car a) (car b)))
  41.                                )
  42.                    )
  43.              (if (and isblk
  44.                       (equal (angle (setq st (cdar dp)) ip)  (apply 'angle (reverse (mapcar 'cdr dp))) 0.1 )
  45.                       )
  46.                (vlax-invoke bo 'move st
  47.                  (polar st (angle st ip) (- (* scl (caar dp)) (caar dp)))
  48.                  )
  49.                )
  50.              )
  51.            )
  52.          ) ;_ end of progn
  53.   ) ;_ end of and
  54.     (princ)
  55.     ) ;_ end of defun

 
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-7-31 01:13 , Processed in 0.426886 second(s), 63 queries .

© 2020-2025 乐筑天下

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