TheSwamp

CAD Forums => Vertically Challenged => Topic started by: MSTG007 on August 27, 2019, 08:14:38 AM

Title: Mapimport KML
Post by: MSTG007 on August 27, 2019, 08:14:38 AM
I am making a simple (Command "mapimport") routine. I can get everything to work if its with a hard coded file location. I am trying to figure out how to get the command to pop a dialog box to select the file and then proceed as it does when its hard coded.

Hope that makes sense some.

Code: [Select]
(defun c:zta ()

;;Imports KML into CAD and Zooms to Point

;;(command "mapimport" "y" "p") ;; This command allow for the dialog box then after selecting the file, gives an invalid error.
(command "_.-MAPIMPORT" "OGCKML" "W:\\TEST\\KML.kmz" "_y" "W:\\TEST\\KML.ipf" "_p") ;;This command works with a hard coded file location and name.
(ssget "x" '((0 . "point"))) ;;Finds Point
;;(command "zoom" "object" (ssget "x" '((0 . "point"))) "")  ;; Zooms to Point
(command "zoom" "object" "previous" "")
(command "zoom" "scale" "1/50")
(princ)
)

(C:ZTA)
Title: Re: Mapimport KML
Post by: ronjonp on August 27, 2019, 09:25:51 AM
Look into GETFILED.
https://autode.sk/2HtnFp1
Title: Re: Mapimport KML
Post by: MSTG007 on August 27, 2019, 10:09:36 AM
Thanks Ron! Got it. Works like I want it to! Thank you!
Title: Re: Mapimport KML
Post by: ronjonp on August 27, 2019, 10:17:29 AM
Thanks Ron! Got it. Works like I want it to! Thank you!
Glad to help :)