vla-bind Error

vla-bind Error

Anonymous
Not applicable
2,358 Views
10 Replies
Message 1 of 11

vla-bind Error

Anonymous
Not applicable

I am trying to bind the Xref in a drawing, without open that drawing. I have 120 drawings to bind.

I have tried below coding.

 

(setq ver (substr (vla-get-version (vla-get-application (vla-get-activedocument (vlax-get-acad-object)))) 1 2))
(setq DbDoc (strcat "ObjectDBX.AxDbDocument." ver))
(setq DdBx (vla-getinterfaceobject (vlax-get-acad-object) DbDoc))
(setq cFile (getfiled "Select Drawing File" "" "dwg" 4))
(vlax-invoke-method DdBx 'open cFile)
(setq blk (vla-get-blocks DdBx))
(setq n 0)
(repeat (vla-get-count blk)
(setq item (vla-item blk n))
(if (eq (vla-get-isxref item) :vlax-true)
(prong
(vla-bind item :vlax-false)
);prong
);if
(setq n (1+ n))
);repeat

But It returns the error. "Automation Error.Key Not Found"

 

 

 

Please help in this.

Thanks in advance

STM

0 Likes
Accepted solutions (2)
2,359 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable

Why don't use command: _etransmit ?

0 Likes
Message 3 of 11

Anonymous
Not applicable

No. I want to bind the Xref.

0 Likes
Message 4 of 11

Anonymous
Not applicable

We are always bind all xref in multi file via command : _etransmit

 

Try it .!

0 Likes
Message 5 of 11

Anonymous
Not applicable

Ok. What is the Problem with vla-bind ?

0 Likes
Message 6 of 11

Anonymous
Not applicable

I think: 

 

(if (eq (vla-get-isxref item) :vlax-true)
(prong ;;;<---------------------------syntax error ?

(vla-bind item :vlax-false)
);prong
);if

 

0 Likes
Message 7 of 11

Anonymous
Not applicable

Sorry. t's a typing error.

its "(progn" only.

But this mistake is not the problem.

 

 

 

STM

0 Likes
Message 8 of 11

Anonymous
Not applicable
Accepted solution

As far as i know, you can not bind xref via DBX.

 

Try for block. Or _ETRANSMIT

 

Good luck.

 

 

Message 9 of 11

Shneuph
Collaborator
Collaborator
Accepted solution

All I can say is this code works with the file open in AutoCAD but when I try with your DdBx method it fails with that error.  Has something to do with not having the file open?

 

(vlax-for tlv-block tlv-blk
  (if (and (not (= (vla-get-name tlv-block) "*Model_Space"))
	   (not (= (vla-get-name tlv-block) "*Paper_Space"))
	   (= (vla-get-isxref tlv-block) :vlax-true)
	   );and
    (vla-bind tlv-block :vlax-true)
    );if
  );vlax-for
---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 10 of 11

Anonymous
Not applicable

Thanks Pony and Shneuph for the reply.

STM

 

0 Likes
Message 11 of 11

Anonymous
Not applicable

Hello thavasi.

 

Perhaps you did solve it yet, but perhaps it can help.

 

The question is that the Vla-Bind function does not require the drawing where it applies to, so it allways try to bind the reference into the active drawing (even if it is inserted into another one). That's why it shows an error.

 

I've solve this issue creating a simple text file at a trusted location (the file acaddoc.lsp) with the autoexecutable routine on file open, and deleting it at the end of the process.

 

The routine is something like this:

(defun s::startup ()
     (command "-xref" "b" "*")
     (command "saveas" 2013 (strcat (getvar "dwgprefix") "Binded\\" (getvar "dwgname")))
     (command "close")
)

 

The main routine will have to open all the required files. I've detected that the files opened via VLA-OPEN routine does not execute the acaddoc.lsp routines, so I reccomend to use the (Command "-open"...) function.

 

Hope that it will help.

0 Likes