AdamW Posted May 2, 2018 Posted May 2, 2018 Can Some one help. I generally have several snap points set at all times. Regularly when copying I set snap point to either end point or mid point, copy and then reset snap points to my previous snaps. Ive written this lisp but..... It sets the snap point copies the object to the first location ok but after the first instance of the copy the snap point reverts to all snap points and not to either mid or end point. (defun C:Copy-Point (/ copy_objects osm cm Choice) (setq copy_objects (ssget)) (setq osm (getvar 'osmode) cm (getvar 'copymode)) (setvar "copymode" 1) (initget 1 "Midpoint Endpoint") (setq Choice (getkword "\nWhich Point [Midpoint/Endpoint]: ")) (cond ((= Choice "Midpoint")(command "osmode" 2 )) ((= Choice "Endpoint")(command "osmode" 1 )) ) (command "copy" copy_objects "" "m" pause pause) (setvar 'osmode osm) (setvar 'copymode cm) (princ) ) Quote
BIGAL Posted May 3, 2018 Posted May 3, 2018 Not sure why you would not just use osmode 3 for 99% of our work the two snaps are far enough apart to not pick the wrong 1. Quote
AdamW Posted May 3, 2018 Author Posted May 3, 2018 HI Bigal. The Snaps don't seem to be far enough apart. I'm drawing a roof timber 35mm wide so only 17.5mm between snaps end and mid. the timbers are 600mm apart and can span 12m so when zoomed out its hard to pick the correct snap hence the reason to switch just one snap point in this instance. Quote
BIGAL Posted May 3, 2018 Posted May 3, 2018 You are right will have a think about a better way. Have you though about transparent commands a post here a couple of days a go. A different approach. eg of use no big code but defuns must be loaded. copy select objects '1 pick left or right end pick next point but you can use '1 '2 '3 '4 its up to you. (defun c:1 ( ) (command "end")) (defun c:2 ( ) (command "mid")) (defun c:3 ( ) (command "perp")) (defun c:4 ( ) (command "centre")) ;circle Quote
hanhphuc Posted May 3, 2018 Posted May 3, 2018 i think BIGAL is offline? it's painful 500 internal server error !! my idea is to restore osmode in *error* but the COPY command has its own error handle, if is pressed still can't debug. so after copy objects, try command:Q to restore osmode (eval (list 'defun-q 'C:Q 'nil '(ai_sysvar nil))) (defun C:CPP (/ copy_objects Choice) (if (setq copy_objects (ssget)) (progn (initget 1 "Midpoint Endpoint") (setq Choice (getkword "\nWhich Point [Midpoint/Endpoint]: ")) (ai_sysvar (list '("cmdecho" . 0) (cons "osmode" (if (= Choice "Midpoint") 2 1 ) ) ) ) (command "copy" copy_objects "" "m" "\\""\\") ) ) (princ) ) Quote
BIGAL Posted May 4, 2018 Posted May 4, 2018 I just tried to cut out the iniget step by using transparent commands, you could have as many as you like, if you really want to get carried away think about this press the END key for osnap end, say Home for mid, but screws your keyboard. Page up centre ? page down ??? Quote
Roy_043 Posted May 4, 2018 Posted May 4, 2018 @AdamW: Try using: ... (command "_.copy" copy_objects "" "_multiple") (while (/= 0 (getvar 'cmdactive)) (command pause)) (setvar 'osmode osm) ... Quote
hanhphuc Posted May 6, 2018 Posted May 6, 2018 @AdamW:Try using: ... (command "_.copy" copy_objects "" "_multiple") (while (/= 0 (getvar 'cmdactive)) ([color="red"]command pause[/color])) (setvar 'osmode osm) ... yeah that (command pause) played a trick good tips for 'commanders' i tried different approach because failed at this (while (/= 0 (getvar 'cmdactive)) ([color="red"]command[/color])) 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.