试试这个小代码,告诉我你的想法
-
- (defun
- c:test (/ this-dwg lko action)
- (vl-load-com)
- (setq this-dwg (vla-get-activedocument (vlax-get-acad-object)))
- (vla-zoomextents (vlax-get-acad-object))
- (vlax-for
- ol (vla-get-groups this-dwg)
- (if (/= (vla-get-count ol) 0)
- (progn
- (setq lko (ssadd))
- (vlax-for
- lk ol
- (setq lko (ssadd (vlax-vla-object->ename lk) lko))
- )
- (sssetfirst nil lko)
- (princ (strcat "\nGroup name " (setq gn (vla-get-name ol))))
- (initget 1 "D C")
- (setq action (getkword "\nSpecify action [[color=blue]Delete/[/color]Continue]: "))
- (cond
- [color=blue]((= action "D")[/color]
- [color=blue](vla-delete ol )[/color]
- [color=blue] (princ (strcat "\nGroup Name " gn " Deleted"))[/color]
- (setq lko (ssadd))
- )
- ((= action "C")
- (princ (strcat "\nGroup Name " gn " not deleted"))
- )
- )
- )
- )
- )
- (princ)
- )
我不久前开始的。不妨把它贴在这里 |