Code Red > AutoLISP (Vanilla / Visual)

Help with a lisp related to Quick Select.

(1/2) > >>

sixt33n:
Hi!

I would like to ask for help on two lisps. I think that it is probably just a few lines of code. I've tried looking for it but couldn't find it.

First: What I would like to do is basically run a lisp that would filter out from a selection of objects by layer. That is it. Basically it is the same function as using Quick Select with "Include in new selection set." I have to do this numerous times so using quick select is getting tiring. I intend to bind the command to custom icons in a tool bar so that I can just click on that icon and it will select the layer desired.

Second. Lisp to use Quick Select to find lines shorter than a specific length from a selection set. Sometimes, I have to explode 3d objects into 2d lines then flatten only to find out incredibly short lines hiding (<0.05") underneath longer lines. Although I would only like to see where they are so I could assess if they really need to be deleted or not.

Thank you very much in advance!

sixt33n






Lee Mac:
For the second -


--- Code - Auto/Visual Lisp: ---(defun c:selbylen ( / e i l s )     (setq l 0.05)     (if        (setq s            (ssget "_X"               (list                   '(0 . "ARC,CIRCLE,ELLIPSE,LINE,*POLYLINE,SPLINE")                   '(-4 . "<NOT")                       '(-4 . "<AND")                           '(0 . "POLYLINE") '(-4 . "&") '(70 . 80)                       '(-4 . "AND>")                   '(-4 . "NOT>")                    (if (= 1 (getvar 'cvport))                        (cons 410 (getvar 'ctab))                       '(410 . "Model")                    )                )            )        )        (repeat (setq i (sslength s))            (setq i (1- i)                  e (ssname s i)            )            (if (< l (vlax-curve-getdistatparam e (vlax-curve-getendparam e)))                (ssdel e s)            )        )    )    (sssetfirst nil s)    (princ))(vl-load-com) (princ)
Re the first: I'm not sure what you mean by "filter out from a selection of objects by layer"

tombu:
For items on a particular layer would GETSEL or SSX be enough?

Lots of Select Similar routines out there
http://forums.augi.com/showthread.php?66329-Selectsimilar-with-a-defined-area&p=815679&viewfull=1#post815679
or
http://mistressofthedorkness.blogspot.com/2006/07/i-know-how-to-pick-em-selectsimilar.html

sixt33n:
Thanks for the help Lee Mac. I didn't realize the code was going to be this long. I tried the lisp you had created. It does select the lines shorter than 0.05" however,  Is there a way to show pickboxes of the objects that end up in the new selection set? Similar to using quick select on a selection > line less than 0.05" would? There are occasions where I have to assess whether or not the lines can be deleted or not. From a zoomed out view, I cant really see where the lines are since the pickboxes do not show.

On the first lisp regarding layers, it would be identical with using Quick Select on a selection with the following options:

Apply to: Current selection
Object type: Multiple
Properties: Layer
Operator: =Equals
Value: 0
How to apply: Include in new selection set
Append to current selection set: Not checked.

Then hitting ok. It creates a new selection set with only objects from layer 0 and display pickboxes.

Hopefully its clear enough.

Thank you again!

Lee Mac:

--- Quote from: sixt33n on March 22, 2019, 06:44:05 PM ---I tried the lisp you had created. It does select the lines shorter than 0.05" however,  Is there a way to show pickboxes of the objects that end up in the new selection set? Similar to using quick select on a selection > line less than 0.05" would?
--- End quote ---

The display of grips is determined by the number of objects in the selection being fewer than the GRIPOBJLIMIT system variable. Note that the posted code selects any curve object with length less than the defined figure (set to 0.05 in my code) - this includes ARCs, CIRCLEs, ELLIPSEs, LINEs, LWPOLYLINEs, 2D POLYLINEs, & SPLINEs.


--- Quote from: sixt33n on March 22, 2019, 06:44:05 PM ---On the first lisp regarding layers, it would be identical with using Quick Select on a selection with the following options:

Apply to: Current selection
Object type: Multiple
Properties: Layer
Operator: =Equals
Value: 0
How to apply: Include in new selection set
Append to current selection set: Not checked.
--- End quote ---

Try this:

--- Code - Auto/Visual Lisp: ---(defun c:l0 ( )    (sssetfirst nil (ssget "_I" '((8 . "0"))))    (princ))

Navigation

[0] Message Index

[#] Next page

Go to full version