大家好
我有这个Lisp程序的程序
- (vl-load-com)
- (defun c:COMBINELAYERS(/ doc blocks blk eo layers lay)
- ;CHANGE BY LAYER COLOR TO OVERRIDE COLOR
- ;; Get the ActiveX object of the current dwg
- (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))
- blocks (vla-get-Blocks doc) ;Get the blocks collection
- layers (vla-get-Layers doc) ;Get the layers collection
- ) ;_ end of setq
- ;; Step through all blocks (including Model Space & Layouts)
- (vlax-for blk blocks
- ;; Step through all contained entities in block
- (vlax-for eo blk
- ;; Get the layer the entity is placed on
- (setq lay (vla-Item layers (vla-get-Layer eo)))
- (vla-put-Layer eo (getvar "CLAYER")) ;Change the entity to the current layer
- (if (= (vla-get-Color eo) 256)
- ;;If its colour bylayer, change it to overridden color to match
- (vla-put-Color eo (vla-get-color lay))
- ) ;_ end of if
- (if (= (strcase (vla-get-Linetype eo)) "BYLAYER")
- ;;If its linetype bylayer, change it to overridden linetype to match
- (vla-put-Linetype eo (vla-get-Linetype lay))
- ) ;_ end of if
- (if (= (vla-get-Lineweight eo) -1)
- ;;If its lineweight bylayer, change it to overridden lineweigth to match
- (vla-put-Lineweight eo (vla-get-Lineweight lay))
- ) ;_ end of if
- ) ;_ end of vlax-for
- ) ;_ end of vlax-for
- (princ)
- ) ;_ end of defun
将所有对象(包括块子图元)移动到第0层或当前层。。并将所有bylayer颜色的对象更改为不考虑颜色
但我申请了所有的图纸,没有选择
我希望lisp要求用户选择要应用到的对象。。。提前感谢 |