Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Help changing a program

  1. #11
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Default Re: Help changing a program

    Quote Originally Posted by Tharwat View Post
    You are welcome anytime.

    Please try the following and hope it would meet your needs.

    Code:
    (defun c:crtchglay (/ i l n s x c y r d e)
      ;; Tharwat - Date: 08.Mar.2018	;;
      (if
        (and (setq s (ssget "_:L" '((8 . "~*XXX-CHANGED0"))))
             (setq r
                    (getstring
                      "\nSpeficy a number from [1-9] or [01-09] <enter to exit> :"
                    )
             )
             (or (numberp (read r))
                 (progn (princ "\nInvalid input!. Please try again.") nil)
             )
             (setq y (and (= (strlen r) 2) (wcmatch r "0*"))
                   c (acad_colordlg 256)
             )
        )
         (repeat (setq i (sslength s))
           (setq x (ssname s (setq i (1- i)))
                 e (entget x)
                 l (assoc 8 e)
                 n (strcat (cdr l) "_XXX-CHANGED" r)
                 d (list '(290 . 1) (cons 62 c))
                 r (1+ (atoi r))
                 r (if (and y (< r 10))
                     (strcat "0" (itoa r))
                     (itoa r)
                   )
           )
           (if (tblsearch "LAYER" n)
             (entmod (append (entget (tblobjname "LAYER" n)) d))
             (entmake (append (list '(0 . "LAYER")
                                    '(100 . "AcDbSymbolTableRecord")
                                    '(100 . "AcDbLayerTableRecord")
                                    (cons 2 n)
                                    '(70 . 0)
                              )
                              d
                      )
             )
           )
           (entmod (subst (cons 8 n) l e))
         )
      )
      (princ)
    )
    Tharwat,

    This is great, thank you so much.

    Cadd4la

  2. #12
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Help changing a program

    Quote Originally Posted by cadd4la View Post
    Tharwat,

    This is great, thank you so much.

    Cadd4la
    Excellent.

    You are welcome.

  3. #13
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Default Re: Help changing a program

    Quote Originally Posted by Tharwat View Post
    You are welcome anytime.

    Please try the following and hope it would meet your needs.

    Code:
    (defun c:crtchglay (/ i l n s x c y r d e)
      ;; Tharwat - Date: 08.Mar.2018	;;
      (if
        (and (setq s (ssget "_:L" '((8 . "~*XXX-CHANGED0"))))
             (setq r
                    (getstring
                      "\nSpeficy a number from [1-9] or [01-09] <enter to exit> :"
                    )
             )
             (or (numberp (read r))
                 (progn (princ "\nInvalid input!. Please try again.") nil)
             )
             (setq y (and (= (strlen r) 2) (wcmatch r "0*"))
                   c (acad_colordlg 256)
             )
        )
         (repeat (setq i (sslength s))
           (setq x (ssname s (setq i (1- i)))
                 e (entget x)
                 l (assoc 8 e)
                 n (strcat (cdr l) "_XXX-CHANGED" r)
                 d (list '(290 . 1) (cons 62 c))
                 r (1+ (atoi r))
                 r (if (and y (< r 10))
                     (strcat "0" (itoa r))
                     (itoa r)
                   )
           )
           (if (tblsearch "LAYER" n)
             (entmod (append (entget (tblobjname "LAYER" n)) d))
             (entmake (append (list '(0 . "LAYER")
                                    '(100 . "AcDbSymbolTableRecord")
                                    '(100 . "AcDbLayerTableRecord")
                                    (cons 2 n)
                                    '(70 . 0)
                              )
                              d
                      )
             )
           )
           (entmod (subst (cons 8 n) l e))
         )
      )
      (princ)
    )
    After using the program I would like to ask for two changes.

    1. If no color is selected can it use the same color as the layer picked and not "bylayer"
    2. Can you please not have it have each item picked placed on a new layer and have that layer have a new number. I would like it to just add each items picked to be on the same layer and only increase the layer number if I repeat the command. If you can't do that can you not have it place each item on a new layer and add a new number?

    Thanks again for getting it this far.

    Cadd4la

Page 2 of 2 FirstFirst 12

Similar Threads

  1. 2014: Changing an objects Level without changing it's relative place in space?
    By evan549822 in forum Revit MEP - General
    Replies: 2
    Last Post: 2014-08-19, 02:05 PM
  2. Writing a Short program from Large Program
    By avinash00002002 in forum VBA/COM Interop
    Replies: 2
    Last Post: 2006-07-13, 01:26 AM
  3. Changing font without changing Text Style.
    By zoomharis in forum AutoCAD General
    Replies: 7
    Last Post: 2006-03-22, 05:51 PM

Tags for this Thread

Posting Permissions

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