Reactor error

Discussion in 'AutoCAD' started by Cliff Davis, Apr 1, 2004.

  1. Cliff Davis

    Cliff Davis Guest

    I am using the following code to insert a block and attach a reactor to a block. When it gets to the "vlax-ename->vla-object"
    command during a copy it chokes with the following error:

    ; error: Automation Error. Description was not provided.

    It works fine on the initial assignment of the reactor.

    If I assign (setq test object) and attempt the same command from the command line using the test variable it works fine. Any ideas
    of what I am doing incorrectly?
    Thanks
    Cliff


    (defun insert_0 (block_name / att_req local_reactor)
    (setq att_req (getvar "attreq"))
    (setvar "attreq" 0)
    (princ "\nSelect insertion point: ")
    (command "-insert" block_name "s" (getvar "dimscale") pause nil)
    (princ "\nSelect rotation angle: ")
    (command "-insert" block_name (getvar "lastpoint") (getvar "dimscale") "" pause)
    (vl-load-com)
    (set_insert_0_reactor (entlast))
    (command "move" (entlast) "" "0,0" "0,0")
    (setvar "attreq" att_req)
    )

    (defun set_insert_0_reactor (object)
    ; this is where it chokes with: ; error: Automation Error. Description was not provided.
    ;----------------------------------------------------------------------------------------------------------------------
    (setq object (vlax-ename->vla-object object))
    ;----------------------------------------------------------------------------------------------------------------------
    (vlr-pers (vlr-object-reactor (list object) nil '(:)vlr-modified . insert_0_reactor))))
    (vlr-pers (vlr-object-reactor (list object) nil '(:)vlr-copied . insert_0_reactor))))
    )

    (defun insert_0_reactor (notification_object reactor_object parameter_list
    / current_entity attb_list)
    (if (assoc ':vlr-copied (vlr-reactions reactor_object))
    (progn
    (set_insert_0_reactor (entlast))
    )
    (progn
    (if (not command_reactor) (setq command_reactor (vlr-editor-reactor nil '(:)vlr-commandended . attrib_update)))))
    (setq *block_entity* (vlax-vla-object->ename notification_object))
    (setq *attb_angle* 0)
    )
    )
    )

    ; updates the attributes, isn't called during a copy
    (defun attrib_update (calling_reactor command_info / attb_list update_list current_entity)
    (vlr-remove command_reactor)
    (setq command_reactor nil)
    (setq current_entity (entnext *block_entity*))
    (while current_entity
    (setq attb_list (entget current_entity))
    (if (= (cdr (assoc 0 attb_list)) "ATTRIB")
    (progn
    (setq attb_list (subst (cons 50 *attb_angle*) (assoc 50 attb_list) attb_list))
    (setq update_list (append update_list (list attb_list)))
    )
    )
    (setq current_entity (entnext current_entity))
    )
    (foreach attribute_list update_list
    (entmod attribute_list)
    )
    (entupd *block_entity*)
    (setq *block_entity* nil)
    (setq *attb_angle* nil)
    (princ)
    )
     
    Cliff Davis, Apr 1, 2004
    #1
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.