Jump to content

Survey Grid Lisp


Hallen11

Recommended Posts

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 by SLW210
Link to comment
Share on other sites

  • 3 years later...
  • 8 years later...
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.

Link to comment
Share on other sites

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

  • Agree 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...