TheSwamp
Code Red => .NET => Topic started by: David Hall on December 09, 2011, 09:43:55 AM
-
I am trying to optimize some code that searches out a single xref layer, and wanted to know if there is a better way than what I put together. It works just fine, but I wanted to make it better.
LayerTableRecord tempLayTR;
tempLayTR = tr.GetObject(tempLayId, OpenMode.ForWrite) as LayerTableRecord;
if (tempLayTR.Name.Contains("|SITE-FNDN"))
{
if (tempLayTR.Name.Substring(tempLayTR.Name.Length - 4) == "FNDN")
{
tempLayTR.Color = Color.FromColorIndex(ColorMethod.ByAci,1);
}
}
There could be multiple layers in the xref that contain the "|SITE-FNDN" ie XREFNAME|SITE-FNDN-TEXT as example.
Thoughts, ideas, etc.
-
Checking for LayerTableRecord.IsDependent = true will let you know if it is xref dependent
and might help.
-
or maybe combine the 2 statements into 1 like this maybe
if (tempLayTR.Name.Substring(tempLayTR.Name.Length - 10) == "|SITE-FNDN")