Author Topic: Highlite a selection set  (Read 1947 times)

0 Members and 1 Guest are viewing this topic.

mohobrien

  • Guest
Highlite a selection set
« on: May 13, 2005, 11:28:39 PM »
Drawing a blank! We draw property maps for mineral tenure by doing all drafting in autocadmap (its so easy), attach object data to the polygons, export to arcview and then link to a database and put the result on an ArcIMS server. Problem is too many people are updating and sometimes object data isn't always attached. This is just a utility to find those polygons. I can make the selection set for them -ss but I can't for the life of me figure out how to highlight them.  :oops: Can someone give me a hint?

Code: [Select]
;;; Utility to find polygons that are missing object data.
;;; The wrapped function to get the object data names is from Rakesh Rao

(defun c:no_od (/ item table_attached ss sset p1 p2)
  (setq ss (ssadd)) ; make an empty selection set to put naked polygons
  (prompt "\nSelect Objects to test by Window")
  (setq p1 (getpoint "\nFirst Corner: "))
  (setq p2 (getcorner p1 "\nSecond Corner: "))
  (setq sset ; this is the selection set of polygons to test
(ssget
  "c"
  p1
  p2
  (list (cons 0 "LWPOLYLINE"))
)
  )
  (if (= sset nil) ; if nothing selected
    (progn ; do this
      (princ)
      (alert "No polylines selected!")
      (exit)
    ) ;end of routine to run if no polygons selected
    (progn ; if polygons have been selected do this
      (setq ctr 0) ;set the counter to zero      
      (while (and sset (> (sslength sset) 0))
(setq item (ssname sset 0)) ;extract the name of first entity in the list.
(setq table_attached (AM_GetTables item))
(if (= table_attached nil) ; if no object data
 (progn
   (ssadd item ss) ; add the item to the set to highlite
   (ssdel item sset) ; delete the item from selection set being tested
 )
 (ssdel item sset) ; otherwise delete the item from selection set being tested
)
(setq ctr (+ ctr 1)) ; increase the counter
      ) ; get next item
    ) ; end of routine to run if polygons selected
  ) ; end of if
  (setq sset nil) ; get rid of this now empty selection set

;;;(???????) ; highlite the ss selection set
  (princ) ; clean exit
)

(defun AM_GetTables (ename / Tables)
  (setq Tables (ade_odgettables ename)) ; get the table names
  (if Tables ; if there are tables
    (progn
      (if (not (listp Tables)) ;and if not only one table make them a list
(setq Tables (list Tables))
      )
      (setq Tables (mapcar 'strcase Tables)) ; convert to upper case
    )
  )
  Tables ; return the tables
)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Highlite a selection set
« Reply #1 on: May 13, 2005, 11:46:30 PM »
Perhaps --

Code: [Select]
(defun ssredraw ( ss mode / i )
    (if (eq 'pickset (type ss))
        (repeat (setq i (sslength ss))
            (redraw
                (ssname ss (setq i (1- i)))
                mode
            )
        )
    )
)

Use a mode value of 3 to highlight, 4 to unhighlight.

From the AutoLISP help file --

Quote
If ename is the header of a complex entity (a polyline or a block reference with attributes), redraw processes the main entity and all its subentities if the mode argument is positive. If the mode argument is negative, redraw operates on only the header entity.

See the AutoLISP help file for more info.

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

mohobrien

  • Guest
Highlite a selection set
« Reply #2 on: May 13, 2005, 11:50:40 PM »
:!: Fast. Thanks a lot. I'll give it a try.
 It worked perfect  :D

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Highlite a selection set
« Reply #3 on: May 14, 2005, 12:05:50 AM »
My peasure, glad I could assist.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst