Author Topic: Highlighting entities  (Read 2620 times)

0 Members and 1 Guest are viewing this topic.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Highlighting entities
« on: February 01, 2005, 07:44:00 AM »
Here's a simple method for highlighting user selected entities.
Code: [Select]

(defun c:hle1 (/ ent ent_type lst_of_ents)

  (while (setq ent (car (entsel "\nPick something <enter> to quit: ")))

         ;; highlight the selected entity
         (redraw ent 3)

         (setq ent_type (cdr (assoc 0 (entget ent)))    ; extract entity type
               lst_of_ents (cons ent lst_of_ents) ; create a list of entities selected
               )

         (princ (strcat "\nAdded " ent_type " to the list"))
         ); while

  ;; un-highlight the entities
  (foreach item lst_of_ents (redraw item 4))

  (princ)
  )
TheSwamp.org  (serving the CAD community since 2003)

ImaJayhawk

  • Guest
Highlighting entities
« Reply #1 on: February 01, 2005, 10:28:45 AM »
Why not use

Code: [Select]

      ;convert object to vla object
      (setq sor (vlax-ename->vla-object (car ent)))

      ;set highlight to true for the selected object
      (vla-highlight sor "true")



and

Code: [Select]

(vla-highlight sor "false")



--ImaJayhawk

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Highlighting entities
« Reply #2 on: February 01, 2005, 11:12:12 AM »
Here is another, not sure where i got the code.

Code: [Select]
(if ss
  (progn
    (setq num (sslength ss) i -1)
       (while (< (setq i (1+ i)) num)
         (setq vlaobj (vlax-ename->vla-object (ssname ss i)))
         (vla-Highlight vlaobj :vlax-true)
         (vla-update vlaobj)
       )
   )
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.