NH3man! Posted May 18, 2009 Author Share Posted May 18, 2009 I can't for some reason get it to move the block now in any other direction but +x now. It gives me the prompt for all four but no matter which one I pick it move +X. Quote Link to comment Share on other sites More sharing options...
NH3man! Posted May 18, 2009 Author Share Posted May 18, 2009 I take that back. It will move in the +Y also. But not the -Y and -X. Could this be a one of toughs syntacs things you were talking about. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 18, 2009 Share Posted May 18, 2009 It all seems to work for me I have added an UNDO to this one: (defun c:hc (/ *error* vlst ovar cBlk tmp1 tmp2 tmp3 tmp4 blkpt) ; Error Handler (defun *error* (msg) (if ovar (mapcar 'setvar vlst ovar)) ; Return System Variables (if (not (member msg '("Function cancelled" "quit / exit abort"))) (princ (strcat "\n<< Error: " msg " >>"))) ; Print Error Message (princ)) ; Collect and Set System Variables (setq vlst '("CMDECHO" "OSMODE") ovar (mapcar 'getvar vlst)) (mapcar 'setvar vlst '(0 0)) ; Set Defaults (or hc$slp:def (setq hc$slp:def 1)) (or hc$cop:def (setq hc$cop:def 1)) (or hc$spc:def (setq hc$spc:def 1)) (or hc$dir:def (setq hc$dir:def "X")) ; Get Block to Copy (if (and (setq cBlk (car (entsel "\nSelect Block: "))) (eq "INSERT" (cdr (assoc 0 (entget cBlk))))) (progn ; Get User Input (initget 6) (setq tmp1 (getreal (strcat "\nSpecify Slope <" (rtos hc$slp:def) "> : "))) (or (not tmp1) (setq hc$slp:def tmp1)) (initget 6) (setq tmp2 (getint (strcat "\nSpecify Number of Copies <" (itoa hc$cop:def) "> : "))) (or (not tmp2) (setq hc$cop:def tmp2)) (initget 6) (setq tmp3 (getreal (strcat "\nSpecify Spacing <" (rtos hc$spc:def) "> : "))) (or (not tmp3) (setq hc$spc:def tmp3)) (initget "X Y -x -y") (setq tmp4 (getkword (strcat "\nSpecify Axis [X/Y/-X/-Y] <" hc$dir:def "> : "))) (or (not tmp4) (setq hc$dir:def tmp4)) ; Get Block Insertion Point Information and Initiate Counter (setq blkpt (cdr (assoc 10 (entget cBlk))) i 1) ; Copy the Block a Number of Times (command "_undo" "_Begin") (repeat hc$cop:def (command "_copy" cBlk "" blkpt) (cond ((eq "X" hc$dir:def) (command (list (+ (* i hc$spc:def) (car blkpt)) (cadr blkpt) (+ (* i (/ hc$spc:def 12.) hc$slp:def) (caddr blkpt))))) ((eq "Y" hc$dir:def) (command (list (car blkpt) (+ (* i hc$spc:def) (cadr blkpt)) (+ (* i (/ hc$spc:def 12.) hc$slp:def) (caddr blkpt))))) ((eq "-x" hc$dir:def) (command (list (+ (* -1. i hc$spc:def) (car blkpt)) (cadr blkpt) (+ (* i (/ hc$spc:def 12.) hc$slp:def) (caddr blkpt))))) ((eq "-y" hc$dir:def) (command (list (car blkpt) (+ (* -1. i hc$spc:def) (cadr blkpt)) (+ (* i (/ hc$spc:def 12.) hc$slp:def) (caddr blkpt))))) ) ; end cond (command) (setq i (1+ i))) (command "_undo" "_End")) ; Else No Block was Selected (princ "\n<!> No Block Selected <!>")) ; Return Sys Vars Back (mapcar 'setvar vlst ovar) ; Exit Cleanly (princ)) Try reloading the code, and make sure you have this version loaded Quote Link to comment Share on other sites More sharing options...
NH3man! Posted May 18, 2009 Author Share Posted May 18, 2009 Here is what I found. As long as I type in the new direction on the command line it will move in that direction. But in I click in the prompt box it just takes the last function and uses it. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 18, 2009 Share Posted May 18, 2009 Here is what I found. As long as I type in the new direction on the command line it will move in that direction. But in I click in the prompt box it just takes the last function and uses it. Not sure about that - in '04 you can't click in the prompt box... Quote Link to comment Share on other sites More sharing options...
NH3man! Posted May 18, 2009 Author Share Posted May 18, 2009 I can't at work either I disabled it. This laptop they gave me I hardly ever use so didn't really set the configuration as I like it. Thanks again Lee. PS I was up till 2 in the morning reading about all though lsp terms. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 18, 2009 Share Posted May 18, 2009 PS I was up till 2 in the morning reading about all though lsp terms. Nice one - if you need any clarification on anything, just ask Quote Link to comment Share on other sites More sharing options...
David Bethel Posted May 18, 2009 Share Posted May 18, 2009 Have you tried 3DARRAY.LSP that come with acad? -David Quote Link to comment Share on other sites More sharing options...
NH3man! Posted May 19, 2009 Author Share Posted May 19, 2009 Will look into it. Didn't know it could go in one direction and elevate up or down. Thanks David. Quote Link to comment Share on other sites More sharing options...
NH3man! Posted May 19, 2009 Author Share Posted May 19, 2009 (setq tmp4 (getkword (strcat "\nSpecify Axis [sZ] : "))) (or (not tmp4) (setq hc$dir:def tmp4)) I ran into a problem sort of. I have found that I am not always moveing just the x or y direction. So I tried to edit the axis part of the prompt with an Alias I have for snap angle. I have tried to put in the regular command and my alias but can't seem to get it to work. What else am I missing to get this to go to the angle I have my snap and curser set at. Quote Link to comment Share on other sites More sharing options...
NH3man! Posted May 20, 2009 Author Share Posted May 20, 2009 (list (+ (* i hc$spc:def) (car blkpt)) (cadr blkpt) (+ (* i (/ hc$spc:def 12.) hc$slp:def) (caddr blkpt))))) Lee in this part of your code, I can't seem to figure out what the * and i are doing. I almost understand the rest. I am thinking it has something the starting point of the last block copied but at this point I am guessing. Quote Link to comment Share on other sites More sharing options...
NH3man! Posted May 20, 2009 Author Share Posted May 20, 2009 Oh one more thing. Why won't the (rtos) accept a negetive numbuer> i.e. -.125 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 20, 2009 Share Posted May 20, 2009 (list (+ (* i hc$spc:def) (car blkpt)) (cadr blkpt) (+ (* i (/ hc$spc:def 12.) hc$slp:def) (caddr blkpt))))) Lee in this part of your code, I can't seem to figure out what the * and i are doing. I almost understand the rest. I am thinking it has something the starting point of the last block copied but at this point I am guessing. The i is incremented by 1 on every repeat, hence the block spacing is multiplied by this increment. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 20, 2009 Share Posted May 20, 2009 Oh one more thing. Why won't the (rtos) accept a negetive numbuer> i.e. -.125 -.125 is not a real number - you need to specify -0.125 Quote Link to comment Share on other sites More sharing options...
NH3man! Posted May 20, 2009 Author Share Posted May 20, 2009 Thanks Lee, I get it now!!!! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 20, 2009 Share Posted May 20, 2009 No probs Quote Link to comment Share on other sites More sharing options...
NH3man! Posted May 21, 2009 Author Share Posted May 21, 2009 I have used this today and it works like a champ. Lee if there is anything I can do for you I am willing. Not only for your hard work but for your teaching ability. You have mad me look into ACAD like I just started. I thank you for that. Thank you, NH3man! Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 21, 2009 Share Posted May 21, 2009 I have used this today and it works like a champ. Lee if there is anything I can do for you I am willing. Not only for your hard work but for your teaching ability. You have mad me look into ACAD like I just started. I thank you for that. Thank you, NH3man! Thanks NH3man!, Your thanks is sufficient repayment - I'd be more than happy to answer any other questions regarding this, or any other code I have posted on this site - as it helps me learn more about it by teaching someone else Thanks Lee Quote Link to comment Share on other sites More sharing options...
NH3man! Posted May 21, 2009 Author Share Posted May 21, 2009 -.125 is not a real number - you need to specify -0.125 I tried entering it in like that and it say it has to be a non-negative number. It is not a big deal I always now which way the blocks need to slope. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 21, 2009 Share Posted May 21, 2009 that is to do with the "initget" argument that I included to disallow negatives. Change the correct (initget 6) to an (initget 2) to get around this. 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.