TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: MSTG007 on July 24, 2020, 11:43:11 AM
-
I am messing around trying to swap our the getpoint to use a window coordinate instead. I am not having much luck and thought I might get a direction.
Currently it will take the point and convert it to a LONG and LAT then over to a web browser map.
The new map I am trying to get needs to have 2 coordinates instead of the one.
(defun c:LiDar (/ COORDS LONGLAT LONG LAT PROJDEST PROJSRC)
(Alert "A Coordinate System Must be set.")
(setq PROJSRC (ade_projgetwscode))
(if (/= (getvar "ctab") "Model") (command "_layout" "Set" "Model"))
(ade_projsetsrc PROJSRC)
(ade_projsetdest "LL84")
(setq COORDS (getpoint "\nPick a Point within Modelspace: "));;; Pick a Window?
(setq LONGLAT (ade_projptforward COORDS))
(setq LONG (car LONGLAT))
(setq LONG (rtos LONG 2 6))
(setq LAT (car (cdr LONGLAT)))
(setq LAT (rtos LAT 2 6))
(setq PROJDEST (ade_projgetinfo "LL84" "description"))
(princ (strcat
"\n X,Y: " (rtos (car COORDS) 2 6) "," (rtos (cadr COORDS) 2 6)
"\n Projection SOURCE : " PROJSRC
"\n Projection CIBLE(Target) : " PROJDEST
"\n Longitude,Latitude: " LONG "," LAT
"\n"))
(setq Website (strcat "https://portal.opentopography.org/datasets?minX=" LONG "&minY=" LAT "&maxX=" LONG "&maxY=" LAT ""))
(command "_browser" Website)
(princ)
)
(C:LiDAR)
Thanks guys.
-
getpoint followed by getcorner?
-
Bit like Lee if point is centre then what scale and work out using polar 2 new pts or a distance very easy.
-
If you are trying to get 2 coordinates from one pick simply add the offset to the coordinates.
(setq cp (getpoint)
x-offset 200.0
y-offset 300.0
ll (list (- (car cp) x-offset)(- (cadr cp) y-offset))
ur (list (+ (car cp) x-offset)(+ (cadr cp) y-offset))
)
-
getpoint followed by getcorner?
Lee, I think that's what I am after. Click to create a window with the two points.
As I look through the code, does it make sense to create a LAT1 LONG1 and then a LAT2 LONG2 to carry the coordinates into the right place for the web address?
I know I have not changed the getpoint to the window, but I am guessing this is how I would carry the variables through the rest of the of the code.
(defun c:LiDar (/ COORDS LONGLAT1 LONG1 LAT1 LONGLAT2 LONG2 LAT2 PROJDEST PROJSRC)
(Alert "A Coordinate System Must be set.")
(setq PROJSRC (ade_projgetwscode))
(if (/= (getvar "ctab") "Model") (command "_layout" "Set" "Model"))
(ade_projsetsrc PROJSRC)
(ade_projsetdest "LL84")
(setq COORDS (getpoint "\nPick a Point within Modelspace: "));;; Pick a Window?
(setq LONGLAT1 (ade_projptforward COORDS))
(setq LONGLAT2 (ade_projptforward COORDS))
(setq LONG1 (car LONGLAT1))
(setq LONG1 (rtos LONG 2 6))
(setq LAT1 (car (cdr LONGLAT1)))
(setq LAT1 (rtos LAT 2 6))
(setq LONG2 (car LONGLAT2))
(setq LONG2 (rtos LONG 2 6))
(setq LAT2 (car (cdr LONGLAT2)))
(setq LAT2 (rtos LAT 2 6))
(setq PROJDEST (ade_projgetinfo "LL84" "description"))
(princ (strcat
"\n X,Y: " (rtos (car COORDS) 2 6) "," (rtos (cadr COORDS) 2 6)
"\n Projection SOURCE : " PROJSRC
"\n Projection CIBLE(Target) : " PROJDEST
"\n Longitude,Latitude: " LONG1 "," LAT1
"\n Longitude,Latitude: " LONG2 "," LAT2
"\n"))
(setq Website (strcat "https://portal.opentopography.org/datasets?minX=" LONG1 "&minY=" LAT1 "&maxX=" LONG2 "&maxY=" LAT2 ""))
(command "_browser" Website)
(princ)
)
(C:LiDAR)