This code adds MTEXT
text elements to an autocad drawing. I need the font of this text to be Arial
:
for coordinates in gold_marker_coords:
x, y, z, text_value = coordinates
m_text = ms.AddMText(APoint(x + 0.8, y - 1, z), 1, str(text_value))
m_text.Height = 1.5
m_text.Layer = 'Скважины'
In the Autocad object model I found only the StyleName text property. It only contains the names of the 'STANDARD' and 'Annotative' styles. I can't find anything about fonts. I know how to create a font manually in the document itself. But I need a way for pyautoca or win32com.
As Lee mentioned, set the fontFile property
def PyRxCmd_doit():
try:
axApp = Ax.getApp()
axDoc = axApp.ActiveDocument
ts = axApp.ActiveDocument.ActiveTextStyle
ts.fontFile = "c:\\windows\\fonts\\Symbol.ttf"
axDoc.ModelSpace.AddMText([0,0,0],1,"Hello world")
except Exception as err:
traceback.print_exception(err)