+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 29
  1. #1
    Senior Member
    Using
    AutoCAD 2009
    Join Date
    Jul 2009
    Posts
    259

    Default a lisp to apply 3 different lisp to 3 obj types filtered from one selection

    Registered forum members do not see this ad.

    Hi Everyone:

    I think I can surprise many people with this final task I am willing to develop somehow...

    I want to Make a lisp to allow me to select an entire detail or plan view... then this lisp must split the selection for 3 different object type groups: Dimensions & leaders, text (and if possible mtext), and blocks...

    And then the lisp will aply 1 command or lisp to each one of those 3 selection groups...
    This is to standarize a Detail or plan according to our standard text, dimension and block sizes... I will try to take care of this part...

    But I dont know how to split the selection into 3 selection sets...
    Any help will be appreciated..

  2. #2
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2011
    Join Date
    Apr 2008
    Posts
    6,015

    Default

    Quote Originally Posted by gilsoto13 View Post
    Hi Everyone:

    I think I can surprise many people with this final task I am willing to develop somehow...

    I want to Make a lisp to allow me to select an entire detail or plan view... then this lisp must split the selection for 3 different object type groups: Dimensions & leaders, text (and if possible mtext), and blocks...

    And then the lisp will aply 1 command or lisp to each one of those 3 selection groups...
    This is to standarize a Detail or plan according to our standard text, dimension and block sizes... I will try to take care of this part...

    But I dont know how to split the selection into 3 selection sets...
    Any help will be appreciated..
    Once you've made the selection, just iterate through them applying procedure A, B or C based on object type. (assoc 0 or (vla-get-objectname using cond.
    DropBox | finding the light...
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  3. #3
    Senior Member
    Using
    AutoCAD 2009
    Join Date
    Jul 2009
    Posts
    259

    Default

    Quote Originally Posted by alanjt View Post
    Once you've made the selection, just iterate through them applying procedure A, B or C based on object type. (assoc 0 or (vla-get-objectname using cond.
    Ok, I found this made by you... I am gonna start from here..
    Code:
     
    ;text & leader delete
    ;only selects text, mtext & leaders to erase
    ;created: alan thompson - 4.17.08
    (defun c:TX (/ ss)
      (prompt "\nSelect text & leaders to erase: ")
      (setq ss (ssget '((0 . "TEXT,MTEXT,LEADER"))))
    (if ss
      (progn
        (command "erase" ss "" )
        (princ (strcat "\n " (rtos (sslength ss)) " Text and/or Leader objects have been deleted."))
      );progn
      (princ "\nNo text selected, try again.")
    );if
      (princ)
    )
    Then, How can I add 3 different selection groups with a specified assigned abbreviation, and run a specified command or function to each selection group at once?... I tried to just write something but I guess I gotta keep reading..

    Code:
     
    ;Detail updater to current scale
    ;tried to be written: Paulo Gil .. today
    (defun c:UD (/ ss ss2 ss3)
      (prompt "\nSelect a whole detail to update: ")
      (setq ss (ssget '((0 . "TEXT,MTEXT"))))
      (setq ss2 (ssget '((0 . "INSERT"))))
      (setq ss3 (ssget '((0 . "DIMENSION,LEADER"))))
    (if ss
      (progn
        (command "_.chprop" ss "color" "blue" "")
      );progn
      (princ "\nNothing selected, try again.")
    );if
    (if ss2
      (progn
        (command "_.chprop" ss2 "layer" "Patt" "")
      );progn
      (princ "\nNothing selected, try again.")
    );if
    (if ss3
      (progn
        (command "_.chprop" ss3 "layer" "Dims" "")
      );progn
      (princ "\nNothing selected, try again.")
    );if
      (princ)
    )
    Last edited by gilsoto13; 20th Oct 2009 at 06:31 pm.

  4. #4
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2011
    Join Date
    Apr 2008
    Posts
    6,015

    Default

    Just make one large selection set, then iterate through the list using cond and if it "MTEXT" matches (cdr (assoc 0 (entget e)))), then change the color.

    BTW, I obviously don't mind you using my code, but please remove my name from anything that I did not write.

    Code:
    ;Detail updater to current scale
    ;created: alan thompson - 4.17.08
    (defun c:UD (/ ss ss2 ss3)
    DropBox | finding the light...
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  5. #5
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2011
    Join Date
    Apr 2008
    Posts
    6,015

    Default

    Give this a try, untested and in vla, because I'm lazy...
    Code:
    (defun c:UD (/ #SS)
      (vl-load-com)
      (cond
        ((setq #SS (ssget ":L" '((0 . "MTEXT,TEXT,INSERT,DIMENSION,LEADER"))))
         (vlax-for x (setq
                       #SS (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)))
                     ) ;_ setq
           (cond
             ;; text, mtext
             ((vl-position (vla-get-objectname x) (list "AcDbMText" "AcDbText")) (vla-put-color x 5))
             ;; blocks
             ((eq (vla-get-objectname x) "AcDbBlockReference")
              (vl-catch-all-apply 'vla-put-layer (list x "Patt"))
             )
             ;; dimension, leader
             ((wcmatch (vla-get-objectname x) "*Leader*,*Dimension*")
              (vl-catch-all-apply 'vla-put-layer (list x "Dims"))
             )
           ) ;_ cond
         ) ;_ vlax-for
         (vl-catch-all-apply 'vla-delete (list #SS))
        )
      ) ;_ cond
    ) ;_ defun
    DropBox | finding the light...
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  6. #6
    Senior Member
    Computer Details
    JohnM's Computer Details
    Operating System:
    xp pro
    Using
    AutoCAD 2006
    Join Date
    Feb 2009
    Location
    houston, texas
    Posts
    380

    Default

    Do you think it would be easer to window the objects the list the windows corner points
    The jus pass it to the 3 ssget functions?

  7. #7
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2011
    Join Date
    Apr 2008
    Posts
    6,015

    Default

    Quote Originally Posted by JohnM View Post
    Do you think it would be easer to window the objects the list the windows corner points
    The jus pass it to the 3 ssget functions?
    Why go though all that trouble, when you can just iterate through it and change objects based on object type.
    DropBox | finding the light...
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  8. #8
    Senior Member
    Using
    AutoCAD 2009
    Join Date
    Jul 2009
    Posts
    259

    Default

    I haven“t checked it out either... but I guess this is what I wanted, the correct order for three different selection sets and only one lisp... Now I guess I can use the
    (vl-cmdf "_.any command")
    on these "lists"

    I actually want to use this new lisp for 2 different purposes... one is for a "Detail scale updater"... and the other will be the "mask all"

    So, in the "Detail Scale updater" when you select a bunch of objects the lisp will apply

    1 lisp function to filtered blocks...
    1 lisp function to Text, Mtext
    1 command (Dim--Update) to Dimensions and leaders

    The "mask all" will apply
    1 Command to Dtext (textmask)
    1 lisp function to Mtext (yours, jejeje)
    1 lisp or vlx to Dimensions

    This is what I am trying to do... but there's no hurry for this... i'll try to go step by step.

    I am still working hard everyday to finish the blocks collection.. I finished extracting all collections... The next step is just merging all the blocks into their respective dwgs for compilation.

    I am using a Batch dxf to dwg successfully, and I will try a batch PDF to DWG today afternoon for some construction details that were available only in pdf format.





    (vl-catch-all-apply 'vla-put-layer (list x "Patt"))
    Quote Originally Posted by alanjt View Post
    Give this a try, untested and in vla, because I'm lazy...
    Code:
    (defun c:UD (/ #SS)
      (vl-load-com)
      (cond
        ((setq #SS (ssget ":L" '((0 . "MTEXT,TEXT,INSERT,DIMENSION,LEADER"))))
         (vlax-for x (setq
                       #SS (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)))
                     ) ;_ setq
           (cond
             ;; text, mtext
             ((vl-position (vla-get-objectname x) (list "AcDbMText" "AcDbText")) (vla-put-color x 5))
             ;; blocks
             ((eq (vla-get-objectname x) "AcDbBlockReference")
              (vl-catch-all-apply 'vla-put-layer (list x "Patt"))
             )
             ;; dimension, leader
             ((wcmatch (vla-get-objectname x) "*Leader*,*Dimension*")
              (vl-catch-all-apply 'vla-put-layer (list x "Dims"))
             )
           ) ;_ cond
         ) ;_ vlax-for
         (vl-catch-all-apply 'vla-delete (list #SS))
        )
      ) ;_ cond
    ) ;_ defun

  9. #9
    Forum Newbie
    Using
    AutoCAD 2010
    Join Date
    Aug 2009
    Posts
    8

    Default

    nice one!.but how can i apply those lisp in my autocad!..i dont know how to put it.i mean the codes..where can i put it!..help me guys..im just a newbies in field of autocad and i hope i can learn a lot from!..thanks and god bless!

  10. #10
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2011
    Join Date
    Apr 2008
    Posts
    6,015

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by mark_acadd View Post
    nice one!.but how can i apply those lisp in my autocad!..i dont know how to put it.i mean the codes..where can i put it!..help me guys..im just a newbies in field of autocad and i hope i can learn a lot from!..thanks and god bless!
    Well, without any additional information, just change object types, layer names, colors, etc. to what you want.

    Give some parameters and we can make something work.
    DropBox | finding the light...
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

Similar Threads

  1. lisp: no items in selection
    By markschu in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 2nd Jul 2009, 01:11 pm
  2. Custom block selection lisp
    By sakinen in forum AutoLISP, Visual LISP & DCL
    Replies: 12
    Last Post: 26th Jun 2009, 07:38 pm
  3. my lisp stops when selection set = 0
    By vladthedog in forum AutoLISP, Visual LISP & DCL
    Replies: 8
    Last Post: 4th Apr 2009, 11:32 am
  4. turn off filtered layers
    By michaeloureiro in forum AutoCAD General
    Replies: 3
    Last Post: 9th Feb 2009, 01:00 pm
  5. v 2004 Apply a default response to an existing lisp
    By ajs in forum AutoLISP, Visual LISP & DCL
    Replies: 11
    Last Post: 7th Nov 2007, 03:00 pm

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