تنظیم اشیاء ATTRIB و MTEXT
Contents
[
Hide
]تنظیم اشیاء ATTRIB و MTEXT
Aspose.CAD برای API جاوا به شما این امکان را میدهد که ویژگیها را در یک فایل DXF AutoCAD تنظیم کنید. API Aspose.CAD کلاسی به نام CadText را ارائه میدهد که نمایانگر موجودیتهای متنی در فایل DXF AutoCAD است. کلاس CadMText در API Aspose.CAD گنجانده شده است زیرا برخی دیگر از موجودیتها نیز ممکن است شامل متن باشند. شما میتوانید چندین پاراگراف متن را به عنوان یک شیء متن چندخطی (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
String srcFile = dataDir + "conic_pyramid.dxf"; | |
CadImage cadImage =(CadImage) Image.load(srcFile); | |
List<CadBaseEntity> mtextList = new ArrayList<CadBaseEntity>(); | |
List<CadBaseEntity> attribList = new ArrayList<CadBaseEntity>(); | |
try | |
{ | |
for (CadBaseEntity entity : cadImage.getEntities()) | |
{ | |
if (entity.getTypeName() == CadEntityTypeName.MTEXT) | |
{ | |
mtextList.add(entity); | |
} | |
if (entity.getTypeName() == CadEntityTypeName.INSERT) | |
{ | |
for (CadBaseEntity childObject : entity.getChildObjects()) | |
{ | |
if (childObject.getTypeName() == CadEntityTypeName.ATTRIB) | |
{ | |
attribList.add(childObject); | |
} | |
} | |
} | |
} | |
System.out.println("MText Size: "+ mtextList.size()); | |
System.out.println("Attribute Size: "+ attribList.size()); | |
} | |
finally | |
{ | |
cadImage.dispose(); | |
} | |