Jump to content

how to select all visible objects by lisp ?


ahyin

Recommended Posts

Hi All,

I'm new in autolisp I don't know how to select all visible objects by lisp. If I use ssget "x", it will select all objects included all invisible objects.

forgive me bad English.

Link to comment
Share on other sites

The undocumented "A" filter will allow you to all entities that aren’t placed in frozen layers.

 

(ssget "_A")

 

 

Regards,

Link to comment
Share on other sites

Thank you for your reply, but if I have already turn off all layer except the entities I need to select by lisp Can you teach me how to do that ?

 

 

 

The undocumented "A" filter will allow you to all entities that aren’t placed in frozen layers.

 

(ssget "_A")

 

 

Regards,

Link to comment
Share on other sites

Try to run the above code on Console - it will return a selection set with all entities stored in layers that are thawed. The on/off status is ignored. To filter out also entities that are stored in layers turned off you may have to parse the selection set and check the state of their layer. To do that, take a look on ENTGET function.

 

Regards,

Link to comment
Share on other sites

Thank you ! I will try.

Try to run the above code on Console - it will return a selection set with all entities stored in layers that are thawed. The on/off status is ignored. To filter out also entities that are stored in layers turned off you may have to parse the selection set and check the state of their layer. To do that, take a look on ENTGET function.

 

Regards,

Link to comment
Share on other sites

Hi all!

 

How can I select every object that is in a specific point?

To be more specific... I have blocks, so they have just one point. And I want to select a block that point is i.e. (0,0) or (x,y).

So how can I do that?

 

Thanks any help

Link to comment
Share on other sites

This will select all block type entities that are inserted in a given point:

 

(ssget "_X" (list '(0 . "INSERT") (cons 10 thePointCoords)))

 

Regards,

Link to comment
Share on other sites

I've tried, but doesnt work...

Always returns NIL.

 

Any help?!

 

Which means that the item you are trying to select does not fit the filter list - you may need to include a tolerance.

 

I'm also getting seriously fed up of your double posts.

Link to comment
Share on other sites

Hi msasu,

 

I try to use (ssget "_a") to select the objects but it will select all objects included objects in others layer which if already off.

Because I just want to select all in current and visible objets. Is there any others method to select it ?

 

Thank you for your help !

 

Try to run the above code on Console - it will return a selection set with all entities stored in layers that are thawed. The on/off status is ignored. To filter out also entities that are stored in layers turned off you may have to parse the selection set and check the state of their layer. To do that, take a look on ENTGET function.

 

Regards,

Link to comment
Share on other sites

As already told you, there is now selection method for SSGET function to filter out automatically entities if off state layers – at least I don’t know one.

The only solution I can suggest to accomplish that is the one that already suggested above – filter out entities in frozen layer by using "_A" method instead of "_X" and after parse the selection set (SSLENGTH & SSNAME), get the layer name for each entity (ENTGET), check the state of that layer (TBLOBJNAME & ENTGET) and remove from selection set (SSDEL) those items that reside in layers that are set off.

 

Regards,

Link to comment
Share on other sites

Thank you so much for your help, I will try to use the above function to get any entities I want.

 

 

As already told you, there is now selection method for SSGET function to filter out automatically entities if off state layers – at least I don’t know one.

The only solution I can suggest to accomplish that is the one that already suggested above – filter out entities in frozen layer by using "_A" method instead of "_X" and after parse the selection set (SSLENGTH & SSNAME), get the layer name for each entity (ENTGET), check the state of that layer (TBLOBJNAME & ENTGET) and remove from selection set (SSDEL) those items that reside in layers that are set off.

 

Regards,

Link to comment
Share on other sites

Hi msasu,

 

I want to select all circle in current layer, is there any method to do that ?

 

(setq sset (ssget "_a" (LIST '(0 . "CIRCLE") (cons 410 (getvar "CTAB")))))

 

Thanks !

 

As already told you, there is now selection method for SSGET function to filter out automatically entities if off state layers – at least I don’t know one.

The only solution I can suggest to accomplish that is the one that already suggested above – filter out entities in frozen layer by using "_A" method instead of "_X" and after parse the selection set (SSLENGTH & SSNAME), get the layer name for each entity (ENTGET), check the state of that layer (TBLOBJNAME & ENTGET) and remove from selection set (SSDEL) those items that reside in layers that are set off.

 

Regards,

Link to comment
Share on other sites

The current layer is stored in CLAYER system variable:

 

(ssget "_A" (LIST '(0 . "CIRCLE")
                  (cons 8 (getvar "CLAYER"))))

 

 

Regards,

Link to comment
Share on other sites

Thank you so much, I can select all objects right now !

 

 

The current layer is stored in CLAYER system variable:

 

(ssget "_A" (LIST '(0 . "CIRCLE")
                  (cons 8 (getvar "CLAYER"))))

 

 

Regards,

Link to comment
Share on other sites

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