TheSwamp

CAD Forums => CAD General => Topic started by: HasanCAD on December 26, 2022, 04:35:44 AM

Title: Error: no function definition: VLAX-ENAME->VLA-OBJECT
Post by: HasanCAD on December 26, 2022, 04:35:44 AM
Hi All,

I moved to new company, and they are using CAD2019.
While running a lisp gives this error
Code: [Select]
"Error: no function definition: VLAX-ENAME->VLA-OBJECT"I found this is a bug in CAD19 and needs to modify in register, but IT refuse to solve this issue and saying we can't modify the register.
So is there any other solution to solve this issue without modifying in register.
for example:
Code - Auto/Visual Lisp: [Select]
  1. (defun _value   (str / )
  2.   (while
  3.     (not
  4.       (if (and (setq entt (nentsel str))
  5.                (setq ATTr (car entt))
  6.                (member (vla-get-objectname (setq ATTr (vlax-ename->vla-object ATTr)))
  7.                        '("AcDbAttribute" "AcDbText" "*DIM*" "AcDbMText")))
  8.         ATTr (progn (princ str) nil))))
  9.   ATTr
  10.   )

Thanks
Title: Re: Error: no function definition: VLAX-ENAME->VLA-OBJECT
Post by: It's Alive! on December 26, 2022, 06:24:56 AM
maybe something like  :mrgreen:

Code - Auto/Visual Lisp: [Select]
  1.      'HandleToObject (vlax-make-variant (cdr (assoc 5 (entget  (car (entsel))))) vlax-vbString)))
  2.  

or maybe
Code - Auto/Visual Lisp: [Select]
  1.  
Title: Re: Error: no function definition: VLAX-ENAME->VLA-OBJECT
Post by: tombu on January 02, 2023, 10:34:01 PM
Are you running AutoCAD 2019 on a MacOS?
Title: Re: Error: no function definition: VLAX-ENAME->VLA-OBJECT
Post by: ronjonp on January 03, 2023, 10:58:18 AM
Code - Auto/Visual Lisp: [Select]
  1. ;; Change this
  2. (member (vla-get-objectname (setq attr (vlax-ename->vla-object attr)))
  3.         '("AcDbAttribute" "AcDbText" "*DIM*" "AcDbMText")
  4. )
  5. ;; to this
  6. (wcmatch (cdr (assoc 0 (entget attr))) "ATTRIB,*DIM*,*TEXT")
It will return an ename rather vla object but you can still retrieve the "_value". Not sure why we're checking for *DIM*, if selecting text within a dimension it will return MTEXT.