Author Topic: Zoom to Geolocation Point  (Read 1354 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Zoom to Geolocation Point
« on: July 13, 2020, 07:53:30 AM »
I am having a hard time trying to create a basic macro or routine that can zoom to a center of a georeferenced point.

How can I get the location of the georeferenced point? I would like to be able to set the coordinate zone then zoom to the center of it.

Code: [Select]
(vl-load-com)

(defun c:test ()
 (setq p (getPositionMarkerCoords))
 (command "zoom" "center" (getPositionMarkerCoords) "200000")
 (princ)
 )

(defun getPositionMarkerCoords (  / ad s ds ts rp le ln p)
 (setq ad (_GetAeccDocument))
 (setq s (vlax-get-property ad 'Settings))
 (setq ds (vlax-get-property s 'DrawingSettings))
 (setq ts (vlax-get-property ds 'TransformationSettings))
 (setq rp (vlax-get-property ts 'ReferencePoint))
 (setq le (vlax-get-property rp 'LocalEasting))
 (setq ln (vlax-get-property rp 'LocalNorthing))
 (setq p (list le ln))
 )

Civil3D 2020

wizman

  • Bull Frog
  • Posts: 290
Re: Zoom to Geolocation Point
« Reply #1 on: July 13, 2020, 11:45:27 AM »
Your getPositionMarkerCoords function works, just replace:

(command "zoom" "center" (getPositionMarkerCoords) "200000")

with

(vla-zoomcenter (vlax-get-acad-object) (vlax-3d-point p) 20000)

in your c:test.

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Re: Zoom to Geolocation Point
« Reply #2 on: July 13, 2020, 04:02:16 PM »
Thanks for the input, so visual lisp was the key for the zoom function. lol Not sure, what I did now, I can't get it to work lol. Ill hopefully figure it out.

Again, thanks
Civil3D 2020

wizman

  • Bull Frog
  • Posts: 290
Re: Zoom to Geolocation Point
« Reply #3 on: July 14, 2020, 01:08:38 AM »
You're welcome. Good luck & just come back with an error message in case you're still stuck.

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Re: Zoom to Geolocation Point
« Reply #4 on: July 14, 2020, 07:57:38 AM »
My wonderful error.

Code: [Select]
test ; error: no function definition: _GETAECCDOCUMENT
Civil3D 2020

MSTG007

  • Gator
  • Posts: 2598
  • I can't remeber what I already asked! I need help!
Re: Zoom to Geolocation Point
« Reply #5 on: July 14, 2020, 09:56:18 AM »
Ok. I think I got it figured out. Thought I would share. I could not get the zoom function to work so I improvised with a circle.

Code: [Select]
(vl-load-com)

(defun _GetAeccDocument ()
  (setq C3D (strcat "HKEY_LOCAL_MACHINE\\" (if vlax-user-product-key (vlax-user-product-key) (vlax-product-key) ) )
C3D (vl-registry-read C3D "Release")
C3D (substr C3D 1 (vl-string-search "." C3D (+ (vl-string-search "." C3D) 1)))
C3D (vla-getinterfaceobject (vlax-get-acad-object) (strcat "AeccXUiLand.AeccApplication." C3D)))
  (vlax-get-property C3D 'ActiveDocument)
  )


(defun getPositionMarkerCoords (  / ad s ds ts rp le ln p)
 (setq ad (_GetAeccDocument))
 (setq s (vlax-get-property ad 'Settings))
 (setq ds (vlax-get-property s 'DrawingSettings))
 (setq ts (vlax-get-property ds 'TransformationSettings))
 (setq rp (vlax-get-property ts 'ReferencePoint))
 (setq le (vlax-get-property rp 'LocalEasting))
 (setq ln (vlax-get-property rp 'LocalNorthing))
 (setq p (list le ln))
 )


(defun c:zoomtogeolocation ()
 (setq p (getPositionMarkerCoords))
 (command "_.CIRCLE" (getPositionMarkerCoords) "2000000" "ZOOM" "EXTENTS" "_.ERASE" (ssget "x" '((0 . "CIRCLE"))) "" "_GEOMAP" "HYBRID")
 (princ)
 )
Civil3D 2020