This is in the CHM file, and in intellisense but not much else is documented on it anywhere from what i can tell, not used in SDK sample, not in webcast labs, and nothing on google.
It seems simple, ApplyTemplate(viewtemplate as view). The problem I'm having, is how do I select my viewtemplate?
In revit when you try to apply a view template it shows you a list, how do I create myself a list like that?
Lets say for example, we have a view template called: "BW_Masonry Plan" I can see this as an element, with no category or other information. So I try to cast is as an Autodesk.Revit.Elements.View. This nulls it.
If I loop through all of the View elements in the document, BW_Masonry Plan never shows up.
So how is it that I can define that element as my view template?
Heres some code I've been trial and erroring, it's not well formed I realise that (I will clean it up as per the element efficiency thread) but I'm just trying things to get it to return a view.
private View GetAllViews(Document doc)
{
string ViewsList = " ";
ElementIterator itor = doc.Elements;
itor.Reset();
while (itor.MoveNext())
{
Element curelem = itor.Current as Autodesk.Revit.Element;
// Autodesk.Revit.Elements.View curelem = itor.Current as Autodesk.Revit.Elements.
if (null == curelem)
{
continue;
}
else
{
if (curelem.Name == "BW_Masonry Plan")
{
ViewsList += curelem.Name.ToString();
ViewsList += " ";
if (curelem.Category != null)
ViewsList += curelem.Category.Name.ToString();
ViewsList += " ";
if (curelem.ObjectType != null)
ViewsList += curelem.ObjectType.Name.ToString();
View ViewTemp = curelem as View;
return ViewTemp;
}
}
}
WF.MessageBox.Show("returning null");
return null;
}
Can anyone shed any light? Thanks!