error: Automation Error. Multiple Readers Exist

error: Automation Error. Multiple Readers Exist

SORONW
Advocate Advocate
949 Views
3 Replies
Message 1 of 4

error: Automation Error. Multiple Readers Exist

SORONW
Advocate
Advocate

Hi all,

 

I'm getting the error: Automation Error. Multiple Readers Exist when I use a lisp routine to insert a dynamic block. What sort of causes should I be looking for to debug this code? I can't seem to find any record of this error online.

 

Thanks

0 Likes
950 Views
3 Replies
Replies (3)
Message 2 of 4

SORONW
Advocate
Advocate
(defun c:bln(/ oldattreq oldlayer p p1 ro) 
(defun LM:setdynpropvalue ( blk prp val )
    (setq prp (strcase prp))
    (vl-some
       '(lambda ( x )
            (if (= prp (strcase (vla-get-propertyname x)))
                (progn
                    (vla-put-value x (vlax-make-variant val (vlax-variant-type (vla-get-value x))))
                    (cond (val) (t))
                )
            )
        )
        (vlax-invoke blk 'getdynamicblockproperties)
    )
)
  	(setq osm (getvar "osmode"))      ;autosnap
 	(setvar "osmode" 0)               ;autosnap
  	(setq oldattreq (getvar "attreq"))
  	(setvar "attreq" 1)
  	(setq oldlayer (getvar "clayer"))
	(setq p (getpoint "\nLocation of balloon center: "))
	(setq p1 (getpoint p "\nPick End location of leader: "))
	(setq ro (/ (* (angle p p1) 180) pi)) ;Rotation or set it as you required
	(setq scale (getvar "dimscale"))
  	(command "_.layer" "s" "0" "")
	(command "_.insert" ;Starts the inset command
		"K:\\Blocks\\Roberts_blocks\\BALLOON.dwg"
		p ;insertion point, defined earlier
		scale ;X scale
		;scale ;Y scale uniform
		"0" ;Rotation or set it as you required
	)
	(LM:setdynpropvalue (vlax-ename->vla-object (entlast)) "Distance1" (Distance p p1))
	(LM:setdynpropvalue (vlax-ename->vla-object (entlast)) "Angle1" (angle p p1))
  	(command "_.wipeout" "F" "OFF") ;Disables the baked-in wipeout frame: hides edge visibility
	(setvar "attreq" oldattreq) ;reset the value to the before state
	(setvar "clayer" oldlayer) ;same as above, but for layers
   	(setvar "osmode" osm)         ;autosnap
	(princ)
)
;End Addition

I've added the code for the insertion, it slipped my mind earlier. 

 

Additionally, I've used the break on error to find that the line causing issues is:

'(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x))) (progn (vla-put-value x (vlax-make-variant val (vlax-variant-type (vla-get-value x)))) (cond (val) (t))

Any ideas?

0 Likes
Message 3 of 4

ВeekeeCZ
Consultant
Consultant

It's save to presume that Lee's code is correct. Post some test file with your block to take a look.

0 Likes
Message 4 of 4

Moshe-A
Mentor
Mentor

@SORONW  hi,

 

i suggest first test your code up to the phase you insert the block, i thinks your error is at the insert call (you disable the Y scale?) than add the (LM:setdynpropvalue) calls.

 

moshe

 

 

0 Likes