||
Python cad 实践一
from pyautocad import Autocad, APoint
import pandas as pd
acad = Autocad()
entities = acad.get_selection()
for entity in entities:
if "AcDbPolyline" in entity.ObjectName:
area = entity.Area
coordinate = entity.Coordinates
x=coordinate[::2]
y=coordinate[1::2]
xe=(min(x)+max(x))/2
ye=(min(y)+max(y))/2
apoint=APoint(xe,ye)
acad.model.AddText(str("%.2f"%area), apoint, 20.0)
data=pd.DataFrame()
data["x"]=pd.Series(list(x))
data["y"]=pd.Series(list(y))
data.to_csv("./1.csv")
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-11-24 06:59
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社