Dynamic block won't convert to vla object or acad object

Dynamic block won't convert to vla object or acad object

Gorra
Advocate Advocate
298 Views
2 Replies
Message 1 of 3

Dynamic block won't convert to vla object or acad object

Gorra
Advocate
Advocate

Hello,

I have a subfunction that should be simple. It prompts the user to select a specific block, and checks to make sure it's the right block. To get the attribute value I'm using LeeMac's vl-getattributevalue, but the object sent to that must be a VLA object. When I try to send the existing block, I get the error: bad argument type: VLA-OBJECT (<Entity name: 260bab32cf0> (530143.0 5.43758e+06 0.0))

 

When I try to make a vla object from the block, I get the error: bad argument type: lentityp (<Entity name: 260bab32cf0> (530136.0 5.43756e+06 0.0))

 

The function is below, 

(defun Select03 ( / BsSlct LError L03V L03VLA)
  (setq LError 1)
  (while (eq LError 1)
     (progn
       (setq Lyt03 (entsel "\nPlease select the SHEET 03 rectangle"))
       (setq L03VLA (vlax-invoke (vlax-ename->vla-object Lyt03)))
       (setq L03V (entget (car Lyt03)))
       (if 
           (and
             (eq (cdr (assoc 0 L03V)) "INSERT")
             (eq (LM:vl-getattributevalue Lyt03 "MAPSHTNUM") "03")
            )
            (setq LError 0)
            (princ " Invalid selection")
         )
      )
   )
)
The block is attached. I have a rather large LISP using this block and it functioned fine when converted to a vla object or an acad object, in that one. The only difference I can see is that in the working LISP it gets group selected whereas in this one the user clicks on it.
 
Am I missing something basic? It's been a few months since I coded,
 
Thanks for any help,
Gorra
0 Likes
Accepted solutions (1)
299 Views
2 Replies
Replies (2)
Message 2 of 3

Rick_Tolleshaug_TSC
Advocate
Advocate
Accepted solution

Fix these two things and it works:

Change: (setq L03VLA (vlax-invoke (vlax-ename->vla-object Lyt03)))

To:          (setq L03VLA (vlax-ename->vla-object (car Lyt03)))

Change: (eq (LM:vl-getattributevalue Lyt03 "MAPSHTNUM") "03")

To:          (eq (LM:vl-getattributevalue L03VLA "MAPSHTNUM") "03")

0 Likes
Message 3 of 3

Gorra
Advocate
Advocate

@Rick_Tolleshaug_TSC Thank you. I caught the second one while I was waiting, but I never would have gotten the first one.

 

Gorra

0 Likes