import win32com.client
import win32com.client as win32
from math import pi
acad = win32com.client.Dispatch('AutoCAD.Application')
doc = acad.ActiveDocument
msp = doc.ModelSpace
new_text_styles = doc.TextStyles.add('text_styles')
new_text_styles.Fontfile = '宋体.ttf'
new_text_styles.SetFont('黑体', 0, 0, 0, 0)
new_text_styles.Width = 0.7
new_text_styles.Height = 350
new_text_styles.ObliqueAngle = 45*pi/180
new_text_styles.BigFontFile = 'hztxt.shx'
print(new_text_styles.Height)
text = new_text_styles.Getfont()
print(text)
'黑体', False, False, 0, 0
new_text_styles.delete()
doc.ActiveTextStyle.Fontfile='ros.shx'
new_text_styles = doc.ActiveTextStyle
print(new_text_styles.name)
doc.ActiveTextStyle = doc.TextStyles['Standard']
new_text_styles = doc.TextStyles.add('text_styles')
a = new_text_styles.name
doc.ActiveTextStyle = doc.TextStyles[a]
print(new_text_styles.objectname)
print(doc.TextStyles.count)
n = doc.TextStyles.count
for i in range(n):
print(doc.TextStyles.item(i).name)
Python二次开发AutoCAD基础(九)-修改命令(删除、复制、移动、阵列等)
Python二次开发AutoCAD基础(五)-多行文字与设计说明
联系客服