Author Topic: Selection of color range to change  (Read 1369 times)

0 Members and 1 Guest are viewing this topic.

mohan

  • Newt
  • Posts: 98
Selection of color range to change
« 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 !!
"Save Energy"

danAllen

  • Newt
  • Posts: 132
Re: Selection of color range to change
« Reply #1 on: October 18, 2021, 11:55:26 AM »
see group 4 "less than" "greater than" options in http://www.lee-mac.com/ssget.html

BIGAL

  • Swamp Rat
  • Posts: 1396
  • 40 + years of using Autocad
Re: Selection of color range to change
« Reply #2 on: October 18, 2021, 07:49:50 PM »
Look at Lee-mac you need the AND as well > 139 <170
A man who never made a mistake never made anything

d2010

  • Bull Frog
  • Posts: 323
Re: Selection of color range to change
« Reply #3 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
« Last Edit: October 19, 2021, 12:55:50 AM by d2010 »

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: Selection of color range to change
« Reply #4 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))

BIGAL

  • Swamp Rat
  • Posts: 1396
  • 40 + years of using Autocad
Re: Selection of color range to change
« Reply #5 on: October 19, 2021, 07:32:50 PM »
Thanks Lee
A man who never made a mistake never made anything