Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why Selection-Set Selects More Than Expected?

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
Anonymous
376 Views, 5 Replies

Why Selection-Set Selects More Than Expected?

I have a lisp program that is supposed to use a filter to select everything on the current tab except for 2 object-types.  Then the program deletes those in the selection-set.  The idea is to trim the drawing of all those irrelevant objects in every tab (Model tab and all layout tabs).  Somehow, it still selects the object-types that I don't want it to select. The consequence is that it deletes more than what I have expected.

 

Below is the code that I use to trim unwanted objects from each tab. I run the code on each tab - one tab at a time:

 

(command "_PSPACE")
(setq ssJunk nil)
(setq ssJunk
   (ssget "_X"
      (list
         (cons -4 "<and")
            (cons 410 (getvar "CTAB"))
            (cons -4 "<not")
               (cons 0 "Viewport,ACAD_PROXY_ENTITY")
            (cons -4 "not>")
         (cons -4 "and>")
      )
   )
)
(if ssJunk
   (command "erase" ssJunk "")
)

 

The idea of the above code is to select everything on the current layout tab that are not viewports and are not proxy-entity.  And then delete all those selected objects.  The proxy entities actually are objects from a third party software.  Because most people don't have that third party software, thpse objects from that third party software are being shown as proxy entities.

 

Strangely the above code works fine with most of the drawings.  The only exception is that one that I have attached in this email.  When I run that code in any one of the Layout Tab, it deletes EVERYTHING from the layout tab (specifically the proxy entities that I want to keep).  I am not sure if the code has a problem, or the drawing itself has some special situation that the code is not ready to deal with.  So far, I cannot figure this out. Would you please help me with this?

 

Thanks.

 

Jay Chan

Tags (2)
5 REPLIES 5
Message 2 of 6
hmsilva
in reply to: Anonymous

Hi Jay,

 

your ssget filter, works as expected...

 

Your test dwg, don't have any "ACAD_PROXY_ENTITY" in paper space, only in model...

 

Henrique

EESignature

Message 3 of 6
Anonymous
in reply to: hmsilva

Thanks for replying, and sorry for the delay in returning your message.

 

May be I don't understand how the ssget-filter works in PSPACE of a layout tab. If I am in the PSPACE of a layout tab of my test drawing, and then I run ssget with the filter to filter out viewports and ACAD_PROXY_ENTITY, I should not be able to select the viewport (ID=3) that the proxy-entities are on, right? Then if the viewport is not selected, everything inside the viewport should not be selected and deleted, right? Somehow, the ssget-filter doesn't work the way I have expected. It not only selects and deletes all those proxy entities inside viewport-3, but also selects and deletes viewport-3. This is totally oppositive to what I have expected.

 

On the other hand, if I run the ssget-filter in MSPACE of viewport-3, it works as what I have expected - meaning that it doesn't select or delete the proxy entities nor the viewport.

 

Seem like I really don't understand how the ssget-filter works differently in PSPACE as comparing to having it run in MSPACE.

 

Would you please tell me why the ssget-filter doesn't work in PSPACE in the way that I have expected? Thanks.

 

Jay Chan

Message 4 of 6
hmsilva
in reply to: Anonymous

Jay,

 

as I said in my previous post, your filter works as expected, on my end, and with AC2010/2012/2014.

The ssget function, don't select any VIEWPORT nor ACAD_PROXY_ENTITY.

 

Attached is txt file with the entities selected by ssget function...

 

Henrique

EESignature

Message 5 of 6
Anonymous
in reply to: hmsilva

I believe I misunderstood what you said in your first reply.

 

Based on the objects listed in your attached text file, your result is exactly the same as mine.  Yours has 1024 objects, mine is the same number.  Actually the types of objects in your selection result are also identical to mine.  We are in the same page.

 

I have a feeling that when a ssget-filter tries to select something in PSPACE, it treats the proxy entites shown on PSPACE as basic elements such as line/arc/circle/text, and not treat them as proxy entites.  That's probably the reason why the ssget-filter selects the proxy entities because it actually selects the individual parts of each proxy entity.

 

Seem like the ssget-filter works fine in other drawings because the viewports in the layout tabs in those other drawings were drawn different from this one drawing.  Those viewports were drawn using a tool from the third party software, and this somehow "protects" them from being selected.  In any case, this means I cannot use the ssget-filter to remove irrelevent objects from layout tabs.  For now, I will have to stop removing irrelevant objects from layout tabs, and only remove irrelevant objects from Model tab.  This should be "good enough" for now.

 

Thanks for showing the ssget-filter result in your computer.  This helps me to narrow down the problem.

 

Jay Chan

Message 6 of 6
hmsilva
in reply to: Anonymous

You're welcome, Jay Chan.
Glad you have it sorted!

 

EDIT: One way to escape from erase the VIEWPORT, is prior to run the ssget, lock the BON-Section-View layer, run the ssget and erase, unlock the layer...

Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Autodesk Design & Make Report