-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateSheetByView
65 lines (53 loc) · 1.88 KB
/
CreateSheetByView
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
using System;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;
using System.Collections.Generic;
using System.Linq;
namespace CREARESHEETS
{
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.DB.Macros.AddInId("E412E516-22B4-440E-B207-642907AE06C7")]
public partial class ThisApplication
{
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 CREATE()
{
string SHEETNAME = "ИМЯ ЛИСТА"; //ИМЯ ЛИСТА (Sheet name)
int SHEETNUMBER = 1; //НАЧАЛЬНЫЙ НОМЕР ЛИСТА (Starting number)
XYZ xyz = new XYZ(1, 1, 0); // Координаты расположения вида на листе(Coordinate for place view on the sheet)
UIDocument uidoc = this.ActiveUIDocument;
Document doc = uidoc.Document;
FilteredElementCollector titleblock = new FilteredElementCollector(doc)
.OfClass(typeof(FamilySymbol))
.OfCategory(BuiltInCategory.OST_TitleBlocks);
FamilySymbol titleBlock = titleblock.FirstElement() as FamilySymbol;
ICollection<ElementId> selectViews = uidoc.Selection.GetElementIds(); // Выделение видов (Select views)
using (Transaction tr = new Transaction(doc))
{
tr.Start("Create Sheets");
foreach (ElementId sv in selectViews)
{
ViewSheet createSheet = ViewSheet.Create(doc, titleBlock.Id);
createSheet.SheetNumber = SHEETNUMBER.ToString();
createSheet.Name = SHEETNAME;
Viewport.Create(doc, sheetCr.Id, sv, xyz);
SHEETNUMBER++;
}
tr.Commit();
}
}
}
}