Changing the value of an attribute in the last block in a drawing

Discussion in 'AutoCAD' started by Marcel Janmaat, Apr 5, 2005.

  1. I have a block in wich I change an attribute value from VW to MA

    EL1 =
    ((-1 . <Entity name: 42a8fe20>) (0 . "ATTRIB") (330 . <Entity name:
    42a8fe10>) (5 . "1546C") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 .
    "0") (62 . 7) (100 . "AcDbText") (10 106738.0 71963.0 0.0) (40 . 250.0) (1 .
    "VW") (50 . 0.0) (41 . 0.75) (51 . 0.0) (7 . "ISO") (71 . 0) (72 . 4) (11
    106926.0 72088.0 0.0) (210 0.0 0.0 1.0) (100 . "AcDbAttribute") (2 . "SPC")
    (70 . 0) (73 . 0) (74 . 0))

    (setq el1 (subst (cons 1 spc) (assoc 1 el1) el1)) RESULTS IN...

    ((-1 . <Entity name: 42a8fe20>) (0 . "ATTRIB") (330 . <Entity name:
    42a8fe10>) (5 . "1546C") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 .
    "0") (62 . 7) (100 . "AcDbText") (10 106738.0 71963.0 0.0) (40 . 250.0) (1 .
    "MA") (50 . 0.0) (41 . 0.75) (51 . 0.0) (7 . "ISO") (71 . 0) (72 . 4) (11
    106926.0 72088.0 0.0) (210 0.0 0.0 1.0) (100 . "AcDbAttribute") (2 . "SPC")
    (70 . 0) (73 . 0) (74 . 0))

    After this...
    (entmod el1) results in nil
    (entupd (cdar el1)) results in nil

    Normally the attribute value gets changed on the screen, but if it's the
    last block in the drawing it doesn''t.
    If I place a new block in the drawing it works again.

    Has anybody got an idea why this doesn't work with the last block in a
    drawing?

    M

    Here the part of code...

    (progn
    (setq el1 (subst (cons 1 spc) (assoc 1 el1) el1)) (entmod el1) (entupd
    (cdar el1))
    (while el1
    (while (and (not (setq el1 (entsel (strcat "\nSelecteer meer symbolen
    t.b.v. code " spc " <cancel>: ")))) (= (getvar "errno") 7)) (princ))
    (if el1
    (progn (setq el1 (entget (car el1)))
    (while (and (/= (cdr (assoc 0 el1)) "SEQEND") (setq
    el1 (entnext (cdar el1))))
    (setq el1 (entget el1))
    (if (and (= (cdr (assoc 0 el1)) "ATTRIB") (= (cdr
    (assoc 2 el1)) "SPC"))
    (progn (setq el1 (subst (cons 1 spc) (assoc 1
    el1) el1)) (entmod el1) (entupd (cdar el1)))
    ) )
    ) )
    ) )
     
    Marcel Janmaat, Apr 5, 2005
    #1
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.