ASMI 发表于 2022-7-6 15:02:14

也许 吧:
 

(defun c:atrot(/ blSet attLst errCount oldAng)
(if(not atrot:rAng)(setq atrot:rAng 0))
(setq oldAng atrot:rAng
       atrot:rAng
(getangle
   (strcat "\nSpecify rotation angle <"(angtos atrot:rAng)">: ")))
(if(not atrot:rAng)(setq atrot:rAng oldAng))
(princ "<<< Select blocks to rotate attributes >>>")
(setq errCount 0)
(if
   (setq blSet(ssget '((0 . "INSERT")(66 . 1))))
   (progn
   (setq blSet(mapcar 'vlax-ename->vla-object
                   (vl-remove-if 'listp
                  (mapcar 'cadr(ssnamex blSet)))))
   (foreach itm blSet
(setq attLst
       (vlax-safearray->list
       (vlax-variant-value
           (vla-GetAttributes itm))))
(foreach att attLst
(if(vl-catch-all-error-p
           (vl-catch-all-apply
             'vla-put-Rotation(list att atrot:rAng)))
    (setq errCount(1+ ErrCount))
          ); end if
); end foreach
); end foreach
   ); end progn
   (princ ">>> Nothing selected! <<<")
   ); end if
(if(/= 0 errCount)
   (princ
   (strcat "\n>>> "
(itoa errCount)
      " attributes or blocks were on locked layer! <<< "))
      ); end if
(princ)
); end of c:atrot
---
编辑:哎呀,我迟到了。。。

JeepMaster 发表于 2022-7-6 15:05:27

嗨,阿斯米,我经常使用你的Lisp程序(下面),谢谢你的帮助,我很高兴!
 
我认为在我的情况下,它可以修改,这样可以节省更多的时间。可以这样修改吗
(我的意思是“你”能做到吗…?因为我不能…)
 
1.atrot命令后,acad提示属性的旋转角度。我想跳过这个问题,使用0(零)度。我从不使用其他价值观。我想这对你们来说并不难。
 
2、输入所需的度数后,建议选择块。然后对所有属性使用0度。这不应该发生:我想指定某个标记设置为零。由于我的各个区块都有相同的标签,它将完全满足我的需要。
 
我会在菜单中保留原来的lisp,因为它可能会在某个时候派上用场。

kpblc 发表于 2022-7-6 15:09:54

或者其他人。。?

MarcoW 发表于 2022-7-6 15:11:09

试一试:
 
(defunc:atrot()(#ff00ff](setqtmp(getstring(“\n指定要旋转的标记:“)(或(eqtmp(setqatrot:标记tmp(35;ff00ff]“>”(setqerrCount0(('(color(0 . “插入”(661蓝色]progn(setqblSet(mapcar'vlax ename->vla对象'('cadr(ssnamexblSet(setqattLst(vlax安全阵列->列表vlax变量值(itm)(foreachattLst(和(atrot:tag(vla get TagStringatt)atrot:tag(vla get TagStringatt b]vl-catch-all-error-p(vl catch-all apply'vla put Rotationatt b]0.0(setqerrCount()/color](princ“>>>未选择任何内容!”(itoaerrCount“属性或块位于锁定层!

MarcoW 发表于 2022-7-6 15:16:49

李:贾沃尔。。。我的意思是,是的,它工作得很好。
在“编辑”菜单中做了一些宏,我很高兴!!
 
这节省了我很多时间。。。
 
我的问题是,我有足够的想法,但我不能写vba或lisp,尽管我每天晚上阅读和尝试了所有。。
 
谢谢你帮我。

Lee Mac 发表于 2022-7-6 15:20:04

 
 
别担心。
 
我的问题是我对LISP程序没有足够的想法

MarcoW 发表于 2022-7-6 15:20:40

Lee Mac: jawohl ... I mean, yes it works very good.
Made a few macro's in the "edit" menu and I'm very happy !!
 
This saves me a lot of time...
 
My problem is that i have ideas enough but i can't write vba or lisp allthough i read and try allmost every evening..
 
Thank you for helping me out.

Lee Mac 发表于 2022-7-6 15:23:29

 
 
No worries.
 
My problem is that I don't have enough ideas for LISP programs, as I don't use CAD... I just do the coding

filliam 发表于 2022-7-6 15:29:02

Hi, thanks for this really great comand!!!
 
The angel 0 in this comand is relative to ucs world, even if my drawing uses a diffrent ucs... is it posible to change the angel to be relative to the current ucs instead?
 
(sorry for my bad english - i hope you understand me anyway...)

leos98 发表于 2022-7-6 15:29:59

Hello guys!
I have not been able to get this lisp to work and I really need it!
When I call the ATROT command, I get the propmt for the tag to be rotated. What am I suppose to type here? What "all" does? I have tryed typing the name of any of the attribute tags on the block I would like to rotate to zero but no luck. This is what I keep getting:
 
Command: ATROT
Specify Tag to be Rotated : S
>>
Select objects: 1 found
Select objects:
; error: no function definition: nil
 
Please Help!
 
页: 1 [2]
查看完整版本: 属性编辑旋转/移动Glo