جستجوی ویژگی درون درج
Contents
[
Hide
]چگونه یک ویژگی را درون درج جستجو کنیم
مشکل: چگونه یک ویژگی را درون درج جستجو کنیم (CADNET-8050).
نکات: برای این کار، یک موجودیت با نوع CadEntityTypeName.ATTDEF دریافت کنید و در آن یک فیلد PromptString با مقدار “StringToSearch” داشته باشید.
مثال:
This file contains 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
foreach (CadBaseEntity entity in cadImage.Entities) | |
{ | |
if (entity.TypeName == CadEntityTypeName.INSERT) | |
{ | |
CadInsertObject insert = (CadInsertObject)entity; | |
bool stop = false; | |
CadBlockEntity block = cadImage.BlockEntities[insert.Name]; | |
foreach (CadBaseEntity e in block.Entities) | |
{ | |
if (e.TypeName == CadEntityTypeName.ATTDEF) | |
{ | |
CadAttDef attDef = (CadAttDef)e; | |
if (attDef.PromptString == "StringToSearch") | |
{ | |
newEntities.Remove(entity); | |
stop = true; | |
break; | |
} | |
} | |
} | |
if (stop) | |
{ | |
break; | |
} | |
} | |
} | |
cadImage.Entities = newEntities.ToArray(); | |
cadImage.UpdateSize(); |