TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: mohan on October 18, 2021, 11:50:15 AM

Title: Selection of color range to change
Post by: mohan on October 18, 2021, 11:50:15 AM
Select solid hatch objects color range from 140 to 169 & change all of them to color 170
Code: [Select]
(defun c:test ( / ss)
(if (entget (setq ss (ssget "x" '((0 . "HATCH") (2 . "_SOLID") (62 . "140<169")))))
    (command "._chprop" ss "" "c" "170" "")) (princ))

not selecting !!
Title: Re: Selection of color range to change
Post by: danAllen on October 18, 2021, 11:55:26 AM
see group 4 "less than" "greater than" options in http://www.lee-mac.com/ssget.html
Title: Re: Selection of color range to change
Post by: BIGAL on October 18, 2021, 07:49:50 PM
Look at Lee-mac you need the AND as well > 139 <170
Title: Re: Selection of color range to change
Post by: d2010 on October 19, 2021, 12:31:00 AM
All Hatches have one Color=256?Can you upload a Sample.Drawing.dwg?
Code: [Select]
Command:
Command: q2
Select objects: all
362 found
===========
Select objects:
AcDbHatch.h=[256...256]Range
AcDbMatchProperties.h=(256)
Get MininColor=(nil.256)=1
Get MaximColor=(nil.256)=100
Select objects:
Lzh=1      ...bzh=100
Fns=nil SSLengthQ=Do yo
Select solid hatch objects color range from 140 to 169 & change all of them to color 170
Title: Re: Selection of color range to change
Post by: Lee Mac on October 19, 2021, 02:28:27 PM
Look at Lee-mac you need the AND as well > 139 <170

The AND logic is implicit in a selection set filter list, and so the filter can be written -
Code - Auto/Visual Lisp: [Select]
  1. '((0 . "HATCH") (2 . "_SOLID") (-4 . ">=") (62 . 140) (-4 . "<=") (62 . 169))
Title: Re: Selection of color range to change
Post by: BIGAL on October 19, 2021, 07:32:50 PM
Thanks Lee