Problems with inserting a selection!!

Discussion in 'AutoCAD' started by SkintSubby, Oct 6, 2004.

  1. SkintSubby

    SkintSubby Guest

    I'm trying to write a lisp that subtracts one (or more) solids from a solid. (much like the standard ACAD command). however I'm trying to do it so that it draws back in the solids you have subtracted.
    i.e I need to do lots of subtracting, but also keep the original solids I subtracted...if that makes sense???

    I've used the following code to get my selection sets, but I'm not sure how I go about re-inserting the original solids (named sub) back into the model

    (defun c:sub ()
    (princ "\nSelect objects to be subtracted from ")
    (setq subtfrom (ssget))
    (princ "\nSelect solids and regions to subtract ")
    (setq subt (ssget))
    (command "subtract" subtfrom "" subt "")
    )

    Can anyone help??

    TIA

    M
     
    SkintSubby, Oct 6, 2004
    #1
  2. SkintSubby

    Jeff Mishler Guest

    Copy the objects to be subtracted prior to the subtract operation.
     
    Jeff Mishler, Oct 6, 2004
    #2
  3. SkintSubby

    spencer1971 Guest

    No error handling and v. basic but it will do what you want.

    (defun c:subkeep ()
    (princ "\nSelect solids and regions to subtract from..")
    (setq obj1 (ssget))
    (princ "\nSelect solids and regions to subtract..")
    (setq obj2 (ssget))
    (command "copy" obj2 "" "0,0" "0,0")
    (command "subtract" obj1 "" obj2 "")
    )


    Spencer
     
    spencer1971, Oct 6, 2004
    #3
  4. SkintSubby

    spencer1971 Guest

    make variables local as below

    (defun c:subkeep (/ obj1 obj2)
    (princ "\nSelect solids and regions to subtract from..")
    (setq obj1 (ssget))
    (princ "\nSelect solids and regions to subtract..")
    (setq obj2 (ssget))
    (command "copy" obj2 "" "0,0" "0,0")
    (command "subtract" obj1 "" obj2 "")
    )
     
    spencer1971, Oct 6, 2004
    #4
  5. SkintSubby

    SkintSubby Guest

    Thanks Gent's

    M
     
    SkintSubby, Oct 7, 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.