Jump to content
costin calin

Reactor; CallBack func; error: Automation Error.

Recommended Posts

costin calin

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, but report an error


_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))

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...