看过一篇文章在已知的坐标点插入块,受到启发但是不知道坐标点怎么办,所以先点选存到表格里。好了不啰嗦了上代码
from pyautocad import Autocad
from pyautocad import APoint
# 连接cad
acad = Autocad(create_if_not_exists=True)
acad.prompt("Hello! AutoCAD from pyautocad.")
acaduti = acad.doc.Utility
print(acad.doc.Name)
#tuyuanming = acaduti.Entlast
#a = acaduti.getint(0,"输入一个实数")
zongji = []
#xunhuan = ""
try:
while True:
point1 = acaduti.Getpoint(APoint(1,1), "请选取一个点")
zongji.append(list(point1))
acad.prompt('你已经选择了:%i'%(len(zongji)))
#xunhuan = acaduti.GetString(0, "空格继续,任意键退出")
except:
acad.prompt('运行完毕已退出')
import xlwt
workbook = xlwt.Workbook(encoding='utf-8') # 创建workbook 对象
worksheet = workbook.add_sheet('sheet1') # 创建工作表sheet
for x in range(len(zongji)):
for y in range(len(zongji[x])):
worksheet.write(x,y,zongji[x][y]) # 往表里写内容