loopyloop Posted April 26, 2011 Posted April 26, 2011 (edited) Check this Out This will help u To Plot Grid Line ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun ploteast (p1 e inc maxval / i) (setq i 0) (while (<= i maxval) (command "text" (list (- (car p1) 1.0) (+ (cadr p1) (* i inc) 1.0) ) 2.2 90 (strcat "E" (rtos e 2 0) ) ) (setq i (1+ i) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun plotnorth (p1 n inc maxval / i) (setq i 0) (while (<= i maxval) (command "text" (list (+ (car p1) (* i inc) 1.0) (+ (cadr p1) 1.0) ) 2.2 0 (strcat "N" (rtos n 2 0) ) ) (setq i (1+ i) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MAIN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun C:GV(/ pt1 pt2 OriginPt EndPt easting northing east_inc north_inc No_gridHorz No_gridVert x_scale y_scale) (command "cmdecho" 0) (setq OriginPt (getpoint "\nPick a point: ") ) (setq easting (getreal "\nEasting: ") ) (setq east_inc (getreal "\nIncrement (E): ") ) (setq northing (getreal "\nNorthing: ") ) (setq north_inc (getreal "\nIncrement (N): ") ) (setq x_scale (getreal "\nX scale: ") ) (setq y_scale (getreal "\nY scale: ") ) (setq No_gridHorz (getint "\nHow many grids (Horz) ? ") ) (setq No_gridVert (getint "\nHow many grids (Vert) ? ") ) (setq EndPt (list (+ (car OriginPt) (* No_gridHorz east_inc) ) (+ (cadr OriginPt) (* No_gridVert north_inc) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Grids ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq i 0) (while (<= i No_gridHorz) (setq pt1 (list (+ (car OriginPt) (* i east_inc) ) (cadr OriginPt) ) ) (setq pt2 (list (car pt1) (cadr EndPt) ) ) (command "color" "blue") (command "line" pt1 pt2 "") (command "color" "yellow") (ploteast pt1 (+ easting (* i east_inc x_scale) ) north_inc No_gridVert) (setq i (1+ i) ) ) (setq i 0) (while (<= i No_gridVert) (setq pt1 (list (car OriginPt) (+ (cadr OriginPt) (* i east_inc) ) ) ) (setq pt2 (list (car EndPt) (cadr pt1) ) ) (command "color" "blue") (command "line" pt1 pt2 "") (command "color" "yellow") (plotnorth pt1 (+ northing (* i north_inc y_scale) ) east_inc No_gridHorz) (setq i (1+ i) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Edited November 5, 2012 by SLW210 Quote
rrulep Posted May 5, 2014 Posted May 5, 2014 hi can any one help me to generate a grid like this by just clicking the viewport, specify distance of grid lines, and it should also work to polygonal viewport. text must be located to the extent of the viewport. http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/vport-grid-lisp-with-full-lines-and-label/m-p/5009388#M322278 Quote
CADWORKER Posted August 24, 2022 Posted August 24, 2022 On 4/5/2011 at 3:38 PM, Hallen11 said: I finally got round to finishing my grid lisp! I must admit i'm actually quite proud of it. The code is a bit untidy but the command itself seems to work fine. (And that'll do for me!) So, for those of you who are interested here it is. Any feedback will be appreciated. gridR.lsp 10.93 kB · 226 downloads hi, Its a really nice lisp, However I changed the decimals from 4 places to 0, its not working and I need to change the E and N suffix to Prefix. Could any of you help me modify the code for the same and also to keep the drawing scale as 1:1000. Quote
Steven P Posted August 24, 2022 Posted August 24, 2022 If you change (strcat "E" (rtos e 2 0) ) to (strcat (rtos e 2 0) "E" ) and the same with N that will change the prefix / suffix order 1 Quote
CADWORKER Posted August 24, 2022 Posted August 24, 2022 1 hour ago, Steven P said: If you change (strcat "E" (rtos e 2 0) ) to (strcat (rtos e 2 0) "E" ) and the same with N that will change the prefix / suffix order Thanks Steven P, If you can help on my other requirements for making it to 0 decimal and to keep the scale 1000 to avoid the prompt for selecting the drawing scale. 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.