PDA

View Full Version : Bind an xref with VLISP



msretenovic
2004-09-15, 08:52 PM
Hi all,

I need a little help. I'm trying to bind an xref using VLISP. I'm having a problem with this statement:

(vla-bind blk :vlax-false) where blk is an xref (a block object from the block collection).

The error I recieve is this:

Automation Error. Key not found

I'm not too sure what it is wanting and would appreciate some help in trying to figure it out.

Thanks,

Jeff_M
2004-09-15, 09:38 PM
See if this helps you out.....


(defun XR-bind (bname)
(if (tblsearch "block" bname)
(progn
(setq blk2bind (vla-item
(vla-get-blocks
(vla-get-activedocument
(vlax-get-acad-object))) bname))
(if (eq (vla-get-isxref blk2bind) :vlax-true)
(vla-bind blk2bind :vlax-false)
(alert (strcat bname " is not an Xref...."))
)
)
(alert (strcat bname " is not a valid blockname....."))
)
)


Jeff

kennet.sjoberg
2004-09-16, 11:30 PM
Great miff, do you even know how to bind the xref as an Insert and not as Bind ?
( compare to the dialogbox, Xref Manager, Bind..., BindType, Bind or Insert )

Happy Computing !

kennet

kennet.sjoberg
2004-12-02, 11:46 PM
Yes ! Today I stumble on the answer :

BINDTYPE Controls how xref names are handled when binding xrefs or editing xrefs in place.

0 Traditional binding behavior ("xref1|one" becomes "xref$0$one")
1 Insert-like behavior ("xref1|one" becomes "one")

Just set the system variable before running the XR-bind

: ) Happy Computing !

kennet

vsichki537916
2011-08-24, 04:48 AM
Haleluja Kennet about BINDTYPE
Good job.

BlackBox
2011-08-24, 02:23 PM
If you wanted to avoid the *error* checking (to ensure the BINDTYPE SysVar is restored to it's original setting), you could always incorporate a GETKWORD statement for [Bind/Insert], then use vla-bind, or vla-insert respectively.

Just a thought.

alanjt
2011-08-24, 07:26 PM
Thread officially zombified!

BlackBox
2011-08-24, 07:44 PM
Thread officially zombified!

I totally overlooked the date(s). :banghead:

<<Hangs head in shame>>