zdqwy19 发表于 2012-10-25 00:25 
我一张图中绘图,尺寸、坐标等数据在另一张图纸中以文字形式存在。我在需要绘图的图纸上输入命令,然后在 ...
给个简单示例:
 - (defun c:tt()
- ;;同时打开aa.dwg 和 bb.dwg,aa.dwg保存数据,bb.dwg作图,在bb.dwg上运行该程序
- (setq docs (vla-get-Documents (vlax-get-acad-object))
- doc1 (vla-get-ActiveDocument (vlax-get-acad-object))
- )
- (vlax-for doc docs
- (if (= "aa" (VL-FILENAME-BASE (vla-get-FullName doc)))
- (setq doc2 doc)
- )
- )
- ;;开始绘图
- (princ "\n请切换到bb.dwg选择坐标文字,返回后任意键继续:")
- (command pause)
- (command "_line")
- (setq ss (vla-get-ActiveSelectionSet doc2))
- (vlax-for obj ss
- (if (= "AcDbText" (vla-get-ObjectName obj))
- (command "_non" (vla-get-TextString obj))
- )
- )
- (command "c")
- (vla-delete ss)
- (princ)
- )
|