Problem with entmod

Discussion in 'AutoCAD' started by Marcel Janmaat, Sep 28, 2004.

  1. I have the following code;

    (setq el1 (subst (cons 1 ts1) (assoc 1 el1) el1)) (entmod el1) (entupd (cdar
    el1))

    At first el1 is;
    ((-1 . <Entity name: 402b7e20>) (0 . "ATTRIB") (330 . <Entity name:
    402b7e08>) (5 . "52734") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 .
    "0") (62 . 7) (6 . "Continuous") (100 . "AcDbText") (10 5785.06 9592.8 0.0)
    (40 . 90.0) (1 . "N1") (50 . 0.0) (41 . 0.75) (51 . 0.0) (7 . "ISO") (71 .
    0) (72 . 4) (11 5828.93 9637.8 0.0) (210 0.0 0.0 1.0) (100 .
    "AcDbAttribute") (2 . "GRP") (70 . 0) (73 . 0) (74 . 0))

    After the subst el1 is;
    ((-1 . <Entity name: 402b7e20>) (0 . "ATTRIB") (330 . <Entity name:
    402b7e08>) (5 . "52734") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 .
    "0") (62 . 7) (6 . "Continuous") (100 . "AcDbText") (10 5785.06 9592.8 0.0)
    (40 . 90.0) (1 . "xx") (50 . 0.0) (41 . 0.75) (51 . 0.0) (7 . "ISO") (71 .
    0) (72 . 4) (11 5828.93 9637.8 0.0) (210 0.0 0.0 1.0) (100 .
    "AcDbAttribute") (2 . "GRP") (70 . 0) (73 . 0) (74 . 0))

    You'll notice that (1 . "N1") has been changed to (1 . "xx").

    But after entmod, nil is repied, wich means database information could not
    be updated. Why!

    I'ts not on a locked layer. I do not understand.

    Please Help!

    M
     
    Marcel Janmaat, Sep 28, 2004
    #1
  2. Marcel Janmaat

    mataeux Guest

    double check your 'one's and 'ell's ?

    also try:
    construct a minimal list to entmod, thus (entmod '((-1 . <Entity name:
    402b7e20>)(1 . "xx")) )
    for some entities that works, sometimes you have to include (100 .
    "AcDbEntity") or more

    the way you've shown should work though
     
    mataeux, Sep 28, 2004
    #2
  3. Marcel Janmaat

    Jim Claypool Guest

    (entmod el1) will modify the attribute
    (entupd (cdar el1) updates the attribute which is not necessary
    You need to update the insert with (entmod (cdr (assoc 330 ent)))
     
    Jim Claypool, Sep 28, 2004
    #3
  4. Using your sugestion I get this;

    bad list in entity tail: <Entity name: 411bfcf8>

    The list was changed from;

    ((-1 . <Entity name: 411abb38>) (0 . "ATTRIB") (330 . <Entity name:
    411abb10>) (5 . "4BF87") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 .
    "0") (62 . 7) (100 . "AcDbText") (10 38858.9 27707.8 0.0) (40 . 90.0) (1 .
    "37") (50 . 0.0) (41 . 0.75) (51 . 0.0) (7 . "ISO") (71 . 0) (72 . 4) (11
    38906.2 27750.9 0.0) (210 0.0 0.0 1.0) (100 . "AcDbAttribute") (2 . "GRP")
    (70 . 0) (73 . 0) (74 . 0))

    to;

    ((-1 . <Entity name: 411abb38>) (0 . "ATTRIB") (330 . <Entity name:
    411abb10>) (5 . "4BF87") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 .
    "0") (62 . 7) (100 . "AcDbText") (10 38858.9 27707.8 0.0) (40 . 90.0) (1 .
    "33") (50 . 0.0) (41 . 0.75) (51 . 0.0) (7 . "ISO") (71 . 0) (72 . 4) (11
    38906.2 27750.9 0.0) (210 0.0 0.0 1.0) (100 . "AcDbAttribute") (2 . "GRP")
    (70 . 0) (73 . 0) (74 . 0))

    Strangely enough the routine almost always works. Exeptionally it fails. I'm
    not sure but think it only fails at the last entity in the drawings
    database. When the "error" occurs, strangely enough, after placing a new
    block in the drawing the error doesn't occur anymore and the value gets
    replaced just fine.

    Regards MJ
     
    Marcel Janmaat, Sep 29, 2004
    #4
  5. In referal to previous message,
    Now after undoing the insertion of the new block. It still works. Wich I
    wouldn't expect.
     
    Marcel Janmaat, Sep 29, 2004
    #5
  6. Marcel Janmaat

    Jim Claypool Guest

    A better way to do this would be to keep the entity name of the block and
    using entupd on that.
    It should be the same, but by using it, it will work.
    I don't know where Entity name: 411bfcf8 came from. It is not in the list
    containing the attribute.
     
    Jim Claypool, Sep 29, 2004
    #6
  7. Marcel Janmaat

    Adesu Guest

    Hi Marcel ,you try this method
    (entmod (subst (cons 1 ts1)(assoc 1 el1) el1))
     
    Adesu, Oct 19, 2004
    #7
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.