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

Cannot Zoom Out Too Far When Doing Fence-Selection

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
JC_BL
557 Views, 10 Replies

Cannot Zoom Out Too Far When Doing Fence-Selection

I am having a problem with using fence-selection.  If I zoom-out so far that I cannot see the color of the line that I use for fence-selection, I find that fence-selection cannot select the objects.  If I zoom-in just a little bit to start seeing the color of the line, I find that fence-selection can select the objects.

 

This seems to suggest that zooming-in to the drawing is a workaround.  Unfortunately this creates another problem.  Let say the drawing has multiple lines for fence-selection, and the lines are in different areas of the drawing.  If I zoom-in enough to see some lines, I find that some other lines will be scrolled outside the screen.  When I try to do fence-selection, the lines scrolled outside the screen will not be able to select any object.

 

This means if I zoom-out, some lines become too small and invisible and will not select any object.  On the other hand, if I zoom-in, some lines get scrolled out and they will not select any object either.  This is the dilemma.

 

How can I tell AutoCAD to select objects using fence selection even when the fence line is too small and inivisble when I zoom out?

How can I tell AutoCAD to select objects using fence selection even when the fence line has been scrolled outside the screen?

 

Please help.  Thanks in advance.

 

Jay Chan

Tags (2)
10 REPLIES 10
Message 2 of 11
JC_BL
in reply to: JC_BL

There was one correction to my original message.  Contrary to what I said, I still can select some object using fence selection even though I have zoomed out.  The problem is that not all the objects are selected.  Let say the line crosses one piece of duct and also its piece number tag.  The fence-selection can select the piece of duct but not its piece number tag if I zoom out.  On the other hand, if I zoom-in just a bit, the fence-selection can select both the piece of duct and its piece number tag.

 

Further investigation finds that whether the fence-selection-line is visible or not doesn't affect the outcome.  I have increased the line weight of the fence-selection-line to the point that I can still see the line when I zoom out, and I still have the problem.  Therefore, the problem has to do with zooming out, not have to do with whether the line is visible or not.

 

Attached please find a drawing that shows this problem.  The drawing has some objects in its 4 corners.  In the lower left corner, there is a blue heavy line crossed over the piece number tag of a piece of duct.  I expect fence-selection should be able to select both the piece number tag and the piece of duct because the line touches both.  But I find that when I zoom out far enough, the fence-selection can only select the piece of duct, but not its piece number tag.

 

Attached please also find a LISP program called (Test_Fence_Select) that finds polylines already on the drawing, and then uses fence select to select objects on the drawing using the polylines.  Finally, it shows the number of objects that it has found.  If we zoom in close enough to the drawing, we should see the program can select 2 objects (the duct body and its piece number tag).  If we zoom out far enough, we should see the program can select only 1 object (the duct body) and it fails to select the piece number tag.

 

The drawing was drawn using a third party software.  But the problem is there regardless if I load or unload that third party software.

 

Please help.  Thanks.

 

Jay Chan

Message 3 of 11
hmsilva
in reply to: JC_BL

Hi Jay

did you try to set '2D Wireframe' Visual Style first, and then run your 'Test_Fence_Select' routine...

On this side, I get "Total non-polylines are selected by fence-select: 3", the polyline is also selected.

HTH
Henrique

EESignature

Message 4 of 11
marko_ribar
in reply to: hmsilva

Maybe this lisp can help...

 

(defun c:selfence ( / p pl pp zp ss )
  (setq p (getpoint "\nPick or specify start point : "))
  (setq pl (cons p pl))
  (setq pp p)
  (while (and
           (not 
            (initget 128)
           )
            (if (or (listp pp) (not (or (wcmatch pp "C*") (wcmatch pp "c*"))))
              (setq pp (getpoint pp "\nPick or specify next point <Exit> (\"C\" - Close) : "))
              (setq pp nil)
            )
         )
         (cond
           ( (listp pp)
             (setq pl (cons pp pl))
           )
           ( (or (wcmatch pp "C*") (wcmatch pp "c*"))
             (setq pl (cons p pl))
           )
         )
         (mapcar '(lambda ( a b ) (grdraw a b 1 1)) pl (cdr pl))
  )
  (setq zp (acet-geom-list-extents pl))
  (command "_.zoom" "_w" (car zp) (cadr zp))
  (setq ss (ssget "_F" pl))
  (sssetfirst nil ss)
  (princ)
)

 M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
Message 5 of 11
JC_BL
in reply to: hmsilva

Yes, setting Visual-Style to 2D-wireframe can workaround this problem.  Do you know why the visual-style can make such a difference?  I am trying to understand this to know if this is just a "workaround" or is really a "fix".

 

Please let me know.  Thanks.

 

Attached please find the new version of the program that has the workaround.  It also works around the problem of not correctly excluding polylines from the selection-set (now it filters by entity handle instead of entity name).  Now, it should only show 2 objects selected, instead of 1 or 3.

 

Jay Chan

Message 6 of 11
JC_BL
in reply to: marko_ribar

Thanks for replying. Seem like the trick is to zoom-in to the area of each fence-selection before we start fence-selection. Let me see if I can incorporate this technique to my program.

Jay Chan
Message 7 of 11
hmsilva
in reply to: JC_BL


@jchan wrote:

Yes, setting Visual-Style to 2D-wireframe can workaround this problem.  Do you know why the visual-style can make such a difference?  I am trying to understand this to know if this is just a "workaround" or is really a "fix".

 

Please let me know.  Thanks.

 

Attached please find the new version of the program that has the workaround.  It also works around the problem of not correctly excluding polylines from the selection-set (now it filters by entity handle instead of entity name).  Now, it should only show 2 objects selected, instead of 1 or 3.


Hi Jay Chan,

 

to use one of the graphical selection methods, we need to ensure that entities are visible on the screen, and using visual styles sometimes the result is not the desired one.

"now it filters by entity handle instead of entity name"

To filter by entity name, change

(/= entnameEntFS entnamePL)
to
(not (eq entnameEntFS entnamePL))

 

HTH

Henrique

 

 

 

EESignature

Message 8 of 11
JC_BL
in reply to: marko_ribar

Hi, Marko Ribar.  Thanks for showing me your script.  This points me to the right direction.  The trick is to zoom into the area where the polyline is before I use the polyline to do fence-selection. I have incorporated that technique in my program and it works fine now.

 

Attached please find the updated test program that shows the way to use this technique to zoom into the polyline before using it to do fence-selection.  The updated test program also incorporates the correct way to compare two entity names to see if they are equal or not that another forum member "hmsilva" has pointed out.

 

Thanks for the many helpful info that I have received here.

 

Jay Chan

Message 9 of 11
JC_BL
in reply to: hmsilva

Thanks for the correction. I have tried the correct way of comparing two entity names. And you are right.

I have decided not to change the visual style to fix this problem because I don't fully understand why this technique works. I have decided to zoom into a polyline before I use it to do fence-selection. Thanks anyway.
Message 10 of 11
hmsilva
in reply to: JC_BL


@jchan wrote:
Thanks for the correction. I have tried the correct way of comparing two entity names. And you are right.

I have decided not to change the visual style to fix this problem because I don't fully understand why this technique works. I have decided to zoom into a polyline before I use it to do fence-selection. Thanks anyway.

You're welcome, Jay Chan.

 

Henrique

EESignature

Message 11 of 11
JC_BL
in reply to: JC_BL

I have updated the test program.  I have done this just in case someone wants to copy the code from the test program.  I would like that person gets the corrected version.

 

The corrections are:

  • The previous version used a separated routine to prepare a list of XY coordinates of a polyline.  Turns out the list of XY coordinates has already been done (in the list called vertexPL).  Therefore, I ask the program to use the list vertexPL instead.
  • The fence-selection won't work if the last XY coordinates repeats itself, such as ((11.1 22.2) (3.3 44.4) (3.3 44.4)).  I am not sure why the last XY coordinate can repeat itself.  May be the user double clicked at he last point when he drew the polyline -- not sure.  Anyway, I have changed the program to ask it to skip XY coordinate that is redundant before using the list of XY coordinates for fence-selection

 

Jay Chan

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

Post to forums  

Autodesk Design & Make Report

”Boost