pedit

Discussion in 'AutoCAD' started by spencer1971, Mar 10, 2005.

  1. spencer1971

    spencer1971 Guest

    could anyone point out where i am going wrong with this very basic lsp...

    (Defun c:clp (/)
    (setq sls1 (ssget))
    (foreach item (sls1) (dowork))
    )

    (Defun dowork ()
    (command "pedit" item "cl" "")
    )


    Many thanks

    spencer
     
    spencer1971, Mar 10, 2005
    #1
  2. spencer1971

    BillZ Guest

    Foreach won't work on a selection set.

    Bill
     
    BillZ, Mar 10, 2005
    #2
  3. Try this instead, notice the check to make sure entity selected is a
    lwpolyline
    (defun C:CLP (/ SLS1 KK KS EG)
    (if (setq SLS1 (ssget))
    (progn
    (setq KK 0 KS (sslength SLS1))
    (while (< KK KS)
    (setq EG (entget (ssname SLS1 KK)))
    (if (= (cdr (assoc 0 EG)) "LWPOLYLINE")
    (command "PEDIT" (ssname SLS1 KK) "CL" "")
    )
    (setq KK (1+ KK))
    )
    )
    )
    (princ)
    )
     
    Alan Henderson @ A'cad Solutions, Mar 10, 2005
    #3
  4. spencer1971

    spencer1971 Guest

    thanks,

    Is there a way to incorperate a fillet command into this?

    ie

    (command "fillet" "r" "10" "p" (ssname))

    I cant see how I can do it
     
    spencer1971, Mar 10, 2005
    #4
  5. (command "fillet" "r" "10" "p" (ssname SLS1 KK))
     
    Alan Henderson @ A'cad Solutions, Mar 10, 2005
    #5
  6. spencer1971

    spencer1971 Guest

    ive allready tried that and cannot get it to work,
     
    spencer1971, Mar 10, 2005
    #6
  7. I forgot you have to pass a point to the fillet command.
    (defun C:CLP ()
    (if (setq SLS1 (ssget))
    (progn
    (setq KK 0 KS (sslength SLS1))
    (while (< KK KS)
    (setq EG (entget (ssname SLS1 KK)))
    (if (= (cdr (assoc 0 EG)) "LWPOLYLINE")
    (progn
    (command "ID" (cdr (assoc 10 EG)))
    (command "PEDIT" (ssname SLS1 KK) "CL" "")
    (command "FILLET" "P" "@")
    )
    )
    (setq KK (1+ KK))
    )
    )
    )
    (princ)
    )
     
    Alan Henderson @ A'cad Solutions, Mar 10, 2005
    #7
  8. spencer1971

    spencer1971 Guest

    Many thanks

    spencer
     
    spencer1971, Mar 14, 2005
    #8
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.