+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 24
  1. #1
    Full Member
    Using
    AutoCAD 2010
    Join Date
    Mar 2012
    Posts
    37

    Laughing Creating multiple Selection sets

    Registered forum members do not see this ad.

    Please bear with me, I'm still really green on this.

    I'm trying to create a selection set that will choose only text and mtext. However it doesn't seem to be working for me. Is this correct?

    Code:
    setq Tchg (ssget '((-4 . "<AND")(0 . "MTEXT")(0 . "TEXT")))
    This is the complete code I've written, it's meant to just change text sizes that are selected, sort of a dummied down match prop command, as THAT particular command can sometimes do TOO much.

    Code:
    (defun c:tchg ()
      (setq CMD-ECHO (getvar "cmdecho"))
      (setvar "cmdecho" 0)
      (defun GetText ()
        (setq en1 (car (entsel "\nChoose text entity to match with: ")))
        (setq OLDENT (entget en1))
        (setq ENTCHANGE (assoc 40 OLDENT))
        (setq ENTCHANGE (cdr ENTCHANGE))
      )
    
      ;;End get text
    
      (defun GetChange ()
        (prompt "\nSelect all text entities you wish to change: ")
        (setq Tchg (ssget '((-4 . "<AND")(0 . "MTEXT")(0 . "TEXT")))
        )
      )
      (GetText)
    					;(GetSize)
      (GetChange)
      (repeat (setq n (sslength Tchg))
        (setq chg (ssname tchg (setq n (1- n))))
        (setq Tval (cdr (assoc 40 (setq ts (entget chg)))))
        (entmod (subst (cons 40 entchange) (assoc 40 ts) ts))
      )
      (setvar "cmdecho" CMD-ECHO)
    )
    Later at some point I might try to get it to include multileaders too, but I'll start with the simple stuff first.

    Silvercloak

  2. #2
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,007

    Default

    You forgot to close the logical construction:

    Code:
    (ssget '((-4 . "<OR") (0 . "MTEXT")(0 . "TEXT") (-4 . "OR>")))
    But you may simplify that as:

    Code:
    (ssget '((0 . "MTEXT,TEXT")))
    Regards,
    Mircea
    Last edited by MSasu; 29th Mar 2012 at 01:02 pm. Reason: code fixed

  3. #3
    Full Member
    Using
    AutoCAD 2010
    Join Date
    Mar 2012
    Posts
    37

    Default

    Thank you, THAT was something they failed to teach me in class. Excellent.

  4. #4
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,007

    Default

    You're welcome!

    Regards,
    Mircea

  5. #5
    Full Member
    Using
    AutoCAD 2010
    Join Date
    Mar 2012
    Posts
    37

    Default

    One other question that just occured to me. Is it possible to tell it to select by using either pick point OR crossing window or Window?

    Silvercloak

  6. #6
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,007

    Default

    Please check the help of SSGET function for available selection methods and combinations; also for filters with wild-characters check the WCMATCH function.

    Regards,
    Mircea

  7. #7
    Full Member
    Using
    AutoCAD 2010
    Join Date
    Mar 2012
    Posts
    37

    Default

    Quote Originally Posted by msasu View Post
    Please check the help of SSGET function for available selection methods and combinations; also for filters with wild-characters check the WCMATCH function.

    Regards,
    Mircea
    Thank you, I read through that, but I'm still confused. Shouldn't this
    Code:
    (setq Tchg (ssget "w"'((0 . "MTEXT, TEXT")))
    allow the user to create a window and select only text and mtext?

    Silvercloak

  8. #8
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,007

    Default

    You should supply the points:

    Code:
    (if (and (setq point1st (getpoint "\First corner: "))
             (setq point2nd (getcorner point1st "\nOther corner: ")))
     (ssget "_W" point1st point2nd '((0 . "MTEXT, TEXT")))
    )
    Regards,
    Mircea

  9. #9
    Full Member
    Using
    AutoCAD 2010
    Join Date
    Mar 2012
    Posts
    37

    Default

    Quote Originally Posted by msasu View Post
    You should supply the points:

    Code:
    (if (and (setq point1st (getpoint "\First corner: ")
                   point2nd (getcorner point1st "\nOther corner: ")))
     (ssget "_W" point1st point2nd '((0 . "MTEXT, TEXT")))
    )
    Regards,
    Mircea
    Thanks, I was kind of hoping that by leaving it without points, it would allow the user to click on either a point or blank space and then proceed with a crossing window or regular window. I'm discovering that AutoLISP is far less intuitive than I had hoped.

    Silvercloak

  10. #10
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,007

    Default

    Registered forum members do not see this ad.

    If will call the function without a method - you may supply filter(s) or not - then the user will be allowed to use any of AutoCAD's standard selections method (i.e. pick, window, crossing, fence).
    I suggest you to follow some of the many tutorials available on SSGET function.

    Regards,
    Mircea

Similar Threads

  1. Selection sets in vb.net
    By Jozi68 in forum .NET, ObjectARX & VBA
    Replies: 8
    Last Post: 14th Feb 2012, 07:33 pm
  2. selection sets in multiple drawings
    By salman in forum AutoLISP, Visual LISP & DCL
    Replies: 9
    Last Post: 15th Jun 2011, 02:32 pm
  3. VBA - Selection Sets
    By -KarL- in forum AutoLISP, Visual LISP & DCL
    Replies: 17
    Last Post: 3rd Mar 2009, 10:54 am
  4. Little help on selection sets please
    By Galingula in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 17th Apr 2006, 03:39 pm
  5. selection sets..........
    By rajanikrishna in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 14th Nov 2005, 11:32 am

Bookmarks

Posting Permissions

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