con Posted November 27, 2017 Share Posted November 27, 2017 Hi Thanks in advance for reading and trying to help. I'ld like to make a lisp (autocad) to insert 4 blocks using the following method. https://image.ibb.co/iynhk6/LISP_OR_DYNBLOCK.png Blue dots are points I will select. Red dots are the blocks insert point. It doesn't have to be a working lisp, just some usefull lisp-codes would be nice too. Thanks again! Quote Link to comment Share on other sites More sharing options...
Aftertouch Posted November 27, 2017 Share Posted November 27, 2017 I dont have the time to help you with a full code, But at first glace this looks like a combination of (getpoint) (command "_insert" "blockname" "S" "1" "" "" "") where the XY could be manipulated with: (setq test (getpoint)) (setq newtest (mapcar '+ test (list 1.000 1.000 0.000) ;change x y z by given mapcar values. and use newtest as insertionpoint for the block Quote Link to comment Share on other sites More sharing options...
David Bethel Posted November 27, 2017 Share Posted November 27, 2017 Have you looked into MINSERTs? -David Quote Link to comment Share on other sites More sharing options...
con Posted November 29, 2017 Author Share Posted November 29, 2017 I've looked into Minsert, but the blocks need be exploded for blockcount. Also It allows for only one block to be inserted. Thanks for the responces so far! I'm trying to write something myself but i'm a novice Quote Link to comment Share on other sites More sharing options...
Aftertouch Posted November 29, 2017 Share Posted November 29, 2017 To get you started: (defun C:CADTUTOR ( / ) (initget (+ 1)) (setq inspt (getpoint "\nSelect insertionpoint for first block: ")) (initget (+ 1 2 4)) (setq offpt (+ 0.12 (getreal "\nOffset distance for secondblock: "))) (if (and (/= inspt nil) (/= offpt nil)) (progn (command "-INSERT" "BlockA" "S" "1" (mapcar '+ inspt (list 0.000 0.000 0.000)) "0") (command "-INSERT" "BlockA" "S" "1" (mapcar '+ inspt (list 0.000 offpt 0.000)) "0") (command "-INSERT" "BlockB" "S" "1" (mapcar '+ inspt (list 0.025 (/ (- offpt 0.12) 2) 0.000)) "0") (command "-INSERT" "BlockB" "S" "1" (mapcar '+ inspt (list [color="red"]0.975[/color] (/ (- offpt 0.12) 2) 0.000)) "0") ) (progn (princ "Missing variables...") ) ) (princ) ) The part in RED is 1m -0.025 cm... Assuming your block is 1m long and 12 cm wide? 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.