明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: 李青松

[提问] 请问e派工具箱的xy方向缩放工具的源程序是什么 ?要他的那种效果

[复制链接]
发表于 2014-7-31 07:19 | 显示全部楼层
  1. ;x,y方向不同比例缩放
  2. ; ***  XSCALE   [Version 1.0] 6/22/2005  ***
  3. ;
  4. ;Copyleft Gu Wenwei
  5. ;
  6. ; ***************************************
  7. ; ****  Author:  Apooollo            ****
  8. ; ****                               ****
  9. ; ****  Wuxi Jiangsu China           ****
  10. ; ***************************************
  11. ;
  12. ;
  13. ; This program takes selected objects, defines an anonymous block,
  14. ; then inserts the block at the original location, Scale by X,Y


  15. (defun C:XSCALE(/ bp ss xscal yscal entL)

  16.   (defun errexit (s)
  17.     (princ "\nError:  ")
  18.     (princ s)
  19.     (restore)
  20.   )

  21.   (defun restore ()
  22.     (setvar "CMDECHO" (car oldvar))
  23.     (setq *error* olderr)
  24.     (princ)
  25.   )
  26.   
  27. (defun MAKEUNBLOCK (ss ip / tmp errexit mbx BLAYER)

  28.   (setq T (not nil))
  29.   (setq olderr  *error*
  30.         *error* errexit
  31.   )
  32.   (setq oldvar
  33.     (list
  34.       (getvar "CMDECHO")
  35.     )
  36.   )
  37.   (setvar "CMDECHO" 0)
  38.   (terpri)
  39.   (if BLAYER  
  40.     (command "._LAYER"
  41.       (if (tblsearch "LAYER" BLAYER) "_S" "_M")
  42.       BLAYER
  43.       ""
  44.     )
  45.   )
  46.   (if (and ip ss)
  47.     (progn
  48.       (entmake (list
  49.         (cons '0 "BLOCK")
  50.         (cons '2 "*U")
  51.         (cons '70 1)
  52.         (cons '10 ip)
  53.       ))
  54.       (setq cnt (sslength ss))
  55.       (while (>= (setq cnt (1- cnt)) 0)
  56.         (setq tmp (ssname ss cnt))
  57.         (entmake (setq el (entget tmp)))
  58.         (if (> (cdr (assoc 66 el)) 0)
  59.           (while
  60.             (/= "SEQEND"
  61.               (cdr
  62.                 (assoc 0
  63.                   (entmake (setq el (entget (entnext (cdr (assoc -1 el))))))
  64.                 )
  65.               )
  66.             )
  67.           )
  68.         )
  69.         (entdel tmp)
  70.       )
  71.       (setq tmp (entmake (list (cons '0 "ENDBLK"))))
  72.       (entmake (list
  73.         (cons '0 "INSERT")
  74.         (cons '2 tmp)
  75.         (cons '10 ip)
  76.       ))
  77.     )
  78.   )  
  79.   (restore)
  80. )

  81.   (setq ss (ssget))    ;;; 选择缩放实体
  82.   (if ss
  83.     (progn
  84.       (setvar "cmdecho" 0)
  85.       (setq bp (getpoint "缩放基准点 (<0,0,0>): "))
  86.       (if (not bp) (setq bp (list 0 0 0)))
  87.       (setq xscal (getreal "X向比例因子 <1>: "))
  88.       (if (not xscal) (setq xscal 1))
  89.       (setq yscal (getreal "Y向比例因子 <1>: "))
  90.       (if (not yscal) (setq yscal 1))
  91.       (MAKEUNBLOCK ss bp)
  92.       (setq entL (entget (entLast))
  93.           entL (subst (cons 41 xscal) (assoc 41 entL) entL)
  94.           entL (subst (cons 42 yscal) (assoc 42 entL) entL)
  95.       )
  96.       (entmod entL)
  97.       (command "_explode" "l" "")
  98.     )
  99.   )
  100.   (princ "X,Y不同比例缩放, 命令:XSCALE")
  101. )
发表于 2020-9-11 11:49 | 显示全部楼层
支持支持,谢谢楼主的话题,谢谢各位大神的讨论
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-24 21:31 , Processed in 0.395882 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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