LITOKARDO_BC Posted August 9, 2019 Share Posted August 9, 2019 Good day, I need help please. I got this autolisp, but it only works for a single block. I don't have the knowledge to adapt it and select multiple blocks. thank you very much for your attention. ; Flip block example - with (grread) (defun C:fb1 ( / e enx g s k itm ) (and (setq e (car (entsel "\nPick a block to flip: "))) (member '(0 . "INSERT") (setq enx (entget e))) (princ "\nPress [X/Y/Z] to flip the block <exit>: ") (while (not s) (setq g (grread)) (cond ( (or (eq g '(2 13)) (= 25 (car g))) (setq s T) ) ( (= 2 (car g)) (and (setq k (cadr (assoc (strcase (chr (cadr g))) '(("X" 41)("Y" 42)("Z" 43))))) (setq itm (assoc k enx)) (entmod (setq enx (subst (cons k (- (cdr itm))) itm enx))) ) ) ); cond ); while ); and (princ) ); defun C:test Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 10, 2019 Share Posted August 10, 2019 If your happy to pick pick then change the entsel by adding a while. Not sure but nothing happened when I ran the code, picked block xyz message came up and nothing after that. (while (setq e (car (entsel "\nPick a block to flip: "))) Quote Link to comment Share on other sites More sharing options...
Emmanuel Delay Posted August 12, 2019 Share Posted August 12, 2019 (edited) I isolated the user input (selecting multiple blocks, then typing X,Y or Z) from the rest of the function. I removed the while loop. You can always run the function twice or three times if you wish. X,Y or Z is for all the selected blocks now ; Flip block example - with (grread) (defun fb1 (e g / enx s k itm ) (and (setq enx (entget e)) (cond ( (or (eq g '(2 13)) (= 25 (car g))) (setq s T) ) ( (= 2 (car g)) (and (setq k (cadr (assoc (strcase (chr (cadr g))) '(("X" 41)("Y" 42)("Z" 43))))) (setq itm (assoc k enx)) (entmod (setq enx (subst (cons k (- (cdr itm))) itm enx))) ) ) ); cond ); and ) (defun C:fb1 ( / e i ss g) (princ "\nSelect blocks to flip: ") (setq ss (ssget (list (cons 0 "INSERT") ))) (princ "\nPress [X/Y/Z] to flip the block <exit>: ") (setq g (grread)) (setq i 0) (repeat (sslength ss) (setq e (ssname ss i)) (fb1 e g) (setq i (+ i 1)) ) (princ) ) Edited August 12, 2019 by Emmanuel Delay Quote Link to comment Share on other sites More sharing options...
Grrr Posted August 13, 2019 Share Posted August 13, 2019 source Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.