search for sheet name containing....

search for sheet name containing....

Anonymous
Not applicable
1,094 Views
2 Replies
Message 1 of 3

search for sheet name containing....

Anonymous
Not applicable

Hi All,

After the very useful advice i got from the forum with my last problem i have now come accross another problem which i cant seem to solve.

 

I am trying to write a line of C# code which will search through all of the sheets in my project and select the first one in the list with a name which contains "Ground"

 

The best i have managed so far is to get an icollector which includes all sheets.

 

I am using Revit 2013.

 

Many thanks

Mike

0 Likes
Accepted solutions (1)
1,095 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

Try this

 

ElementId foundfirst = null;
foreach (ViewSheet vs in viewsheets)
{
	if (vs.Name.Contains("Ground"))
	{
		foundfirst = vs.Id;
		break;
	}
}

 

Message 3 of 3

Anonymous
Not applicable
Thanks Peter just what I was after works perfectly.
I thought it was something like that but just couldn't get my head around it.
0 Likes