Subtract Error

Discussion in 'AutoCAD' started by AaronLucy, Jun 23, 2004.

  1. AaronLucy

    AaronLucy Guest

    I have been trying to write a lisp to create a 3D plate with a center hole in it and i can not get the "Subtract" command to work in lisp. I create a "box" then a "cylinder" after each of them i us the "entlast" function to identify them. However when i put in the command in the lisp, it does not except the entity that the "entlast" gives it. Below is how i have tried it and i can not get it to work. What am i doing wrong?

    (command "BOX" P6 P7 BPT)
    (setq E1 entlast)
    (command "CYLINDER" P5 PBR BPT)
    (setq E2 entlast)
    (command "Subtract" E1 "" E2 "")
     
    AaronLucy, Jun 23, 2004
    #1
  2. Change
    (setq E1 entlast)
    to
    (setq E1 (entget (entlast)))

    in it and i can not get the "Subtract" command to work in lisp. I create a
    "box" then a "cylinder" after each of them i us the "entlast" function to
    identify them. However when i put in the command in the lisp, it does not
    except the entity that the "entlast" gives it. Below is how i have tried it
    and i can not get it to work. What am i doing wrong?
     
    Alan Henderson @ A'cad Solutions, Jun 23, 2004
    #2
  3. AaronLucy

    MP Guest

    actually he needs...
    (setq E1 (entlast))
     
    MP, Jun 23, 2004
    #3
  4. AaronLucy

    Barr Guest

    Eliminate the entget and you've got it.
    E2 has to be an entity, not an association
    list (or whatever you call the issue of an entget).

    (command "BOX" P6 P7 BPT)
    (setq E1 (entlast))
    (command "CYLINDER" P5 PBR BPT)
    (setq E2 (entlast))
    (command "Subtract" E1 "" E2 "")

    -doug
     
    Barr, Jun 23, 2004
    #4
  5. AaronLucy

    Barr Guest

    Glad we're in agreement there!

    It's actually a pretty neat way of creating a 'complex' solid.
    I can't see it going much further than this, but maybe...

    Not quite as versatile as a true solid, but easier than putting the pieces
    together manually.
    -doug
     
    Barr, Jun 23, 2004
    #5
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.