DuanJinHui 发表于 2022-7-5 15:39:10

error: ActiveX Server returned

error: ActiveX Server returned the error: unknown name: Explode , Why ?
 
autocad 2010 , windows xp
 

;|==================================================-===========================*    Универсальная функция разбития proxy-объектов.*    Параметры вызова:*нет*    Примеры вызова:(_kpblc-block-explode-proxy)==================================================-===========================|;(defun _kpblc-block-explode-proxy (/ selset item layer_list) (vl-load-com) (setq selset (ssget "_X" '((0 . "ACAD_PROXY_ENTITY")))) (vlax-for item         (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))   (if (= (vla-get-lock item) :vlax-true)   (progn       (setq layer_list (append layer_list '(item)))       (vla-put-lock item :vlax-false)       ) ;_ end of progn   ) ;_ end of if   ) ;_ end of vlax-for (while (and selset             (> (sslength selset) 0)             ) ;_ end of and   (setq item (ssname selset 0))   (ssdel item selset)   (vla-explode (vlax-ename->vla-object item))   ) ;_ end of while (foreach item layer_list   (vla-put-lock item :vlax-true)   ) ;_ end of foreach ) ;_ end of defun;|==================================================-===========================*    Сервисная функция для вызова из ком.строки==================================================-===========================|;(defun c:xproxy (/ adoc) (vla-startundomark (vla-get-activedocument (vlax-get-acad-object))) (_kpblc-block-explode-proxy) (vla-endundomark (vla-get-activedocument (vlax-get-acad-object))) ) ;_ end of defun

Lee Mac 发表于 2022-7-5 15:46:05

Change:

(vla-explode (vlax-ename->vla-object item))
to:

(if (vlax-method-applicable-p (setq obj (vlax-ename->vla-object item)) 'explode) (vla-explode obj))

DuanJinHui 发表于 2022-7-5 15:50:31

 
Thanks Lee,Now, No err.
why I use this routine can't explode "ACAD_PROXY_ENTITY" object ?

Lee Mac 发表于 2022-7-5 15:59:30

 
As far as I'm aware the ActiveX explode method does not apply to an ACAD_PROXY_ENTITY entity type; you may need to call the standard EXPLODE command to process this object.

DuanJinHui 发表于 2022-7-5 16:02:26

 
Many thanks ,Lee.

Lee Mac 发表于 2022-7-5 16:07:19

You're welcome

Doctor_Che 发表于 2022-7-5 16:15:45

Hi!
I have a similar error. "error: ActiveX Server returned the error: unknown name: EffectiveName"
And I have this error if file has a table. If I delete a table everithing is good.
autocad 2015 , windows 8
 

;; Returns list of the Anonymous names taken by a Dynamic Block (if any)-Lee Mac 2011-www.lee-mac.com;; Arguments:block- name of Dynamic Block.(defun AnonymousInstancesof ( block / def rec nme ref lst ) (while (setq def (tblnext "BLOCK" (null def)))   (if (= 1 (logand 1 (cdr (assoc 70 def))))   (progn       (setq rec         (entget         (cdr             (assoc 330               (entget               (tblobjname "BLOCK" (setq nme (cdr (assoc 2 def))))               )             )         )         )       )       (while (setq ref (assoc 331 rec))         (if         (and             (eq block (vla-get-effectivename (vlax-ename->vla-object (cdr ref))))             (not (member nme lst))         )         (setq lst (cons nme lst))         )         (setq rec (cdr (member (assoc 331 rec) rec)))       )   )   ) ) (reverse lst))

rlx 发表于 2022-7-5 16:20:06

Welcome on CadTutor Doctor_Che
 
 
Usually this error occurs when a block is not dynamic. Use this :
 
 

(setq object (vlax-ename->vla-object (cdr ref)))(if (vlax-property-available-p object 'effectivename)(setq block (vla-get-effectivename object))(setq block (vla-get-name object)))
gr. Rlx

Doctor_Che 发表于 2022-7-5 16:27:53

 
But if I understand good the problem is not with block...
I have tried this code with new clean file.

(print (AnonymousInstancesof "blockname"))
The result is "nil".
After I have inserted a table (just new empty table) into the file the result is "error: ActiveX Server returned the error: unknown name: EffectiveName".
So it is no block or dynamic block in file. Just a table (ACAD_TABLE).

rlx 发表于 2022-7-5 16:30:30

I'm not much of an expert on tables but assuming it is this (and not any other) function that's responsible for the error you can try :
 
 

(and (vlax-property-available-p (vlax-ename->vla-object (cdr ref)) 'effectivename) (eq block (vla-get-effectivename (vlax-ename->vla-object (cdr ref)))) (not (member nme lst)))
 
 
but I have no clue on this moment why this function would filter out a table in the first place.
 
 
gr. Rlx
页: [1] 2
查看完整版本: error: ActiveX Server returned