See the top rated post in this thread. Click here

Results 1 to 4 of 4

Thread: Select the numbers in particular user input range (Please see attachment)

  1. #1
    Login to Give a bone
    0

    Default Select the numbers in particular user input range (Please see attachment)

    Hi Experts,

    Can you please help me out from this problem?

    I have a lot of text with different text values. I need to select the text in between user defined range like below

    The lisp should ask as below
    "Please enter Min range value = " (Suppose user gives 2.5)
    "Pleasea enter Max range value= " (Suppose user gives 8.1)

    Then from user selection window, only the text, which are in between 2.5 and 8.1 should be selected, and remaining shall be unselected from user selection.

    The lisp also should consider even the numbers have alphabets in both prefix and suffix.

    Please have a look on attached dwg and jpeg. (I have marked yellow color circles, where texts have alphabets).

    Thanks a lot, in advance.Number Selection.dwgRange Selection.JPG

  2. #2
    Member
    Join Date
    2001-03
    Location
    ROMANIA
    Posts
    35
    Login to Give a bone
    1

    Default Re: Select the numbers in particular user input range (Please see attachment)

    Try this:
    Code:
    (defun C:XbetweenAandB (/ $ent $num $str $val a b i n pickset string ss)
     (setq ss (ssget (quote ((0 . "TEXT")))))
     (if ss
      (progn
       (initget 1)
       (setq a (getreal "\nMin range value: "))
       (if a
        (progn
         (initget 1)
         (setq b (getreal "\nMax range value: "))
         (if (and b (< a b))
          (progn
           (setq n 0
              pickset (ssadd)
           )
           (while (< n (sslength ss))
            (setq  $ent (ssname ss n)
                $val (cdr (assoc 1 (entget $ent)))
            )
            (if (setq $num (distof $val))
             (if (< a $num b) (ssadd $ent pickset))
             (progn
              (setq i 1 string "")
              (while (<= i (strlen $val))
               (if (vl-position (setq $str (substr $val i 1)) (quote ("0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "0" "." "-")))
                (setq string (strcat string $str))
               )
               (setq i (1+ i))
              )
              (if (and (setq $num (distof string)) (< a $num b)) (ssadd $ent pickset))
             )
            )
            (setq n (1+ n))
           )
           (if pickset (sssetfirst nil pickset)) ;;Light the grips
    ;;Do what you want here on pickset
           (setq pickset nil)
          )
         )
        )
       )
       (setq ss nil)
      )
     )
     (princ)
    ) ;;C:XbetweenAandB

  3. #3
    Login to Give a bone
    0

    Default Re: Select the numbers in particular user input range (Please see attachment)

    Excellent Sir, Working Fine. Thanks a lot.

  4. #4
    Member
    Join Date
    2001-03
    Location
    ROMANIA
    Posts
    35
    Login to Give a bone
    0

    Default Re: Select the numbers in particular user input range (Please see attachment)

    Quote Originally Posted by brahmanandam.thadikonda762224 View Post
    Excellent Sir, Working Fine. Thanks a lot.
    Glad to help you.

Similar Threads

  1. Replies: 2
    Last Post: 2018-10-04, 11:44 AM
  2. 2015: I can't select a particular wall
    By woodybryant682730 in forum Revit Architecture - General
    Replies: 2
    Last Post: 2016-01-20, 08:32 PM
  3. Replies: 3
    Last Post: 2007-05-22, 09:19 PM
  4. Replies: 5
    Last Post: 2006-12-11, 09:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •