明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1908|回复: 9

[源码] 批量旋转对象

[复制链接]
发表于 2015-11-20 09:39 | 显示全部楼层 |阅读模式
本帖最后由 sz721 于 2016-1-18 08:18 编辑

使所有选定的对象(多行文字,单行文字,引线标示和图块)匹配当前UCS。


下载地址看5楼。

点评

代码已经发在8楼  发表于 2016-1-17 19:17
http://bbs.mjtd.com/forum.php?mod=redirect&goto=findpost&ptid=170222&pid=762237&fromuid=7303840  发表于 2016-1-17 19:16
Copyright?03.09.09 Alan J. Thompson (alanjt) ZeroRotation.lsp v1.2  发表于 2015-11-21 08:15
原作者是alanjt , 你为什么删除作者的注释信息? 极其鄙视这种行为!!!  发表于 2015-11-21 08:09

评分

参与人数 2明经币 -2 金钱 -24 收起 理由
Gu_xl -3 -24 转发源码时请尊重原作者版权!
USER2128 + 1 赞一个!

查看全部评分

"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2015-11-20 11:49 | 显示全部楼层
看起来不错哦!
发表于 2015-11-20 11:55 | 显示全部楼层
长老批量发源码啊,赞!
发表于 2015-11-20 21:19 | 显示全部楼层
好像不能运行
发表于 2015-11-21 20:48 | 显示全部楼层
转发别人的源码时,请保留版权信息!
源码来源:http://www.cadtutor.net/forum/sh ... of-objects-to-zero-(based-on-current-UCS)
发表于 2016-1-17 00:57 | 显示全部楼层
这个  尊重别人劳动成果很重要
发表于 2016-1-17 19:09 | 显示全部楼层
谁可以上传一下吗?五楼地址注册了还是不能下载啊
发表于 2016-1-17 19:14 | 显示全部楼层
tumu2008323 发表于 2016-1-17 19:09
谁可以上传一下吗?五楼地址注册了还是不能下载啊

  1. ;;; ------------------------------------------------------------------------
  2. ;;;  ZeroRotation.lsp v1.2
  3. ;;;
  4. ;;;  Copyright?03.09.09
  5. ;;;  Alan J. Thompson (alanjt)
  6. ;;;
  7. ;;;  Contact: alanjt @ TheSwamp
  8. ;;;  Permission to use, copy, modify, and distribute this software
  9. ;;;  for any purpose and without fee is hereby granted, provided
  10. ;;;  that the above copyright notice appears in all copies and
  11. ;;;  that both that copyright notice and the limited warranty and
  12. ;;;  restricted rights notice below appear in all supporting
  13. ;;;  documentation.
  14. ;;;
  15. ;;;  The following program(s) are provided "as is" and with all faults.
  16. ;;;  Alan J. Thompson DOES NOT warrant that the operation of the program(s)
  17. ;;;  will be uninterrupted and/or error free.
  18. ;;;
  19. ;;;  Set objects (Multileaders, Text, Mtext, Blocks) with a
  20. ;;;  rotation of 0 (relative to current UCS).
  21. ;;;
  22. ;;;  Revision History:
  23. ;;;
  24. ;;;  v1.1 (10.23.09) 1. Minor rewrite for speed optimization.
  25. ;;;     v1.2 (05.31.11) 1. Complete rewrite.
  26. ;;;
  27. ;;; ------------------------------------------------------------------------

  28. (defun c:TE () (c:ZeroRotation))
  29. (defun c:ZeroRotation (/ *error* AT:UCSAngle ang ss name)

  30. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  31. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SUBROUTINES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  32. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


  33.   (defun *error* (msg)
  34.     (and *AcadDoc* (vla-endundomark *AcadDoc*))
  35.     (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,")))
  36.       (princ (strcat "\nError: " msg))
  37.     )
  38.   )


  39.   (defun AT:UCSAngle (/)
  40.     ;; Return current UCS angle
  41.     ;; Alan J. Thompson, 04.06.10
  42.     ((lambda (x) (atan (cadr x) (car x))) (trans (getvar 'UCSXDIR) 0 (trans '(0. 0. 1.) 1 0 T) T))
  43.   )


  44. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  45. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MAIN ROUTINE ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  46. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  47.   (vl-load-com)

  48.   (vla-startundomark
  49.     (cond (*AcadDoc*)
  50.           ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
  51.     )
  52.   )

  53.   (if (ssget "_:L" '((0 . "INSERT,MTEXT,MULTILEADER,TEXT")))
  54.     (progn
  55.       (setq ang (AT:UCSAngle))
  56.       (vlax-for x (setq ss (vla-get-activeselectionset *AcadDoc*))
  57.         (cond ((vl-position (setq name (vla-get-objectname x)) '("AcDbBlockReference" "AcDbText"))
  58.                (vla-put-rotation x ang)
  59.               )
  60.               ((eq name "AcDbMText") (vla-put-rotation x 0.))
  61.               ((and (eq name "AcDbMLeader") (eq (vla-get-contenttype x) 2))
  62.                (vla-put-textrotation x 0.)
  63.               )
  64.         )
  65.       )
  66.       (vla-delete ss)
  67.     )
  68.   )
  69.   (*error* nil)
  70.   (princ)
  71. )

发表于 2016-1-17 19:18 | 显示全部楼层
lucas_3333 发表于 2016-1-17 19:14

多谢
发表于 2023-8-28 21:52 | 显示全部楼层
输入TE,没反应,这是为什么,2020CAD上测试的。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-11 11:28 , Processed in 0.152961 second(s), 29 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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