ssget with Fence selection and unlocked layers only

ssget with Fence selection and unlocked layers only

J-Rocks
Collaborator Collaborator
954 Views
13 Replies
Message 1 of 14

ssget with Fence selection and unlocked layers only

J-Rocks
Collaborator
Collaborator

Hello,

How can I use ssget with Fence selection and unlocked layers only ?

example: (ssget "_F:L" (list pt1 pt2)) but it does not work and it gives an error message: bad ssget list .

 

Thank you.

0 Likes
955 Views
13 Replies
Replies (13)
Message 2 of 14

Sea-Haven
Mentor
Mentor

(ssget "F" (list pt1 pt2))  not sure about locked layers some else will add that.

0 Likes
Message 3 of 14

J-Rocks
Collaborator
Collaborator

What's new you come up with than my try ?

0 Likes
Message 4 of 14

paullimapa
Mentor
Mentor

Why would it matter if ssget grabs objects on Locked Layers?

Nothing will happen to those selected objects because they're on Locked Layers.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 14

J-Rocks
Collaborator
Collaborator
Thanks,
I am trying to avoid selecting objects on locked layer and not the reverse one and that is why I am trying to use it :L with Fence selection but it does not work the way I combined the codes.
0 Likes
Message 6 of 14

paullimapa
Mentor
Mentor

seems like lisp does not offer that kind of combination for the ssget function

you may have to do what this thread mentions by cycling through the Layer table to find out which are Locked Layers and then create a Filter group for the ssget function so that the fence option will work the way you want.

ssget and locked layers - Autodesk Community - AutoCAD


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 7 of 14

J-Rocks
Collaborator
Collaborator
Thanks,
That's what I am trying to avoid because the quantity of layers in my drawings are almost uncountable thus this means too slow processing.
0 Likes
Message 8 of 14

ВeekeeCZ
Consultant
Consultant

So make a list of locked layers (or unlocked if it's sorter), and use them to  '((8 . x)) layer filter. 

 

Edit: Now I see it was suggested before. I would use (ssget "F"), then filter out objects on locked layers. The slowest thing would be (ssget "f") for sure. The later filtering you would not notice...

0 Likes
Message 9 of 14

hak_vz
Advisor
Advisor

@J-Rocks 

 

Try this. Modify selection set creation according to your needs.

(defun unFrozenLayerNames ( / str) 
	(setq str "")
	(vlax-for lay 
		(vlax-get (vla-get-activedocument (vlax-get-acad-object)) 'Layers)
		(if (> (vlax-get lay 'Lock) -1)
			(setq str (strcat  str (vlax-get lay 'Name) ","))
		)
	)
)
(setq ss (ssget "F" (list (getpoint "\npoint 1 >")(getpoint "\npoint 2 >")) (list (cons 8 (unFrozenLayerNames)))))

 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 10 of 14

ВeekeeCZ
Consultant
Consultant

I would consider XREF layers as locked too. 

0 Likes
Message 11 of 14

Kent1Cooper
Consultant
Consultant

@J-Rocks wrote:

.... How can I use ssget with Fence selection and unlocked layers only ?

example: (ssget "_F:L" (list pt1 pt2)) but it does not work ....


One thing you can do --

With pt1 and pt2 being your points saved for the Fence [can be more than two]:

 

(if (setq ss (ssget "_F" (list pt1 pt2))); fence selection found things [on all Layers]

  (progn ; then

    (sssetfirst nil ss); select/grip/highlight them all, then apply to that:

    (setq ssu (ssget ":L")); "see" those on unlocked Layers only

  ); progn

); if

Kent Cooper, AIA
Message 12 of 14

paullimapa
Mentor
Mentor

(ssget ":L") will definitely not prevent xref layers from being selected unless they're locked in the Layer table


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 13 of 14

Kent1Cooper
Consultant
Consultant

I don't concur with the concerns about Xref Layers.  Nothing indicates that you would not want to select Xrefs if there are any crossed by the Fence -- it may or may not matter, depending on what you intend to do with the selection.  In any case, (ssget) will "see" only the Layer an Xref [as a whole] is referenced on, not those of nested objects in it [i.e. not Xref-dependent Layers], so it doesn't matter whether those are locked, or "considered" locked.

Kent Cooper, AIA
Message 14 of 14

J-Rocks
Collaborator
Collaborator
Thank you guys for your kind replies.
I did not talk about Xref layers but normal ones.

I come up with a solution to just unlock layers of selected objects if any resides on lock one then lock it back on exit.

Have a good day.
0 Likes