Geomap image selection with Civil 3D

Geomap image selection with Civil 3D

u.boudier
Explorer Explorer
332 Views
2 Replies
Message 1 of 3

Geomap image selection with Civil 3D

u.boudier
Explorer
Explorer

Hi everyone,

 

I'm trying to write a lisp that would clean my file and delete heavy objects, and I can't find a way to select (and then delete) the captured satellite image that Autocad Civil calls Geomap Image.

 

I'm also doing this for surfaces object and my code is as below. I would like to get a feedback on it because it only works partially and sometimes does not delete the surfaces. I'm quite new to this and I'm mostly copying and mixing from different forums, so maybe you can already spot something wrong.

 

Surface:

 

  (setq ss (ssget "_X" '((0 . "AECC_*"))))
  (if ss
    (progn
      (princ (sslength ss))
      (princ "\n surface(s) found")
      (setq i 0)
      (repeat (sslength ss)
        (setq ent (ssname ss i))
        (entdel ent)
        (setq i (1+ i))
      )
    )
    (princ "\n No surfaces found.")
  )

 

 

Thank you in advance.

0 Likes
333 Views
2 Replies
Replies (2)
Message 2 of 3

ВeekeeCZ
Consultant
Consultant

(command "_.erase" (ssget "_X" '((0 . "GEOMAPIMAGE"))) "")

 

not sure about that surface part... don't like the over-all filter "AECC_*". I would tend to use just "AECC_TIN_SURFACE" ... but better post it into C3D cust forum HERE 

 

But generally, is it used o C3DTOACAD exported file?

Message 3 of 3

CodeDing
Advisor
Advisor

@u.boudier ,

 

It is worth noting that you can NOT select the Geomap Images via the (entsel ...) function. you will get an error:

"Select object: ; error: bad argument type: lentityp nil"

Not sure why that happens. but the only way to select them is via (ssget ...).

 

Also, AEC objects are obviously very... Unique.. As in, they do not get handled/treated as the normal AutoCAD objects do. Therefore, I would try a simple change to how you delete them and use the (vla-delete ...) method instead. Might be more reliable than the simple (entdel ...) approach. Something like:

  (if (setq ss (ssget "_X" '((0 . "AECC_*,GEOMAPIMAGE"))))
    (progn
      (repeat (setq cnt (sslength ss))
        (setq ent (ssname ss (setq cnt (1- cnt))))
        (vla-delete (vlax-ename->vla-object ent))
      );repeat
      (prompt (strcat "\nA total of " (itoa (sslength ss)) " AEC & Geomap objects were found and deleted."))
      (setq ss nil)
    );progn
  ;else
    (prompt "\nNo AEC or Geomap objects were found.")
  );if

 

Best,

~DD