selecting an entity, why won't this work

Discussion in 'AutoCAD' started by mnash, Sep 10, 2004.

  1. mnash

    mnash Guest

    (setq OB (entsel "Choose Object:"))
    (command "-layer" "set" "" OB "")

    what is the quick fix, I want to make a layer of a particular object current within a set of commands
    CAD2004
     
    mnash, Sep 10, 2004
    #1
  2. mnash

    Tom Smith Guest

    You need to do the entget on (car OB). Also, need to check if anything was
    selected:

    (if (setq OB (entsel "Choose Object:"))
    (command "-layer" "set" (cdr (assoc 8 (entget (car OB)))) "")
    )
     
    Tom Smith, Sep 10, 2004
    #2
  3. mnash

    Marco Caprez Guest

    mnash,
    Try this:
    (if (setq OB (entsel "Choose Object:"))
    (command "_.-layer" "_set" (cdr(assoc 8 (entget(car OB)))) "")
    )

    Hope this helps
     
    Marco Caprez, Sep 10, 2004
    #3
  4. mnash

    mnash Guest

    thanks all for yer help
     
    mnash, Sep 10, 2004
    #4
  5. mnash

    hulioman Guest

    I prefer to not use the word "command" in lisp routines.

    Try this..

    (setvar "clayer" (cdr (assoc 8 (entget (Car (entsel))))))

    This will set the layer of the object you select to current.
    (in the case of blocks or xrefs, this will select the layer the block or xref resides on)

    (setvar "clayer" (cdr (assoc 8 (entget (Car (nentsel))))))

    This will set the layer of the object you select to current.
    (in the case of blocks or xrefs, this will select the layer of the embedded block entity)
     
    hulioman, Sep 10, 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.