Jump to content

how to select the Hatch boundaries


Recommended Posts

Posted

Sorry to annoy you guys again but I managed to get it to work (sort of).

 

But it's not selecting the correct boundary in some cases. See attached drawing.

 

If you select the hatch for plaster in that, it'll select the adjacent boundary too.

 

Any help here would be greatly appreciated.

 

 

(defun c:Test (/ _2dpt ss1 ss2 ss3 a b i1 i2 )

(vl-load-com)

(setq ss3 (ssadd))

(defun _2dpt (pt) (list (car pt) (cadr pt) 0.))

(if
	(setq ss1 (ssget '((0 . "HATCH"))))
	(repeat
		(setq i1 (sslength ss1))

		(vla-getboundingbox (vlax-ename->vla-object (ssname ss1 (setq i1 (1- i1)))) 'a 'b)

		(if (setq ss2
			(apply 'ssget
				(append
					(list "_W")
					(mapcar '(lambda (x) (trans (_2dpt (vlax-safearray->list x)) 0 1)) (list a b))
					'(((0 . "~HATCH,ARC,CIRCLE,LINE,LWPOLYLINE")))
					)
				)
			)

		(repeat (setq i2 (sslength ss2))

			(ssadd (ssname ss2 (setq i2 (1- i2))) ss3)

			)
		)
		)
	)

(sssetfirst nil ss3)
(princ (strcat "\nNumber of found hatch boundaries : < " (itoa (sslength ss3)) " >"))
(command "._regen")(princ)

)

Selection problem.dwg

  • 7 years later...
Posted

This works for hatches that are associated with the objects.

 

Lee Mac working his magic once again.

 

 

  • Thanks 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...