Michaels Posted August 11, 2010 Posted August 11, 2010 Suppose that I have a room and I want to divide it into specific points. My codes are running well up to the crossing points. I mean How can I support the X and Y for the divided points at X and Y as well ? (defun c:cen (/ pt1 pt3 pt2 pt4 XLen YLen Xnum Ynum) (setq pt1 (getpoint"\n Specify The Left corner: ") pt3 (getcorner pt1 "\n Specify the Right corner: ") ) ;; ******** the rest of rectangl points **************** (setq pt2 (list (car pt3)(cadr pt1)) pt4 (list (car pt1)(cadr pt3)) ) ;; ****** Lengths of X and Y ************** (setq XLen (distance pt1 pt2) YLen (distance pt1 pt4) ) ;; ****** divide the X and Y ************** (setq Xnum (getint "\n Specify Number of X elements: ");; for instance 5 Ynum (getint "\n Specify Number of Y elements: ");; for instance 4 ) Quote
JohnM Posted August 11, 2010 Posted August 11, 2010 Could you explain in more detail? Do you just want to collect the point of the intersections of the x’s and y’s? Use the polar function and the repeat function Quote
BIGAL Posted August 12, 2010 Posted August 12, 2010 (edited) Can not see any problem you just need a loop within a loop (repeat Xnum (repeat ynum ( do your thing here) ) (setq xnum (+ xnum Xlen)) ) Edited August 12, 2010 by BIGAL typo Quote
Michaels Posted August 12, 2010 Author Posted August 12, 2010 The crosses in RED are what I would like to get. Although these points are would be changed according to user input. Many thanks Michaels Quote
fixo Posted August 12, 2010 Posted August 12, 2010 I wrote this lisp for enforcements some moons ago Looks like this is exactly what you looking for Change to suit ~'J'~ grid_cross.LSP Quote
Michaels Posted August 13, 2010 Author Posted August 13, 2010 I wrote this lisp for enforcements some moons agoLooks like this is exactly what you looking for Change to suit~'J'~ Thanks fixo, I have two questions about your codes , - Why did you use the following since you didn't use it later in the routine ? - And what does it mean? pc (mapcar (function (lambda (x y)(* (+ x y) 0.5))) It is really works fine, But I am looking forward to learing how codes are running and should be built with according to user inputs. Any suggestion from any one would be highly appreciated. Regards Quote
fixo Posted August 14, 2010 Posted August 14, 2010 Sorry, I can't to expalin the things good because of my english level and by this reason I'm afraid to mix something Feel free to change the code to your suit ~'J'~ Quote
Michaels Posted August 14, 2010 Author Posted August 14, 2010 Sorry,I can't to expalin the things good because of my english level and by this reason I'm afraid to mix something Feel free to change the code to your suit ~'J'~ Thank you so much for your reply. I do understand. Best Regards, Quote
Michaels Posted August 16, 2010 Author Posted August 16, 2010 Hello, I still worndering how to get the intersection points in the pose. Any idea ? Best regards, Quote
JohnM Posted August 16, 2010 Posted August 16, 2010 what are you not understanding? do you know how to use the polar and repeat functions? Quote
Michaels Posted August 16, 2010 Author Posted August 16, 2010 what are you not understanding?do you know how to use the polar and repeat functions? Yes I do. But my question was about the intesection of the lines that would be made by repeat function. Regards, Quote
JohnM Posted August 16, 2010 Posted August 16, 2010 do you need to show the lines? or do you just want the coordinates of the intersections? if you could explain in great detail maybe i could help Quote
Michaels Posted August 16, 2010 Author Posted August 16, 2010 do you need to show the lines?or do you just want the coordinates of the intersections? if you could explain in great detail maybe i could help Thanks for your concerns, I would like to get the coordinates of the intersections to insert a specific block at the end of routine. Thanking you. Quote
Tharwat Posted August 17, 2010 Posted August 17, 2010 It's a very interesting thread for unknown limits of points to be created. Regards, Quote
Michaels Posted August 19, 2010 Author Posted August 19, 2010 It's a very interesting thread for unknown limits of points to be created.Regards, Thanks, But I wonder why nobody could solve or give an answer to my thread !! !! !! Hope this won't be that complicated . Regards, Quote
JohnM Posted August 19, 2010 Posted August 19, 2010 When I asked if you knew the polar and repeat function you replied yes, so I thought you had it figured out. First of all are the elements the lines or the spaces between the lines? Quote
Lee Mac Posted August 19, 2010 Posted August 19, 2010 With a touch of ObjectArx from Alexander Rivilis: ;; An example of Dynamic Grid creation using a grRead substitute, ;; Program by Lee Mac, using DynDraw by Alexander Rivilis ;; (http://www.maestrogroup.com.ua/support/dyndraw.zip) (defun c:DynGrid ( / *error* line vers step bit v m n p1 p2 p3 p4 i j pi/2 prev ) ;; © Lee Mac 2010 (defun *error* ( msg ) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (redraw) (princ) ) (defun line ( s e ) (entmakex (list (cons 0 "LINE") (cons 10 s) (cons 11 e) ) ) ) (setq vers '((18.0 . "2010") (17.2 . "2009") (17.1 . "2008") (17.0 . "2007") (16.2 . "2006") (16.1 . "2005") (16.0 . "2004") (15.6 . "2002")) ) (setq step 1e-6 bit (if (eq "X86" (strcase (getenv "PROCESSOR_ARCHITECTURE") ) ) "x32" "x64" ) ) (cond ( (not (setq v (cdr (assoc (atof (getvar 'ACADVER) ) vers ) ) ) ) (princ "\n** Not Compatible in this Version **") ) ( (not (and (not (initget 6)) (setq m (getint "\nSpecify Number of Rows: ") ) (not (initget 6)) (setq n (getint "\nSpecify Number of Columns: ") ) (setq p1 (getpoint "\nPick First Corner Point: ") ) ) ) (princ "\n*Cancel*") ) ( (and (null dyndraw) (not (arxload (strcat "DynDraw" v (if (eq "2010" v) bit "") ".arx" ) ) ) ) (princ "\n** Arx File not Found **") ) ( (vl-acad-defun 'UpdateGridCallBack) (setq p2 (dyndraw "UpdateGridCallBack" "\nPick Second Point [Columns/Rows] : " "Columns Rows" (+ 1 2 128 2048) -1 nil ) ) (redraw) (if (vl-consp p2) (progn (setq i (/ (- (cadr p2) (cadr p1)) m) j (/ (- (car p2) (car p1)) n) pi/2 (/ pi 2.) p3 (cons (car p2) (cdr p1)) p4 (cons (car p1) (cdr p2)) ) ( (lambda ( k ) (repeat (1- n) (apply (function line) (mapcar (function (lambda ( point ) (trans point 1 0)) ) (list (polar p1 0 (* (setq k (1+ k)) j)) (polar p4 0 (* k j)) ) ) ) ) ) 0 ) ( (lambda ( k ) (repeat (1- m) (apply (function line) (mapcar (function (lambda ( point ) (trans point 1 0)) ) (list (polar p1 pi/2 (* (setq k (1+ k)) i)) (polar p3 pi/2 (* k i)) ) ) ) ) ) 0 ) ) ) ) ) (princ) ) (defun UpdateGridCallBack ( argument ) (cond ( (eq 'STR (type argument)) (cond ( (eq "Columns" argument) (initget 6) (setq n (cond ( (getint (strcat "\nSpecify Number of Columns <" (itoa n) "> : ")) ) ( n ) ) ) ) ( (eq "Rows" argument) (initget 6) (setq m (cond ( (getint (strcat "\nSpecify Number of Rows <" (itoa m) "> : ")) ) ( m ) ) ) ) ( (princ "\n** Invalid Keyword **") ) ) (setq argument t) ) ( (vl-consp argument) (or prev (setq prev argument)) (if (< step (distance prev argument)) (progn (setq prev argument p2 argument) (setq i (/ (- (cadr p2) (cadr p1)) m) j (/ (- (car p2) (car p1)) n) pi/2 (/ pi 2.) p3 (cons (car p2) (cdr p1)) p4 (cons (car p1) (cdr p2))) (redraw) (grvecs (cons 256 (list p1 p3 p3 p2 p1 p4 p4 p2))) ( (lambda ( k ) (repeat (1- n) (grvecs (cons 256 (list (polar p1 0 (* (setq k (1+ k)) j)) (polar p4 0 (* k j)) ) ) ) ) ) 0 ) ( (lambda ( k ) (repeat (1- m) (grvecs (cons 256 (list (polar p1 pi/2 (* (setq k (1+ k)) i)) (polar p3 pi/2 (* k i)) ) ) ) ) ) 0 ) ) ) ) ) argument ) You will need this Arx file in your support path (make sure you pick the right version/bit width): http://www.maestrogroup.com.ua/support/dyndraw.zip Quote
wrmurphy81 Posted August 20, 2010 Posted August 20, 2010 Have you tried using DIVIDE or MEASURE at the command line? DIVIDE will divide a line or arc into equal parts and MEASURE will place a point at any given distance that you specify. 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.