阅读下一篇
一个框选快速建块并指定层名作为块名同时置入该层的lisp源码;EECC快速建块并指定层名作为块名同时置入该层(DEFUN C:EECC (/ SS2024 PT1 NN OLDOS) (SETVAR "cmdecho" 0) (if (setq SS2024 (SSGET)) (PROGN (setq OLDOS (GETVAR "osmode")) (SETVAR "osmode" 0) (setq PT1 (CAR (YY-GET-BOUNDINGBOX2023 SS2024))) (SETQ NN(cdr (assoc 8 (entget (car (entsel))))));获取图元层名指定层名作为块名同时置入该层 (command "undo") (command "be") (command "-block") (command NN) (command PT1) (command SS2024) (command "") (command "insert") (command NN) (command PT1) (command "1") (command "1") (command "0") (command "undo") (command "e") (SETVAR "osmode" OLDOS) ) ) ;(Cc_dxfamend (entlast) 8 NN) ;Cc_dxfamend→图层(程序运行时的最后一个图元) ;(command (entlast) "layer" NN "") (command "_chprop" (entlast) "" "layer" NN "") ;改变最后一个图元图层 (SETVAR "cmdecho" 1) (PRINC));YY-GET-BOUNDINGBOX2023最大包围盒(DEFUN YY-GET-BOUNDINGBOX2023 (SS / I ENT OBJ PTA PTB DWCORN UPCORN PTLIST X Y) (setq I 0) (setq DWCORN nil) (setq UPCORN nil) (REPEAT (SSLENGTH SS) (setq ENT (SSNAME SS I)) (setq OBJ (vlax-ename->vla-object ENT)) (vla-GetBoundingBox OBJ 39;PTA 39;PTB) (setq DWCORN (CONS (vlax-safearray->list PTA) DWCORN)) (setq UPCORN (CONS (vlax-safearray->list PTB) UPCORN)) (setq I (1+ I)) ) (setq PTLIST (APPEND DWCORN UPCORN)) (setq X (MAPCAR 39;CAR PTLIST)) (setq Y (MAPCAR 39;CADR PTLIST)) (LIST (LIST (APPLY 39;MIN X) (APPLY 39;MIN Y)) (LIST (APPLY 39;MAX X) (APPLY 39;MAX Y)) ))
回帖成功
经验值 +10
全部回复(0 )
只看楼主 我来说两句抢沙发