Setting ATTRIB and MTEXT objects
Setting ATTRIB and MTEXT objects
Aspose.CAD for Python API allows you to set Attribute in a DXF AutCAD file. Aspose.CAD API exposes the CadText class that represents text entities in the DXF AutoCAD file. The CadMText class is included in the Aspose.CAD API because some other entities may also contain text. You can create several paragraphs of text as a single multi-line text (mtext) object. Following is the code demonstration of setting Attribute and MTEXT objects. The code snippet is self-explanatory.
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) |