Error: Automation Error. Description was not provided.

Discussion in 'AutoCAD' started by J. Logan, Feb 13, 2004.

  1. J. Logan

    J. Logan Guest

    I'm going through Afralisps tutorial and have modified (1) line to fit my
    needs. When I run the code in a drawing I get.

    Error: Automation Error. Description was not provided.

    then run the command a second time and get

    Error: Automation Error. The named selection set exists

    Am I not deleting the selection set with (vla-delete(vla-item ssets "SS1"))
    Or am I doing it wrong?

    (defun c:laycol15 (/ sset check)
    (vl-load-com)
    (setq acadDocument (vla-get-activedocument (vlax-get-acad-object)))
    (setq ssets(vla-get-selectionsets acadDocument))
    (setq newsset(vla-add ssets "SS1"))
    (vla-selectOnScreen newsset)
    (setq ctr 0)
    (repeat (vla-get-count newsset)
    (setq item(vla-item newsset crt))
    (setq check(vlax-property-available-p sset "Color" T))
    (if check
    (vlax-put-property sset 'color 15)
    )
    (setq ctr(1+ ctr))
    (vla-delete(vla-item ssets "SS1"))
    (princ)
    )
    )

    Thanks in advance J. logan
     
    J. Logan, Feb 13, 2004
    #1
  2. If a named selection set of that name already exists, you cannot add it.

    The ActiveX named selection sets are cumbersome enough in LISP that I
    recommend just using normal selection sets (unless you need it for a VBA
    integration).


    --
    R. Robert Bell, MCSE
    www.AcadX.com


    I'm going through Afralisps tutorial and have modified (1) line to fit my
    needs. When I run the code in a drawing I get.

    Error: Automation Error. Description was not provided.

    then run the command a second time and get

    Error: Automation Error. The named selection set exists

    Am I not deleting the selection set with (vla-delete(vla-item ssets "SS1"))
    Or am I doing it wrong?

    (defun c:laycol15 (/ sset check)
    (vl-load-com)
    (setq acadDocument (vla-get-activedocument (vlax-get-acad-object)))
    (setq ssets(vla-get-selectionsets acadDocument))
    (setq newsset(vla-add ssets "SS1"))
    (vla-selectOnScreen newsset)
    (setq ctr 0)
    (repeat (vla-get-count newsset)
    (setq item(vla-item newsset crt))
    (setq check(vlax-property-available-p sset "Color" T))
    (if check
    (vlax-put-property sset 'color 15)
    )
    (setq ctr(1+ ctr))
    (vla-delete(vla-item ssets "SS1"))
    (princ)
    )
    )

    Thanks in advance J. logan
     
    R. Robert Bell, Feb 13, 2004
    #2
  3. J. Logan

    J. Logan Guest

    Robert,

    I've looked at your "Change all objects to bylayer" routine on your website.
    Actually I've used it before. It works really well. I'm trying to create the
    same thing that would only find "red" objects and change them to bylayer.
    I'm just learning so...

    (ssget "x" '((-4 . "/=") (62 . 256)))

    When you say "normal selection sets" the above is what you're referring to.
    Correct?
    I understand the (62. 256) data and data type or Color and AcadColor

    What is ((-4 . "/=")
    doing?

    J. Logan
     
    J. Logan, Feb 13, 2004
    #3
  4. (ssget "X" '((62 . 1))) is using AutoLISP's selection sets and selecting all
    objects that are color=1.

    --
    R. Robert Bell, MCSE
    www.AcadX.com


    Robert,

    I've looked at your "Change all objects to bylayer" routine on your website.
    Actually I've used it before. It works really well. I'm trying to create the
    same thing that would only find "red" objects and change them to bylayer.
    I'm just learning so...

    (ssget "x" '((-4 . "/=") (62 . 256)))

    When you say "normal selection sets" the above is what you're referring to.
    Correct?
    I understand the (62. 256) data and data type or Color and AcadColor

    What is ((-4 . "/=")
    doing?

    J. Logan
     
    R. Robert Bell, Feb 13, 2004
    #4
  5. J. Logan

    J. Logan Guest

    Yep that's what I was seeing. So your routine is really saying get all
    objects from color 1 to 256 rather than just color 1 (red)?

    (ssget "x" '((-4 . "/=") (62 . 256)))

    Thanks Robert. That clears it up a bit.

    J. Logan
     
    J. Logan, Feb 13, 2004
    #5
  6. Yep that's what I was seeing. So your routine is really saying get all
    objects from color 1 to 256 rather than just color 1 (red)?


    Well, 1 to 255 anyway.
     
    R. Robert Bell, Feb 13, 2004
    #6
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.