SAGGIAAAA
24.05.2023, 10:25
Hello, I wrote a .lsp code to make my work easier, but unfortunately I'm unable to get it to work properly. Does anyone know how to resolve this? I'm attaching the code.(defun c:ComandName(/ sel ss blk obj) (defun ename->vla-object (ename) (if (not (vlax-dump-object ename)) (vlax-ename->vla-object ename) (vl-catch-all-error-p nil (vl-catch-all-apply 'vla-get-object (list (vlax-ename->vla-object ename)) ) ) ) ) (setq sel (ssget "_X" '((0 . "INSERT")))) (if sel (progn (setq blk (ename->vla-object (ssname sel 0))) (vla-put-layer blk "0") (vla-put-color blk (vla-get-property blk 'Color)) (vla-put-linetype blk (vla-get-property blk 'Linetype)) (setq sel (ssget "_X" '((0 . "TEXT")) (list (cons 2 (strcat "\\A" "\\*U"))))) (if sel (command "._CHPROP" sel "" "c" "" "Yellow" "") ) (setq sel (ssget "_X" '((0 . "TEXT")) (list (cons 2 "A")))) (if sel (command "._CHPROP" sel "" "la" "" "Defpoint" "") ) (setq sel (ssget "_X" '((0 . "POINT")))) (if sel (command "._CHPROP" sel "" "la" "" "Defpoint" "") ) (command "SCALE" "All" "" "0,0" "1:1" "mm" "" "No" "") (command "._EXPLODE" sel) ) ) (princ))The code must: open the selected block(s), move all objects to layer 0 with the color "DaBlocco," thickness "DaBlocco," and line type "DaBlocco." Then, select only the text/annotations within the block and set their color to yellow. If the text is an "A," it should be placed on the "Defpoint" layer. Additionally, select the points contained within the block and move them to the "Defpoint" layer. Finally, set the block's scale to "millimeters" and allow for exploding the block. As a final step, automatically close the block. All of this should be done without any action required from you except for activating the command after selecting the blocks to be edited. thanks to all who will help me.