tblobjname modifying block definitions

Discussion in 'AutoCAD' started by Blair MacKenzie, Apr 6, 2004.

  1. Sorry if I'm repeating a previous post but haven't received any useful tips
    so I'm sure I probably didn't use the right subject.

    Still having a problem with entmod/entupd block definition with tblobjname
    "block" name.
    Had a suggestion that I was modifying insert definitions and not block
    definitions.The insert definitions are updated again but when a attsync done
    on block it
    goes back to the original width factor.
    I'm sure it's really simple, but is beyond me. I've tried so many variations
    on the code using tblobjname but am getting nowhere.
    Here's the original code. Where does the tblobjname "block" name fit in with
    entmod?
    Can anyone please help.


    (defun c:test (/ ss1 name next next-l wf)
    (setq ss1 (ssget "x" '((0 . "INSERT") (2 . "TEST")(66 . 1))))
    (setq name (ssname ss1 0) next (entnext name) next-l (entget next))
    (while (/= (cdr (assoc 0 next-l) "SEQEND"))
    (if (= (cdr (assoc 2 next-l) "TAG-TEST"))
    (progn
    (setq wf 5);width factor for tag tag-test
    (setq next-l (subst (cons 41 wf) (assoc 41 next-l) next-l))
    (entmod next-l)
    (entupd name)
    );progn
    )
    (setq next (entnext next) next-l (entget next))
    );while
    (princ)
    );end defun
    (c:test)

    --
    Blair MacKenzie
    cadesign limited


    +64 21 655 325
     
    Blair MacKenzie, Apr 6, 2004
    #1
  2. Blair MacKenzie

    Jeff Mishler Guest

    Try this......

    HTH, Jeff

    (defun c:test (/ ss1 name next next-l wf)
    (setq wf 6)
    ;first we'll modify the block definition
    (if (setq next (tblobjname "BLOCK" "TEST"))
    (while (setq next (entnext next))
    (setq name (entget next))
    (if (and (= (cdr (assoc 0 name)) "ATTDEF")
    (= (cdr (assoc 2 name)) "TAG-TEST")
    )
    (entmod (subst (cons 41 wf) (assoc 41 name) name))
    )
    )
    )
    ;now modify the inserts
    (setq ss1 (ssget "x" '((0 . "INSERT") (2 . "TEST") (66 . 1))))
    (setq count 0)
    (repeat (sslength ss1)
    (setq name (ssname ss1 count)
    count (1+ count)
    next (entnext name)
    next-l (entget next)
    )
    (while (/= (cdr (assoc 0 next-l)) "SEQEND")
    (if (= (cdr (assoc 2 next-l)) "TAG-TEST")
    (progn
    ;(setq wf 5);moved ;width factor for tag tag-test
    (setq next-l (subst (cons 41 wf) (assoc 41 next-l) next-l))
    (entmod next-l)
    (entupd name)
    ) ;progn
    )
    (setq next (entnext next)
    next-l (entget next)
    )
    ) ;while
    );repeat
    (princ)
    )
     
    Jeff Mishler, Apr 6, 2004
    #2
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.