Need a few solution

Discussion in 'AutoCAD' started by Adesu, Feb 18, 2005.

  1. Adesu

    Adesu Guest

    I need a few solution for this script,I'm not find where it wrong,any body
    care?,thanks

    ; clf is stand for create layer with fast
    ; Design by Ade Suharna <>
    ; 17 February 2005
    ; Program no.
    ; Edit by
    (defun c:clf (/ cnt n nlay)
    (setq cnt 1)
    (setq n (fix (getreal "\nHOW MANY LAYER YOU WOULD CREATE: ")))
    (repeat n
    (cond ((and (= cnt 1)(> cnt n))
    (progn
    (setq nlay cnt)
    (command "_layer" "n" nlay "")
    ) ; end of progn
    )
    ) ; end of cond
    (setq cnt (1+ cnt))
    ) ; end of repeat
    (princ)
    )
     
    Adesu, Feb 18, 2005
    #1
  2. Adesu

    Adesu Guest

    Hi Walt,thanks for your advice,here I've got

    ; clf is stand for create layer with fast
    ; Design by Ade Suharna <>
    ; 17 February 2005
    ; Program no.
    ; Edit by
    (defun c:clf (/ cnt n nlay)
    (setq cnt 1)
    (setq n (fix (getreal "\nHOW MANY LAYER YOU WOULD CREATE: ")))
    (repeat n
    (cond ((and (>= cnt 1)(< cnt n))
    (progn
    (setq nlay cnt)
    (command "_layer" "n" nlay "")
    ) ; end of progn
    )
    ) ; end of cond
    (setq cnt (1+ cnt))
    ) ; end of repeat
    (princ)
    )
     
    Adesu, Feb 18, 2005
    #2
  3. Adesu

    craig gorham Guest

    change your line (command "_layer" "n" nlay "")
    to (command "_layer" "n" (itoa nlay) "")

    itoa is for integer to assci (number to string)
     
    craig gorham, Feb 18, 2005
    #3
  4. Adesu

    Adesu Guest

    Hi craig,it's "OK" too,thanks

     
    Adesu, Feb 18, 2005
    #4
  5. Adesu

    Adesu Guest

    I've still got problem to change of color,how to correct it,thanks.

    ; cls is stand for create layer special
    ; Design by Ade Suharna <>
    ; 18 February 2005
    ; Program no.194/02/2005
    ; Edit by
    (defun c:cls (/ cnt n clr cl nlay cn)
    (setq cnt 1)
    (setq n 8)
    (setq clr (list 1 5 250 6 4 2 7))
    (setq cl 1)
    (repeat n
    (cond ((and (>= cnt 1)(< cnt n))
    (progn
    (setq nlay cnt)
    (command "_layer" "n" nlay "" "") ; create w/o color
    ;(command "_layer" "m" nlay "c" cl "" "") ; create w/ color
    ) ; end of progn
    )
    ) ; end of cond
    (setq cnt (1+ cnt))
    ) ; end of repeat
    (setq cnt nil)
    (setq cnt 1)
    (if cl
    (repeat n
    (cond ((and (>= cl 1)(< cl n))
    (progn
    (command "_layer" "m" cnt "c" cl "" "")
    ) ; end of progn
    )
    ) ; end of cond
    (setq cn (1+ cl))
    (setq cl (nth cn clr))
    (setq cnt (1+ cnt))
    ) ; end of repeat
    ) ; end if
    (princ)
    )
     
    Adesu, Feb 18, 2005
    #5
  6. Adesu

    Alaspher Guest

    Hi, Ade!
    May be like this:
    Code:
    (defun c:cls (/ clr i echo)
    (setq echo (getvar "cmdecho")
    i    0
    clr  (list 1 5 250 6 4 2 7)
    )
    (setvar "cmdecho" 0)
    (foreach col clr
    (vl-cmdf "_.-layer" "_n" (itoa (setq i (1+ i))) "_c" (itoa col) (itoa i) "")
    )
    (setvar "cmdecho" echo)
    (princ)
    )
    Best regards!
     
    Alaspher, Feb 18, 2005
    #6
  7. Adesu

    Adesu Guest

    Great and perfect,thanks a lot Alaspher.
     
    Adesu, Feb 18, 2005
    #7
  8. Adesu

    Adesu Guest

    Hi Alaspher,if you not objection ,would you like send to me your
    email,thanks.
     
    Adesu, Feb 18, 2005
    #8
  9. Adesu

    Alaspher Guest

    My mail is on @hotmail.com box = my nickname
     
    Alaspher, Feb 18, 2005
    #9
  10. Adesu

    Adesu Guest

    Thanks
     
    Adesu, Feb 21, 2005
    #10
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.