TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Mark on February 01, 2005, 07:44:00 AM

Title: Highlighting entities
Post by: Mark 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)
  )
Title: Highlighting entities
Post by: ImaJayhawk 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
Title: Highlighting entities
Post by: CAB 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)
       )
   )
)