-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathThumbnailViewCreate.cs
More file actions
95 lines (61 loc) · 2.14 KB
/
Copy pathThumbnailViewCreate.cs
File metadata and controls
95 lines (61 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
* Created by SharpDevelop.
* User: julianvenczel
* Date: 12/09/2017
* Time: 11:48 AM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;
using System.Collections.Generic;
using System.Linq;
namespace viewCreate
{
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.DB.Macros.AddInId("17039D86-BDF6-41AC-A160-55E381F00A22")]
public partial class ThisDocument
{
private void Module_Startup(object sender, EventArgs e)
{
}
private void Module_Shutdown(object sender, EventArgs e)
{
}
#region Revit Macros generated code
private void InternalStartup()
{
this.Startup += new System.EventHandler(Module_Startup);
this.Shutdown += new System.EventHandler(Module_Shutdown);
}
#endregion
public void viewCreate()
{
Document doc = this.Application.ActiveUIDocument.Document;
// get a ViewFamilyType for a 3D View. created new instance of ViewFamilYType calle 'viewFamilyType'
ViewFamilyType viewFamilyType = (from v in new FilteredElementCollector(doc).
// Creates new filteredElementCollector to select all ViewFamilyTypes
OfClass(typeof(ViewFamilyType)).
Cast<ViewFamilyType>()
where v.ViewFamily == ViewFamily.ThreeDimensional
select v).First();
Categories categories = doc.Settings.Categories;
Category dim = categories.get_Item(BuiltInCategory.OST_Dimensions);
Category line = categories.get_Item(BuiltInCategory.OST_Lines);
using (Transaction t = new Transaction(doc,"Create view"))
{
t.Start();
View3D view = View3D.CreateIsometric(doc,viewFamilyType.Id);
view.HideCategoryTemporary(dim.Id);
view.HideCategoryTemporary(line.Id);
view.get_Parameter(BuiltInParameter.MODEL_GRAPHICS_STYLE)
.Set(4);
view.get_Parameter(BuiltInParameter.VIEW_NAME).Set("Thumbnail");
view.SaveOrientationAndLock();
t.Commit();
}
}
}
}