Author Topic: Selection set of regions with non-default materials  (Read 203 times)

0 Members and 1 Guest are viewing this topic.

w64bit

  • Newt
  • Posts: 57
Selection set of regions with non-default materials
« on: July 16, 2021, 05:07:48 AM »
How can I make a selection set of regions having materials other than default materials (ByBlock, ByLayer or Global)?

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1199
  • Marco
Re: Selection set of regions with non-default materials
« Reply #1 on: July 17, 2021, 03:39:39 AM »
If I understand correctly this can help:
Code: [Select]
; PrpVal wcmatch style
; (ALE_SelSet_RemoveByProperty #SSet1 'EntityTransparency  "70") >  = 70
; (ALE_SelSet_RemoveByProperty #SSet1 'EntityTransparency "~70") > /= 70
;
(defun ALE_SelSet_RemoveByProperty (SelSet PrpNam PrpVal / Countr EntNam EntObj)
  (if SelSet
    (repeat (setq Countr (sslength SelSet))
      (and
         (setq EntNam (ssname SelSet (setq Countr (1- Countr)))  EntObj (vlax-ename->vla-object EntNam))
         (vlax-property-available-p EntObj PrpNam)
         (wcmatch (vlax-get EntObj PrpNam) PrpVal) ; 20210630 sostituito eq con wcmatch
         (setq SelSet (ssdel EntNam SelSet))
      )
    )
  )
  SelSet
)

roy_043

  • Water Moccasin
  • Posts: 1876
  • BricsCAD 18
Re: Selection set of regions with non-default materials
« Reply #2 on: July 17, 2021, 07:05:10 AM »
Code - Auto/Visual Lisp: [Select]
  1.   lst (dictsearch (namedobjdict) "ACAD_MATERIAL")
  2.   enm-bylayer (cdadr (member '(3 . "ByLayer") lst))
  3.   enm-byblock (cdadr (member '(3 . "ByBlock") lst))
  4.   enm-global (cdadr (member '(3 . "Global") lst))
  5.   ss
  6.     (ssget
  7.       "_X"
  8.       (list
  9.         '(0 . "REGION")
  10.         '(-4 . "<NOT")
  11.           '(-4 . "<OR")
  12.             (cons 347 enm-bylayer)
  13.             (cons 347 enm-byblock)
  14.             (cons 347 enm-global)
  15.           '(-4 . "OR>")
  16.         '(-4 . "NOT>")
  17.       )
  18.     )
  19. )
  20. (sssetfirst nil ss)

w64bit

  • Newt
  • Posts: 57
Re: Selection set of regions with non-default materials
« Reply #3 on: July 18, 2021, 06:23:15 AM »
Excellent.
Thank you all very much.