马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
Bind-as-Insert, using Visual LISP By Balaji Ramamoorthy
To perform a bind-as-insert of an Xref, using Visual LISP, here is a sample code.
By setting the BINDTYPE system variable to 1, a bind-as-insert is performed:
(setvar "BINDTYPE" 1)
(command "_-xref" "_bind" "MYBLOCK")
(setvar "BINDTYPE" 0)
Using Visual Lisp, the following code will accomplish the same task.
- (defun c:BindInsert ( / appAcad docActive colBlocks objBlk)
- (vl-load-com) ;load ActiveX
- (setq appAcad (vlax-get-acad-object)
- docActive (vla-get-ActiveDocument appAcad)
- ) ;setq
- ;;get the blocks collection
- (setq colBlocks (vla-get-blocks docActive))
- (vlax-for objBlk colBlocks
- ;;Is the block an xref?
- (if (= (vlax-get-property objBlk 'IsXref) :vlax-true)
- ;;if True, then bind it as an insert
- (vlax-invoke-method objBlk "bind" :vlax-true)
- ) ;if
- (vlax-release-object objBlk)
- ) ;vlax-for
- ;;release objects from memory
- (vlax-release-object colBlocks)
- (vlax-release-object docActive)
- )
- You might also like:
|