(setq earth_application(vlax-create-object "GoogleEarth.ApplicationGE"))
(vlax-dump-object earth_application t)
; Property values:
; AnimationController (RO) = #<VLA-OBJECT IAnimationControllerGE 00203194>
; AutoPilotSpeed = 4.434
; ElevationExaggeration = 0.5
; SearchController (RO) = #<VLA-OBJECT ISearchControllerGE 001f30b4>
; StreamingProgressPercentage (RO) = 100
; TourController (RO) = #<VLA-OBJECT ITourControllerGE 00200354>
; VersionAppType (RO) = 5
; VersionBuild (RO) = 1
; VersionMajor (RO) = 5
; VersionMinor (RO) = 2
; ViewExtents (RO) = #<VLA-OBJECT IViewExtentsGE 00203f54>
; Methods supported:
; GetCamera (1)
; GetFeatureByHref (1)
; GetFeatureByName (1)
; GetHighlightedFeature ()
; GetLayersDatabases ()
; GetMainHwnd ()
; GetMyPlaces ()
; GetPointOnTerrainFromScreenCoords (2)
; GetRenderHwnd ()
; GetTemporaryPlaces ()
; HideDescriptionBalloons ()
; IsInitialized ()
; IsOnline ()
; LoadKmlData (1)
; Login ()
; Logout ()
; OpenKmlFile (2)
; SaveScreenShot (2)
; SetCamera (2)
; SetCameraParams (8)
; SetFeatureView (2)
; ShowDescriptionBalloon (1)
(defun getzfrompoint (lon lat / z GE keyhole)
(vl-load-com)
(if (setq GE (vlax-get-or-create-object "GoogleEarth.ApplicationGE") keyhole (vlax-get-or-create-object "Keyhole.khInterface"))
(progn
(while (/= 1 (vlax-invoke-method GE 'isinitialized)))
(while (/= 1 (vlax-invoke-method GE 'isonline)))
)
)
(vlax-invoke-method
keyhole 'setViewParams lat lon 1000 0 0 5 5)
(setvar 'cmdecho 0)
(while (/= z
(setq z
(caddr
(vlax-invoke
keyhole
'GetPointOnTerrainFromScreenCoords
0
0
)
)
)
)
)
(setvar 'cmdecho 1)
(vlax-release-object GE)
(vlax-release-object keyhole)
z
)
From vodka too,:)
Allenjt,I also must disagree with you. I use that very function with my current version.
Still works but partially, the particular method "GetPointOnTerrainFromScreenCoords"
we were speaking about does not.
It seems Google is letting go GE more and more. Does not look good for
the future. :-(
ymg
$ (getzfrompoint 40 -62); With version 6.5 Result OK !
-5182.4
_$ (getzfrompoint 40 -62);With Latest version Result Wrong !
-1.41623e-009
Command: (getzfrompoint 40 -62)
-1.41623e-009
Command: (getzfrompoint 40 -62)
-5182.12
alanjt,I would think it would just be 1- for each session of autocad the command was executed.
Did try your suggestion and it does work.
However seems to be related to the first call
not functionning even if GE is completely loaded.
Further test seems to be that the first call for a given
Long, Lat returns a wrong results.
Second call result is OK
If so this is easy enough to work around,
although we probably are limited to 2500 pts
instead of 5000
ymg
(defun test (/ long lat)
(setq long -79.0
lat 49.11
)
(repeat 10
(print (getzfrompoint long lat))
(print (getzfrompoint long lat))
(print)
(setq long (- long 0.1))
)
)
_1$ (test)
0.0
330.824
313.22
313.219
-7.08115e-010
296.83
-1.41623e-009
318.393
-7.08115e-010
334.706
-7.08115e-010
315.692
-2.12435e-009
313.809
308.181
315.999
-7.08115e-010
338.803
312.755
312.755
-80.0
_1$
(repeat 30000 (setq dummy nil))
(while (not (= (vlax-get-property GE 'StreamingProgressPercentage) 100)))
(setq cam (vlax-invoke-method GE 'GetCamera t))
(while (not (and (equal (vlax-get-property cam 'FocusPointLatitude) lat fuzz)(equal (vlax-get-property cam 'FocusPointLongitude) long fuzz)))
(setq cam (vlax-invoke-method GE 'GetCamera t))
) ;Does not work reliably !!!
Your code works perfectly