Bill Tillman Posted July 2, 2017 Posted July 2, 2017 I'm using a simple code to insert a block, it uses ENTMAKE. This is my preferred method to using COMMAND... and it's much faster. In some instances when the block is inserted I need to mirror it about it's insert point and erase the old copy. The code I came up with works fine but it uses the command method and it's noticeably slower. Only by a second or two but it is noticeable. So trying to expand my skill set I was wondering if there is a better method for handling this task. (command-s "._MIRROR" (entlast) "" pt "Y") Quote
FranknBeans Posted July 2, 2017 Posted July 2, 2017 Hi, you could set the x or y scale to negative with entmod.. (setq e (entget (entlast))) (setq e (subst (cons 41 (- (cdr (assoc 41 e))))(assoc 41 e) e)) ; 42 for y axis (entmod e) 1 Quote
Grrr Posted July 2, 2017 Posted July 2, 2017 Elaborating FranknBeans's suggestion - consider this example, by combining with my favourite grread function: ; Flip block example - with (grread) (defun C:test ( / 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
Bill Tillman Posted July 3, 2017 Author Posted July 3, 2017 Once again this forum is filled with the greatest people. Thanks for the help. I put FrankNBeans example to work earlier and it's working great. Quote
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.