Revit API view template or scope box

Revit API view template or scope box

Anonymous
Not applicable
2,907 Views
3 Replies
Message 1 of 4

Revit API view template or scope box

Anonymous
Not applicable
Hello,
I'm trying to apply a view template or scope box to views that I have created through the api coding. I have googled and have not found a way to apply a predefined scope box or view template to the view. Can anyone help?
0 Likes
2,908 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
You can ask a view for it's viewtemplate ID by
doc.ActiveView.ViewTemplateId
You can also set an ViewtemplateId (it's just a parameter).

For scopeboxes have a look at Jeremy's blog :
http://thebuildingcoder.typepad.com/blog/2012/08/set-view-section-box-to-match-scope-box.html

maybe this will help you further. Good luck,
0 Likes
Message 3 of 4

Anonymous
Not applicable

Here is how I do it...

 

Set ViewTemplate if you know its name and/or Id

 

viewTempName = "My View Template";
View viewTemp = (from v in new FilteredElementCollector(doc).OfClass(typeof(View)).Cast<View>()
			    where v.IsTemplate == true && v.Name == viewTempName select v).First();
view.ViewTemplateId = viewTemp.Id;


To set a View's scope box, do it in the view's parameter VIEWER_VOLUME_OF_INTEREST_CROP

 

view.get_Parameter(BuiltInParameter.VIEWER_VOLUME_OF_INTEREST_CROP).Set(scopebox.Id);

 

 

 

 

Message 4 of 4

sujeev
Enthusiast
Enthusiast

Hi

 

I am trying to apply a scope box to a view. I got the scope box using fileteredelementcollector. But I am not getting the "get_parameter" code. I am creating the macro using sharp develop in the manage tab. Am i missing something? I am new to revit api. Could you please help on this. I am using revit 2015.

 

Regards

 

Sujeev

0 Likes