Select block (with attributes) ons specific location

Select block (with attributes) ons specific location

djurk_haas
Advocate Advocate
774 Views
2 Replies
Message 1 of 3

Select block (with attributes) ons specific location

djurk_haas
Advocate
Advocate

Hello,

 

I'm tying to select a block(s) thats on are on specific location (500, 500,0) in the drawing.

I have tried:

(ssget "_x" '((0 . "insert") (10 500 500 0)))

but that doesn't seem to work?

Please help me how this can be done with a lisp routine?

 

Thanks a lot

 

0 Likes
775 Views
2 Replies
Replies (2)
Message 2 of 3

ronjonp
Advisor
Advisor

Works for me with that drawing you posted.
image.png

This might be more reliable though:

(defun _blockbypoint (point fuzz)
  (ssget "_X"
	 (list '(0 . "insert")
	       '(-4 . "<AND")
	       '(-4 . ">=,>=")
	       (cons 10 (list (- (car point) fuzz) (- (cadr point) fuzz)))
	       '(-4 . "<=,<=")
	       (cons 10 (list (+ (car point) fuzz) (+ (cadr point) fuzz)))
	       '(-4 . "AND>")
	 )
  )
)
(_blockbypoint (trans '(500. 500. 0.) 1 0) 1e-8)
0 Likes
Message 3 of 3

pbejse
Mentor
Mentor

@djurk_haas wrote:

Hello,

I'm tying to select a block(s) thats on are on specific location (500, 500,0) in the drawing.

 

 

Thanks a lot


What you posted works [ most of the time ], but if you wanting to limit your selection to only blocks with attributes. 

 

(ssget "_x" '((0 . "insert")(66 . 1) (10 500 500 0)))

Not sure if that's what you are referring to though. Can you give is more info.

 

 

 

 

 

0 Likes