ATTRIBとMTEXTオブジェクトの設定
Contents
[
Hide
]ATTRIBとMTEXTオブジェクトの設定
Aspose.CAD for Python APIを使用すると、DXF AutoCADファイルに属性を設定できます。Aspose.CAD APIは、DXF AutoCADファイル内のテキストエンティティを表すCadTextクラスを公開しています。また、いくつかの他のエンティティもテキストを含む可能性があるため、CadMTextクラスがAspose.CAD APIに含まれています。複数の段落のテキストを1つのマルチラインテキスト(mtext)オブジェクトとして作成できます。以下は、属性とMTEXTオブジェクトを設定するコードのデモです。このコードスニペットは自己説明的です。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |