lido 14 Posted January 20 Hello everyone! After loading a SHX shape file with vla-loadshapefile function, I would like to know the names of shapes available (defined) in the file. Does anyone know how to proceed? Thanks in advance. Quote Share this post Link to post Share on other sites
BIGAL 531 Posted January 20 If you just want to know not actually use in a program search SHX to SHP, shp are text files Quote Share this post Link to post Share on other sites
lido 14 Posted January 21 @BIGAL Thank you for your answer. The SHX file is at the client. I do not have acces to it! My program should read the data in the SHX file (defined shape names) and integrate the shape chosen by the user into the definition of a complex line. Quote Share this post Link to post Share on other sites
lido 14 Posted January 22 In the absence of a better solution, please accept this one which I propose. Any comments are welcome. ;;Read shape names defined inside a SHX file ;;lido 22.01.2121 (defun shpnames (SHX_file / $line EXE_file INN_file OPN_file OUT_file SHP_list TMP_file) (cond ( (not (setq INN_file (findfile SHX_file))) (alert (strcat SHX_file " file not found."))) ( (not (setq EXE_file (findfile "dumpshx.exe"))) (alert "dumpshx.exe file not found.")) ( T (setq OUT_file (vl-filename-mktemp (strcat (vl-filename-base SHX_file) ".SHP"))) (if (> (startapp (strcat EXE_file " -o " OUT_file " " INN_file)) 2) (progn (while (< (vl-file-size OUT_file) 1)) ;;Delay, do not delete! (setq OPN_file (open OUT_file "r")) (while (setq $line (read-line OPN_file)) (if (= (substr $line 1 1) "*") (setq SHP_list (cons (substr $line (- (strlen $line) (vl-position 44 (reverse (vl-string->list $line))) -1)) SHP_list)) ) ) (close OPN_file) (if (setq TMP_file (findfile (strcat (vl-filename-directory OUT_file) "\\" (vl-filename-base OUT_file) ".TMP"))) (vl-file-delete TMP_file)) ;;Dumpshx.exe Version 1.3 make this file (while (findfile OUT_file) (vl-file-delete OUT_file)) ;;An other delay, do not delete! ) ) ) ) (vl-sort SHP_list (function (lambda (a b) (< a b)))) ) ;;shpnames (vl-load-com) 1 Quote Share this post Link to post Share on other sites
tombu 89 Posted January 22 37 minutes ago, lido said: In the absence of a better solution, please accept this one which I propose. Any comments are welcome. Handy function. Added to my collection. Quote Share this post Link to post Share on other sites
BIGAL 531 Posted January 22 Glad you found dumpshx.exe. Quote Share this post Link to post Share on other sites