entmod issue...

Discussion in 'AutoCAD' started by cyberstrategist, Apr 5, 2005.

  1. OK, so I went through the different entmod posts here and really didn't find anything specific for my case so here I go...

    I have the following line of code that is modifying a block to replace it with another block. It works most all the time but I can not figure out why I have cases where it does not work.

    (entmod (subst (cons 2 new_sym) (assoc 2 (entget ent_name)) (entget ent_name))
    (entupd ent_name)


    I am using MAP 6 and all my entity mods are done via LISP...


    Any ideas??
     
    cyberstrategist, Apr 5, 2005
    #1
  2. cyberstrategist

    avw_410 Guest

    I have a routine that will do exactly this... if you want it i will send it...
    OK, so I went through the different entmod posts here and really didn't find anything specific for my case so here I go...

    I have the following line of code that is modifying a block to replace it with another block. It works most all the time but I can not figure out why I have cases where it does not work.

    (entmod (subst (cons 2 new_sym) (assoc 2 (entget ent_name)) (entget ent_name))
    (entupd ent_name)


    I am using MAP 6 and all my entity mods are done via LISP...


    Any ideas??
     
    avw_410, Apr 5, 2005
    #2
  3. cyberstrategist

    Joe Burke Guest

    Have you tried the Express Tools "blockreplace" command?

    Joe Burke
     
    Joe Burke, Apr 5, 2005
    #3
  4. The lines of code work fine most all the time, maybe 98% of the time considering the volume of usage our users utilize the routine it's included in. If you can, please send the routine and I'll have a look at it.
    I have a routine that will do exactly this... if you want it i will send it...
    OK, so I went through the different entmod posts here and really didn't find anything specific for my case so here I go...

    I have the following line of code that is modifying a block to replace it with another block. It works most all the time but I can not figure out why I have cases where it does not work.

    (entmod (subst (cons 2 new_sym) (assoc 2 (entget ent_name)) (entget ent_name))
    (entupd ent_name)


    I am using MAP 6 and all my entity mods are done via LISP...


    Any ideas??
     
    cyberstrategist, Apr 5, 2005
    #4
  5. cyberstrategist

    mataeux Guest

    would you be willing to share a block for which that code does not work? i've never seen it not work

    thanks
    OK, so I went through the different entmod posts here and really didn't find anything specific for my case so here I go...

    I have the following line of code that is modifying a block to replace it with another block. It works most all the time but I can not figure out why I have cases where it does not work.

    (entmod (subst (cons 2 new_sym) (assoc 2 (entget ent_name)) (entget ent_name))
    (entupd ent_name)


    I am using MAP 6 and all my entity mods are done via LISP...


    Any ideas??
     
    mataeux, Apr 6, 2005
    #5
  6. You have the statement below, the entmod statement. It works but it still leaves the old block there. But this only happens occasionally and I'm trying to figure out why. I basically have 2 blocks in the end, one on top of the other...
    would you be willing to share a block for which that code does not work? i've never seen it not work

    thanks
    OK, so I went through the different entmod posts here and really didn't find anything specific for my case so here I go...

    I have the following line of code that is modifying a block to replace it with another block. It works most all the time but I can not figure out why I have cases where it does not work.

    (entmod (subst (cons 2 new_sym) (assoc 2 (entget ent_name)) (entget ent_name))
    (entupd ent_name)


    I am using MAP 6 and all my entity mods are done via LISP...


    Any ideas??
     
    cyberstrategist, Apr 6, 2005
    #6
  7. cyberstrategist

    Tom Smith Guest

    You were missing a parenthesis in there. The routine will fail if the new block isn't already defined in the drawing, but it will fail simply by not doing anything.

    I use similar routines to replace blocks, and have never seen them leave an extra instance of the block. I don't see how that's possible in your entmod, though I'm a little suspicious of the double entget. I'd get the entity data in a variable and then hand that variable to the entmod, rather than getting the data twice during the entmod.
     
    Tom Smith, Apr 6, 2005
    #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.