Jump to content

How to select the object before using (vlax-for x (vla-get-activeselectionset


Recommended Posts

Posted (edited)
(setq Pr_PolySelection (ssget))
(repeat (sslength Pr_PolySelection)
		(setq poly_Ent (ssname Pr_PolySelection 0))	
		(setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))
		(vla-clear (vla-get-activeselectionset *AcadDoc*))
		(vl-cmdf "_.pselect" poly_Ent "") ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
		(setq Add nil Add (ssadd))
		(vlax-for x (vla-get-activeselectionset *AcadDoc*)
			(vla-getboundingbox x 'P1 'P2)
			(setq P1 (vlax-safearray->list P1))
			(setq P2 (vlax-safearray->list P2))
			(and (setq Temp (ssget "_C" (trans (list (car P1) (cadr P2) 0.) 0 1) (trans (list (car P2) (cadr P1) 0.) 0 1) '((0 . "LWPOLYLINE"))))
				(ssdel poly_Ent Add)
		   )
		)
)

 

Any idea how to select   poly_Ent   before  (vlax-for x (vla-get-activeselectionset 

 

without using    (vl-cmdf "_.pselect" poly_Ent "")  because it slow the code too much

 

Edited by Engineer_Yasser
Posted (edited)
21 hours ago, Lee Mac said:

Why not just use (setq x (vlax-ename->vla-object poly_Ent)) ?

 

Thanks very much, it worked like a charm  😍🌹

Edited by Engineer_Yasser
Issue solved
Posted (edited)

"This is part of a Lisp to select touched polylines." Show say a dwg or image what is previous selection set. You can also do the repeat for items in a selection set much easier.

 

(repeat (setq K (sslength Pr_PolySelection))
(setq polyent (ssname ss (setq k (1- k))))
....
)

If I understand you want a single bounding box of selected objects ? You seem to be doubling up on what your asking for.

Edited by BIGAL
  • Like 1
Posted
4 hours ago, BIGAL said:

"This is part of a Lisp to select touched polylines." Show say a dwg or image what is previous selection set. You can also do the repeat for items in a selection set much easier.

 

(repeat (setq K (sslength Pr_PolySelection))
(setq polyent (ssname ss (setq k (1- k))))
....
)

If I understand you want a single bounding box of selected objects ? You seem to be doubling up on what your asking for.

 

Good idea, I used it in the code, it's faster, Thanks  👍

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...