Impostazione degli oggetti ATTRIB e MTEXT

Impostazione degli oggetti ATTRIB e MTEXT

Aspose.CAD per Python API consente di impostare l’Attributo in un file DXF di AutoCAD. Aspose.CAD API espone la classe CadText che rappresenta entità di testo nel file DXF di AutoCAD. La classe CadMText è inclusa nell’API Aspose.CAD perché alcune altre entità possono contenere anche testo. Puoi creare diversi paragrafi di testo come un singolo oggetto di testo multi-linea (mtext). Di seguito è riportata la dimostrazione del codice per impostare gli oggetti Attributo e MTEXT. Il frammento di codice è autoesplicativo.

import aspose.cad as cad
from aspose.pycore import cast
image = cad.fileformats.cad.CadImage.load("file.dxf")
castedImage = cast(cad.fileformats.cad.CadImage, image)
mtextList = []
attribList = []
for entity in castedImage.entities:
if entity.type_name == cad.fileformats.cad.cadconsts.CadEntityTypeName.MTEXT:
mtextList.append(entity)
if entity.type_name == cad.fileformats.cad.cadconsts.CadEntityTypeName.INSERT:
for childObject in entity.child_objects:
if childObject.type_name == cad.fileformats.cad.cadconsts.CadEntityTypeName.ATTRIB:
attribList.append(childObject)