- UID
- 1
- 积分
- 15892
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-1-3
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
delete a database link with visual LISPIssue
How do I delete a database link from an entity using the CAO API and Visual LISP?
Solution
The following is a short Visual LISP example that prompts the user to select an object. It then deletes any links that are associated with that object.
(defun c:DLink ()
(vl-load-com) ; Get the object and get the object ID
(setq ent1 (car (entsel "\nSelect entity to erase links")))
(setq Obj (vlax-ename->vla-object ent1))
(setq ob_ID (vla-get-objectid Obj)) ; Instantiate the DBConnect object
(setq dbConnect (vlax-create-object "CAO.DbConnect.16")) ; Get the linkTemplates
(setq LTs (vlax-invoke-method dbConnect "GetLinkTemplates")) ; Get a linkTemplate named "EmployeeLink1", This
; linkTemplate
; can be created from the Employee table in the DB sample that ships with
; AutoCAD
(setq LT (vlax-invoke-method LTs "Item" "EmployeeLink1")) ; Get the links using The linkTemplate
(setq linkSel (vlax-invoke-method dbConnect "GetLinks" LT nil nil nil)) ; Iterate through the links and delete the
; link
; if it has the same ObjectID as the link
(vlax-for thisLink linkSel (setq l_Obj_ID (vlax-get-property thisLink "ObjectID"))
(if (= l_Obj_ID ob_ID)
(vla-delete thislink)
)
)
)
|
|