TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: ChrisCarlson on April 15, 2016, 08:40:36 AM

Title: GeoMap Image
Post by: ChrisCarlson on April 15, 2016, 08:40:36 AM
I have a routine which parses a text file and modifies draw order. However it doesn't seem to work on GeoMap Images but if I manually use these commands it works. What am I missing?

Code - Auto/Visual Lisp: [Select]
  1. (defun c:hdbo (/ layerlist layerc)
  2. ;;  Author: Based off of BlackBox''s post on CADTutor
  3. ;; http://www.cadtutor.net/forum/showthread.php?87890-change-draw-order-if-layer-exists&s=e6ae9b5b97e60272c68c3a5b0c177b6b
  4. ;;      Dated 07/28/2015 - Initial Release
  5. ;;
  6. ;;      Dependencies
  7. ;;      -_readfile
  8. ;;      -C:/order.txt                                                                          
  9. ;;------------------------------------------------------------;;
  10.         (if (setq layerlist (_readfile "C:/order.txt"))
  11.                 (foreach layer_tmb layerlist
  12.                         (if (setq layerc (ssget "x" (list (cons 8 layer_tmb) (if (= 1 (getvar 'cvport)) (cons 410 (getvar 'ctab)) '(410 . "Model")))))
  13.                                 (progn
  14.                                         (sssetfirst nil layerc)
  15.                                         (ai_draworder "_b")
  16.                                         (princ)
  17.                                 )
  18.                                 (princ)
  19.                         )
  20.                         (princ)
  21.                 ) ; end for each
  22.                 (alert "Layer List not Found") 
  23.         ) ; end if file location
  24.         (vla-Regen (vla-get-activedocument(vlax-get-acad-object)) acAllViewports)
  25.         (princ)
  26. ) ; end function
Title: Re: GeoMap Image
Post by: snownut2 on April 15, 2016, 09:34:42 AM
what does the "ai_draworder" function look like?
Title: Re: GeoMap Image
Post by: ronjonp on April 15, 2016, 09:45:29 AM
One strange thing I see is this returns nil even if there is a map in the drawing (2017)...
Code - Auto/Visual Lisp: [Select]
  1. (ssget "x" '((0 . "GEOMAPIMAGE")))
Title: Re: GeoMap Image
Post by: ChrisCarlson on April 15, 2016, 09:49:37 AM
what does the "ai_draworder" function look like?

ai_draworder is an AutoCAD function from acdorder.arx
Title: Re: GeoMap Image
Post by: ChrisCarlson on April 15, 2016, 09:58:19 AM
One strange thing I see is this returns nil even if there is a map in the drawing (2017)...
Code - Auto/Visual Lisp: [Select]
  1. (ssget "x" '((0 . "GEOMAPIMAGE")))

Code: [Select]
Command: (ssget "x" '((0 . "GEOMAPIMAGE")))
<Selection set: 2187>

Weird, Vanilla 2017 grabs it. What's odd is if i recreate these steps manually

Code - Auto/Visual Lisp: [Select]
  1. (if (= (sssetfirst nil (ssget "x" (list (cons 8 "zMap" ) (if (= 1 (getvar 'cvport)) (cons 410 (getvar 'ctab)) '(410 . "Model"))))) nil)(princ))

Will highlight and then (ai_draworder) "back" sends it back.
Title: Re: GeoMap Image
Post by: ronjonp on April 15, 2016, 10:08:13 AM
Strange .. I cannot get ssget to grab it...

Title: Re: GeoMap Image
Post by: ChrisCarlson on April 15, 2016, 10:14:27 AM
Going more into it

Code - Auto/Visual Lisp: [Select]
  1. (vlax-dump-object (vlax-ename->vla-object (car (entsel))) t)

Returns
Error: bad argument type: lentityp nil