tnvsb Posted October 5, 2018 Posted October 5, 2018 (edited) Dear all, I got a lisp code that can generate required no of rows and columns inside a two corners of a rectangle. But I need a change in that it should ask for selection for rectangle irrespective of the rectangle is in straight or in inclination position (PROMPT "\n THIS PROGRAM FOR DISTRIBUTION LAMP") (PROMPT "\n START COMMAND by : ----DIL---- ") (DEFUN C:IL () (SETVAR "CMDECHO" 0) (setq os (getvar "osmode")) (setvar "osmode" 0) (SETQ P1 (GETPOINT "\n ENTER FIRST POINT: ")) (SETQ P3 (GETPOINT "\n ENTER SECOND POINT: ")) (SETQ BB1 (cdr (assoc 2 (entget (car (entsel "\n Select Block")))))) (setq x1 (car p1)) (setq y1 (car (cdr p1))) (setq x3 (car p3)) (setq y3 (car (cdr p3))) (setq p2 (list x1 y3)) (setq p4 (list x3 y1)) (setq disx (distance p1 p4)) (setq disy (distance p1 p2)) (SETQ NX (GETINT "\n NUMBER OF X DIR.")) (SETQ XXN (/ disx (* NX 2))) (SETQ DS1 (* XXN 2)) (SETQ NY (GETINT "\n NUMBER OF Y DIR.")) (SETQ YYN (/ disy (* NY 2))) (SETQ DS2 (* YYN 2)) (setq xx1 (+ (car p1) XXN)) (setq yy1 (+ (car (cdr p1)) YYN)) (setq pp2 (list xx1 yy1)) (COMMAND "-layer" "m" "M-FIRE-SYMB-P" "c" "2" "" "") (COMMAND "INSERT" BB1 pp2 "" "" "") ;(COMMAND "ARRAY" "L" "" "R" NY NX DS2 DS1) (if (eq NX 1) (COMMAND "ARRAY" "L" "" "R" NY NX DS2)) (if (eq NY 1) (COMMAND "ARRAY" "L" "" "R" NY NX DS1)) (if (AND (/= NX 1) (/= NY 1))(COMMAND "ARRAY" "L" "" "R" NY NX DS2 DS1)) (setvar "osmode" os) (PRIN1) (PRIN1) (PROMPT "\n") (PROMPT "\n CREATED by :") (PROMPT "\n ********* M.SAIED. ********* ") (PRINC) );DEFUN Selection of a rectangle instead of asking for two corners.dwg Edited October 5, 2018 by tnvsb Quote
BIGAL Posted October 7, 2018 Posted October 7, 2018 Maybe a simple answer try using UCS this will set the angle then run the lisp. Quote
danglar Posted October 10, 2018 Posted October 10, 2018 You can try to draw rectangle not in straight or in inclination position (Lee Mak solution) and then to distribute lighting poles according to your routine (see attachment) Draw a rectangle at any angle.lsp Quote
ronjonp Posted October 10, 2018 Posted October 10, 2018 6 hours ago, danglar said: You can try to draw rectangle not in straight or in inclination position (Lee Mak solution) and then to distribute lighting poles according to your routine (see attachment) Draw a rectangle at any angle.lsp Pretty sure this is not my code... ;_____________________credit: ronjonp______________________ (defun ASvector (pt: color / L L- c1 c2 *1 *2 *3 *4 *5 *6 *7 *8 *9 *10 *11 *12) ..... 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.