Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

search for sheet name containing....

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
904 Views, 2 Replies

search for sheet name containing....

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

2 REPLIES 2
Message 2 of 3
peterjegan
in reply to: Anonymous

Try this

 

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

 

Message 3 of 3
Anonymous
in reply to: peterjegan

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community