@anycganycgJ8A6A wrote:
that is 4 same x size = 317
so i put x = 317
~~~~
There are NOT. There are 4 objects with x = 317.0092.
Anyway, I added the precision, its set to 0.01, you may change the value.
(defun c:HatchbyXY2Layer (/ ss areap ent i lay clay fltx funx flty funy prec)
(if (and (setq ss (ssget "_X" '((0 . "HATCH"))))
(or (progn
(and (setq fltx (getdist "\nFilter by X <no filter>: "))
(not (initget "< > = Less More Equal"))
(setq funx (getkword "\nSelect typ of comparison [< Less/> More/= Equal]: "))
(setq funx (cond ((wcmatch funx "<,Less") <)
((wcmatch funx ">,More") >)
((wcmatch funx "=,Equal") equal))))
(and (setq flty (getdist "\nFilter by Y <no filter>: "))
(not (initget "< > = Less More Equal"))
(setq funy (getkword "\nSelect typ of comparison [< Less/> More/= Equal]: "))
(setq funy (cond ((wcmatch funy "<,Less") <)
((wcmatch funy ">,More") >)
((wcmatch funy "=,Equal") equal)))))
funx)
(setq prec 0.01)
)
(repeat (setq i (sslength ss))
(setq ent (ssname ss (setq i (1- i))))
(vla-GetBoundingBox (vlax-ename->vla-object ent) 'Ptmin 'Ptmax)
(setq box (cons (vlax-safearray->list PtMin)
(vlax-safearray->list PtMax)))
(if (not (and (or (not fltx)
(cond ((equal funx equal)
(funx (abs (- (cadr box) (caar box))) fltx prec))
(funx (abs (- (cadr box) (caar box))) fltx)))
(or (not flty)
(cond ((equal funy equal)
(funy (abs (- (caddr box) (cadar box))) flty prec))
((funy (abs (- (caddr box) (cadar box))) flty))))
))
(ssdel ent ss))))
(if (and ss
(> (sslength ss) 0)
(setq lay (lisped (setq clay (getvar 'clayer)))))
(progn
(command "_.-LAYER" "_T" lay "_M" lay ""
"_.CHPROP" ss "" "_La" (getvar 'clayer) "")
(print (sslength ss)) (princ (strcat " hatches moved to layer '" (getvar 'clayer) "'"))
(sssetfirst nil ss)
(setvar 'CLAYER clay)))
(princ)
)