Astro 发表于 2022-7-6 12:28:54

旋转、移动属性lisp

大家好,
希望有人能帮我解决这个Lisp程序的问题。
 
我想再选择一个或多个区块。然后,lisp扫描块以获取列表属性,TAG1“TAG2”TAG3。
如果旋转角度不是0,它会将其旋转到0,然后给我移动属性的选项。
 
 

(defun c:ROTATEMOVEATTRIBUTE1 (/ tag ss sel)
(vl-load-com)
(setq tag '("TAG1" "TAG2" "TAG3"));; <<-- Tag to be Searched
(and (setq ss (ssget '((0 . "INSERT") (66 . 1))))
      (vlax-for Obj (setq sel (vla-get-ActiveSelectionSet
                              (vla-get-ActiveDocument (vlax-get-acad-object))))
         (foreach att (append (vlax-invoke Obj 'GetAttributes)
                              (vlax-invoke Obj 'GetConstantAttributes))
         (if (vl-position (strcase (vla-get-TagString att)) tag)
             (vla-put-Rotation attVar 0
               (cond ((eq :vlax-true (vla-put-Rotation attVar 90)) :vlax-false)
                     (:vlax-true))))))
      (vla-delete sel))
(princ))

 
 
sombody现在可以用move命令帮助我吗。
我需要选择在旋转后移动属性。

Lee Mac 发表于 2022-7-6 12:48:09

对不起,我的错:
 
(定义c:ROTATEMOVEATTRIBUTE1(/tag ss sel)(vl load com)(setq tag'(“TAG1”“TAG2”“TAG3”));;

Astro 发表于 2022-7-6 13:13:26

Astro 发表于 2022-7-6 13:17:43

i think i got it
 

(defun c:ROTATEMOVEATTRIBUTE1( / ss obj) (vl-load-com) (setq tag '("TAG1" "TAG2" "TAG3"))(and (setq ss (ssget '((0 . "INSERT") (66 . 1))))      (vlax-for obj (setq ss (vla-get-activeselectionset    (vla-get-activedocument (vlax-get-acad-object))))   (if (= (vla-get-HasAttributes obj) :vlax-true)   (foreach attVar (vlax-invoke obj 'GetAttributes)       (if (not (= (vla-get-TagString attVar) tag))         (vla-put-Rotation attVar 0)))))   (vla-delete ss)) (princ))
 
 
can sombody help me now with the move command.
I need to have the option to move the attributes after the rotation.

Lee Mac 发表于 2022-7-6 13:33:35

Sorry my bad:
 

(defun c:ROTATEMOVEATTRIBUTE1 (/ tag ss sel) (vl-load-com) (setq tag '("TAG1" "TAG2" "TAG3"));;
页: [1]
查看完整版本: 旋转、移动属性lisp