本帖最后由 tgl121 于 2013-12-27 19:02 编辑
- (vl-load-com)
- ;本程序实现世界坐标系和所设置用户坐标系之间的循环切换
- (defun c:qh (/ x n) ;zbxLst坐标系名称表
- (if zbxLst
- (progn
- (setq n (length zbxLst))
- (if (= iii n)
- (progn (command "ucs" "")
- (command "plan" "")
- (setq iii 0)
- )
- (progn (command "ucs" "NA" "R" (nth iii zbxLst))
- (command "plan" "")
- (setq iii (+ 1 iii))
- )
- )
- )
- (progn
- (vlax-for x
- (vla-get-UserCoordinateSystems
- (vla-get-ActiveDocument (vlax-get-acad-object))
- )
- (setq zbxLst (cons (vla-get-name x) zbxLst))
- )
- (if zbxLst
- (progn
- (setq iii 0)
- (command "ucs" "NA" "R" (nth iii zbxLst))
- (command "plan" "")
- (setq iii (+ 1 iii))
- )
- (princ "当前CAD图形未建立用户坐标系!")
- )
- )
- )
- (princ)
- )
其中 (vlax-for x (vla-get-UserCoordinateSystems (vla-get-ActiveDocument (vlax-get-acad-object)))
(setq zbxLst (cons (vla-get-name x) zbxLst))
)
这段代码根据Gu_xl写的程序改了一下,谢谢Gu_xl |