Block Attribute Text Color
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good Day,
I am looking to go through a whole drawing and change the text color of any block attribute to say 0 as the drawings I am recieving have all the text at a weird color. I was unable to find anything on the forum. I already have a routine that changes text of certain blocks based on layer, but I want this to change the color. Any help would be great! Below is code I used for the layer change I talked about earlier.
publicstaticvoid strFind(string sFind, stringsReplace)
{
string str = "";
Document document = Application.DocumentManager.MdiActiveDocument;
Editoreditor = document.Editor;
Transactiontransaction = document.Database.TransactionManager.StartTransaction();
try
{
TypedValue[] valueArray = newTypedValue[] { newTypedValue(0, "TEXT") };
SelectionFilter filter = newSelectionFilter(valueArray);
PromptSelectionResultresult = editor.SelectAll(filter);
ObjectIdCollection ids = newObjectIdCollection(result.Value.GetObjectIds());
foreach (ObjectId id inids)
{
DBText text = (DBText) transaction.GetObject(id, OpenMode.ForWrite);
if(text.TextString.Contains(sFind))
{
str =
Regex.Replace(text.TextString, sFind, sReplace);
text.UpgradeOpen();
text.TextString = str;
text.UpgradeOpen();
}
}
transaction.Commit();
transaction.Dispose();
}