Author Topic: getting handle error....  (Read 123 times)

0 Members and 1 Guest are viewing this topic.


  • Water Moccasin
  • Posts: 2307
getting handle error....
« on: July 12, 2017, 10:19:12 am »
Hi all,..

in some case, I have this issue..

Code: [Select]
(setq blkobj (vla-handletoobject dbx_file "36B"))
Automation Error. Unknown handle

but the Handle is correct.
This situation happen only if the external file is open and user perform a QSAVE.
then,..the function vla-handletoobject  do not recognize the handle "36B"...but it still there.

I've made some research on the net and validate the presence of the "36B" handle with this awesomne LeeMac programmer...
it recognize the "36B" handle,...

here is the part of my code:

Code: [Select]
(setq xref-ename (handent sec_hand))
(setq vla-xref (vlax-ename->vla-object xref-ename))
(if (not dbx_file) (setq dbx_file (_dbxopenfile (vla-get-path vla-xref))))
(setq blkobj (vla-handletoobject dbx_file prim_hand));;<----ERROR

any help will be appreciated.
thank you.

Keep smile...


  • Swamp Rat
  • Posts: 1493
  • BricsCAD 16
Re: getting handle error....
« Reply #1 on: July 12, 2017, 04:14:43 pm »
This is a known issue of ODBX. The standard workaround is to make a temporary copy of the file.
But since you appear to be working with an xref using vla-get-xrefdatabase is probably more logical:
Code: [Select]
(setq db
      (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
      "A" ; "A" is the name of the xref.
(entget (vlax-vla-object->ename (vla-handletoobject db "AD"))) ; "AD" is the handle.