Reactor; CallBack func; error: Automation Error.

Reactor; CallBack func; error: Automation Error.

costin.calin
Participant Participant
697 Views
1 Reply
Message 1 of 2

Reactor; CallBack func; error: Automation Error.

costin.calin
Participant
Participant

Hello,

 

I have two reactor and two problems in callback functions. I have inserted same princ to be evident where is the error. Outside (from CallBack func reactors) they works properly. It seems that some LISP function are not compatibile to work in callback func (vlax-ename->vla-object, vla-update). 

 

My callback func.:
  - AppendBkAreaLst - when I copy an object included in _AreaBkLst, must add the new one to reactors
         : execution broke on line :(setq obL(vlax-ename->vla-object(entlast)))
         : message> 1 <Entity name: 1edac8b6420>2 ; error: Automation Error. Description was not provided.

 

  - CopyAreaBkReactor - when I modify a DynBlk parameters, update the area field attribute
         : execution broke on line 😞vla-update ob)
         : message>!begin! ; error: Automation Error. Object was notifying
         : although, the field are updated


_AreaBkLst - global var - a lst with dyn blks

 

;------------Setup Reactors-----------
(setq ModifyAreaBkReactor (vlr-object-reactor 
    _AreaBkLst "ModifyAreaBkReactor" '((:vlr-modified . UpdateBkArea))))
(setq CopyAreaBkReactor (vlr-object-reactor 
    _AreaBkLst "CopyAreaBkReactor" '((:VLR-copied . AppendBkAreaLst))))
;------------Functions----------------
(defun AppendBkAreaLst (ob re Rlst / obL)  ;at >COPY add new Blk to reactor /Callback fun
	(princ "1 ")
	(princ(entlast))
	(princ "2 ")
	(setq obL(vlax-ename->vla-object(entlast)))
	(princ "3 ")
	(vlr-owner-add ModifyAreaBkReactor obL)
	(vlr-owner-add CopyAreaBkReactor obL)
(princ))

(defun UpdateBkArea (ob re Rlst / )    ;when modify parameters- update area field /Callback fun
	(setq BC(BlockComponents (vla-get-name ob) ""))
	(setq obS(vlax-ename->vla-object (nth 5 bc)))
	(setq Area (vlax-curve-getarea(car BC)))
	(vla-put-TextString obS Area)
	(princ "\n!begin! ")
	(vla-update ob)
(princ "ok")(princ))

(defun BlockComponents ( blk typ / ent lst )  ;lst all enteies inside blk
    (setq typ (strcat typ "*"))
	(if (setq ent (tblobjname "block" blk))
        (while (setq ent (entnext ent))
            (if (wcmatch (cdr (assoc 0 (setq enx (entget ent)))) typ)
				(setq lst (cons ent lst)))))
(reverse lst))

 Thank you!

0 Likes
698 Views
1 Reply
Reply (1)
Message 2 of 2

john.uhden
Mentor
Mentor

The only thing that comes to mind is that you can't have a reaction that tries to modify the object that called the reaction.

But that doesn't explain why 

(setq obL(vlax-ename->vla-object(entlast)))

failed. 

John F. Uhden