simple query

Discussion in 'AutoCAD' started by Jamie Duncan, Oct 28, 2004.

  1. Jamie Duncan

    Jamie Duncan Guest

    I'm trying to develop a lisp that allows one to set all objects in a
    selection set to colour and linetype bylayer, and that recurses to fix
    nested blocks.

    any help as to where I'm going wrong would be appreciated.

    Thanks!


    (defun c:fixblock (/ ss1 temp ent1 looper looper1 entdat bnm ctr ctr1 enttyp
    bl_list)
    (arctvsav)
    (defun jddfixablock (bname / enam1)
    (setq enam1 (tblobjname "block" bname))
    (while (setq enam1 (entnext enam1))
    (setq end1 (entget enam1)
    end1 (subst (cons 62 256)(assoc 62 end1) end1)
    end1 (subst (cons 6 "Bylayer")(assoc 6 end1) end1)
    end1 (subst (cons 8 "0")(assoc 8 end1) end1)
    )
    (entmod end1)
    (if (= (cdr (assoc 0 (entget enam1))) "INSERT")(setq bl_list (append
    bl_list (list (cdr (assoc 2 (entget ent1)))))))
    )
    )
    (command ".layer" "t" "0" "un" "*" "s" "0" "")
    (setq ss1 (ssadd) looper T ctr 0)
    (while looper
    (prompt "\nSelect Entities to set to Bylayer for Colour and Linetype: ")
    (setq ss1 (ssget))
    (if ss1 (setq looper nil))
    )
    (repeat (sslength ss1)
    (setq ent1 (ssname ss1 ctr)
    entdat (entget ent1)
    enttyp (cdr (assoc 0 entdat))
    entdat (subst (cons 62 256)(assoc 62 entdat) entdat)
    entdat (subst (cons 6 "Bylayer")(assoc 6 entdat) entdat)
    )
    (entmod entdat)(entupd ent1)
    (if (= enttyp "INSERT")
    (progn
    (setq bl_list nil bl_list (list (cdr (assoc 2 entdat))) ctr1 0
    looper1 T)
    (while looper1 ;;; I originally wanted to a foreach here but
    that won't work
    (setq bnm (nth ctr1 bl_list) ctr1 (+ 1 ctr1))
    (jddfixablock bnm)
    (if (>= ctr1 (length bl_list))(setq looper1 nil))
    )
    )
    )
    (setq ctr (+ ctr 1))
    )
    (arctvrst)
    (princ)
    )


    PJ
     
    Jamie Duncan, Oct 28, 2004
    #1
  2. Jamie Duncan

    Doug Broad Guest

    Google -> groups -> propstobylayer


    news:41812395$1_1@newsprd01...
     
    Doug Broad, Oct 28, 2004
    #2
  3. Jamie Duncan

    Jamie Duncan Guest

    Hey Doug, I tried google and got nothing. is this a lisp program or vlisp
    program floating around?

    I also can't see where my lisp is going wrong.

    Jamie
     
    Jamie Duncan, Oct 28, 2004
    #3
  4. Jamie Duncan

    Doug Broad Guest

    Jamie,
    I can't believe it. Did you follow my instructions? Anyway here
    is a link that should work: http://tinyurl.com/4n6fq
    You participated in the thread and Michael Puckett also posted
    a plain vanilla version.

    Don't have time to look at yours. Problem solved as far as I'm
    concerned.

    Regards,
    Doug
     
    Doug Broad, Oct 28, 2004
    #4
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.