
Discussion forum
|

Please abide by the rules of this forum.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
File LISP |
Post Reply ![]() |
Author | |
SAGGIAAAA ![]() Newbie ![]() Joined: 24.May.2023 Location: Italy Using: AutoCAD2024 Status: Offline Points: 2 |
![]() ![]() ![]() ![]() ![]() Posted: 24.May.2023 at 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. |
|
![]() |
|
Kent Cooper ![]() Senior Member ![]() Joined: 12.Mar.2013 Location: United States Using: AutoCAD2020, 2023 Status: Online Points: 592 |
![]() ![]() ![]() ![]() ![]() |
The Layer name has an s on the end, which may explain your problem [I did not analyze other things -- there may be more issues]. BUT DON'T USE THAT LAYER FOR THIS PURPOSE! It has a special purpose in AutoCAD, and is not for Users to involve themselves with. The use of it for things to not Plot dates back to the days [very long ago now] when that was the only Layer that didn't Plot. But for many years now you can designate any Layer to not Plot. So make a non-Plotting Layer for the purpose, and give it a name that has some meaning in relation to what it's for.
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
This page was generated in 0,063 seconds.