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

qselect equivalent script needed

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
632 Views, 3 Replies

qselect equivalent script needed

Hi

 

I need a script to replace the following as I have to use this a lot.

 

this is what I currently do:-

1, qselect

2, apply to : Entire drawing

3, Object type: polyline

4, properties: Length

5, Operation: =Equals

6, value: fixed size (see below)

7, how to apply: Include in new selection set

8, Append to curent selection set is unticked

9, Delete selection set.

 

the above gets run 2 time 1 with value of "444.5" next with "63.5" and next with "442.736" ( last one does not allways retune anything but still needs to be run just in case).

 

can anyone help me out please.

 

Simon

3 REPLIES 3
Message 2 of 4
phanaem
in reply to: Anonymous

Try this.

(defun C:TEST ( / *error* ss d ss1 i e)
  (or
    (setq ss (ssget "_I"))
    (setq ss (ssadd))
    )
  (defun *error* (msg)
    (sssetfirst nil nil)
    (and
      msg
      (not (wcmatch (strcase msg) "*CANCEL*,*QUIT*,*EXIT*"))
      (princ (strcat "\nError: ") msg)
      )
    (sssetfirst nil ss)
    )
  (if
    (setq ss1 (ssget "_X" '((0 . "*POLYLINE"))))
    (while
      (setq d (getdist "\nEnter polyline length: "))
      (sssetfirst nil nil)
      (repeat
        (setq i (sslength ss1))
        (setq i (1- i)
              e (ssname ss1 i)
        )
        (if
          (equal
            (vlax-curve-getdistatparam e
              (vlax-curve-getendparam e)
            )
            d
            1e-5
          )
          (ssadd e ss)
          )
        )
      (sssetfirst nil ss)
      )
    )
  (princ)
  )

 

Message 3 of 4
Anonymous
in reply to: Anonymous

That worked fine thanks for that.

 

Just the one more question.

The only way I have got any LSP file to run todate is to click on "load Application" in Manage ribben tab is there a way to have this auto load on startup so then I only have to type the command when I need it without haveing to load it each time?

 

Thanks again for your time.

Message 4 of 4
Anonymous
in reply to: Anonymous

I have got it working as I need know thanks for your help and time.

Simon

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

Post to forums  

Autodesk Design & Make Report

”Boost