├── Snippets
└── snippet01
│ ├── snippet01.cs
│ └── snippet01.vb
├── Macros
├── Macros.txt
├── copyProjectToProject
│ ├── Test.rvt
│ └── copyProj2Proj.vb
├── placeFamilyInRoom
│ ├── PlaceinRoom.rvt
│ └── placeInRoom.cs
├── placeViewsOnSheet
│ ├── ViewsOnSheets.rvt
│ └── placeViewsOnSheets.cs
├── getCollection
│ ├── getCollection.vb
│ └── getCollection.cs
├── hideCropRegions
│ └── hideCropRegions.vb
├── turnOffUnderlay
│ └── turnOffUnderlay.vb
├── exportTxt
│ ├── exportTxt.vb
│ └── exportTxt.cs
├── doorTagUpdate
│ ├── doorTagUpdate.cs
│ └── doorTagUpdate.vb
├── createRenameViews
│ ├── createRenameViews.cs
│ └── createRenameViews.vb
├── README.md
├── wallSelection
│ ├── wallSelection.cs
│ └── wallSelection.vb
├── renameExportDWG
│ ├── renameExportDWG.vb
│ └── renameExportDWG.cs
├── importTxt
│ ├── importTxt.cs
│ └── importTxt.vb
├── deleteElements
│ ├── deleteElements.cs
│ └── deleteElements.vb
├── hideSetColour
│ ├── hideSetColour.cs
│ └── hideSetColour.vb
└── interiorFloorByRoom
│ └── interiorFloorByRoom.cs
├── Visual Studio Projects
├── Learning
│ ├── Ex1.0
│ │ ├── Ex1.0
│ │ │ ├── obj
│ │ │ │ └── Debug
│ │ │ │ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ │ │ │ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ │ │ │ │ ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
│ │ │ │ │ ├── Ex1.0.csproj.FileListAbsolute.txt
│ │ │ │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ │ │ │ ├── Ex1.0_MarkupCompile.i.cache
│ │ │ │ │ └── App.g.i.cs
│ │ │ ├── bin
│ │ │ │ └── Debug
│ │ │ │ │ ├── Ex1.0.vshost.exe
│ │ │ │ │ ├── Ex1.0.exe.config
│ │ │ │ │ ├── Ex1.0.vshost.exe.config
│ │ │ │ │ └── Ex1.0.vshost.exe.manifest
│ │ │ ├── App.config
│ │ │ ├── Properties
│ │ │ │ ├── Settings.settings
│ │ │ │ ├── Settings.Designer.cs
│ │ │ │ ├── AssemblyInfo.cs
│ │ │ │ └── Resources.Designer.cs
│ │ │ ├── App.xaml
│ │ │ ├── App.xaml.cs
│ │ │ ├── MainWindow.xaml.cs
│ │ │ ├── MainWindow.xaml
│ │ │ ├── Exercises
│ │ │ │ ├── Ex1.1.cs
│ │ │ │ ├── Ex1.2.cs
│ │ │ │ ├── Ex1.3.cs
│ │ │ │ └── Ex1.4.cs
│ │ │ └── Ex1.0.csproj
│ │ ├── Ex1.0.v11.suo
│ │ └── Ex1.0.sln
│ ├── Ex2.0
│ │ ├── Ex2.0
│ │ │ ├── obj
│ │ │ │ └── Debug
│ │ │ │ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ │ │ │ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ │ │ │ │ ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
│ │ │ │ │ ├── Ex2.0.exe
│ │ │ │ │ ├── Ex2.0.pdb
│ │ │ │ │ ├── Ex2.0.g.resources
│ │ │ │ │ ├── MainWindow.baml
│ │ │ │ │ ├── Ex2.0.csproj.GenerateResource.Cache
│ │ │ │ │ ├── Ex2._0.Properties.Resources.resources
│ │ │ │ │ ├── Ex2.0.csprojResolveAssemblyReference.cache
│ │ │ │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ │ │ │ ├── Ex2.0_MarkupCompile.cache
│ │ │ │ │ ├── Ex2.0_MarkupCompile.i.cache
│ │ │ │ │ ├── Ex2.0.csproj.FileListAbsolute.txt
│ │ │ │ │ ├── App.g.cs
│ │ │ │ │ └── App.g.i.cs
│ │ │ ├── bin
│ │ │ │ └── Debug
│ │ │ │ │ ├── Ex2.0.exe
│ │ │ │ │ ├── Ex2.0.pdb
│ │ │ │ │ ├── Ex2.0.vshost.exe
│ │ │ │ │ ├── Ex2.0.exe.config
│ │ │ │ │ ├── Ex2.0.vshost.exe.config
│ │ │ │ │ └── Ex2.0.vshost.exe.manifest
│ │ │ ├── App.config
│ │ │ ├── Properties
│ │ │ │ ├── Settings.settings
│ │ │ │ ├── Settings.Designer.cs
│ │ │ │ ├── AssemblyInfo.cs
│ │ │ │ └── Resources.Designer.cs
│ │ │ ├── Exercises
│ │ │ │ └── Ex2.1.cs
│ │ │ ├── App.xaml
│ │ │ ├── App.xaml.cs
│ │ │ ├── MainWindow.xaml
│ │ │ ├── Ex2.0.csproj
│ │ │ └── MainWindow.xaml.cs
│ │ ├── Ex2.0.v11.suo
│ │ └── Ex2.0.sln
│ └── APISetup
│ │ ├── Application
│ │ ├── Application.v11.suo
│ │ ├── Application
│ │ │ ├── Properties
│ │ │ │ └── AssemblyInfo.cs
│ │ │ ├── bin
│ │ │ │ └── Debug
│ │ │ │ │ ├── Application.dll
│ │ │ │ │ └── Application.pdb
│ │ │ ├── obj
│ │ │ │ └── Debug
│ │ │ │ │ ├── Application.dll
│ │ │ │ │ ├── Application.pdb
│ │ │ │ │ ├── UserControl1.baml
│ │ │ │ │ ├── Application.g.resources
│ │ │ │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ │ │ │ ├── Application.csprojResolveAssemblyReference.cache
│ │ │ │ │ ├── Application_MarkupCompile.cache
│ │ │ │ │ ├── Application_MarkupCompile.i.cache
│ │ │ │ │ ├── Application.csproj.FileListAbsolute.txt
│ │ │ │ │ └── UserControl1.g.cs
│ │ │ ├── Application.addin
│ │ │ ├── UserControl1.xaml
│ │ │ ├── Command.cs
│ │ │ ├── App.cs
│ │ │ ├── Application.csproj
│ │ │ ├── UserControl1.xaml.cs
│ │ │ └── examplecommands.cs
│ │ └── Application.sln
│ │ └── NewCommands
│ │ ├── NewCommands.v11.suo
│ │ ├── NewCommands
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── bin
│ │ │ └── Debug
│ │ │ │ ├── NewCommands.dll
│ │ │ │ └── NewCommands.pdb
│ │ ├── obj
│ │ │ └── Debug
│ │ │ │ ├── NewCommands.dll
│ │ │ │ ├── NewCommands.pdb
│ │ │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ │ │ ├── NewCommands.csprojResolveAssemblyReference.cache
│ │ │ │ └── NewCommands.csproj.FileListAbsolute.txt
│ │ ├── NewCommands.addin
│ │ ├── App.cs
│ │ ├── Command.cs
│ │ └── NewCommands.csproj
│ │ └── NewCommands.sln
├── WPFExamples
│ └── Bonus Stuff
│ │ └── CheckListFromRevit
│ │ ├── CheckListFromRevit.v11.suo
│ │ ├── CheckListFromRevit
│ │ ├── Properties
│ │ │ └── AssemblyInfo.cs
│ │ ├── obj
│ │ │ └── Debug
│ │ │ │ ├── checkwindow.baml
│ │ │ │ ├── CheckListFromRevit.dll
│ │ │ │ ├── CheckListFromRevit.pdb
│ │ │ │ ├── CheckListFromRevit.g.resources
│ │ │ │ ├── DesignTimeResolveAssemblyReferences.cache
│ │ │ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ │ │ ├── CheckListFromRevit.csprojResolveAssemblyReference.cache
│ │ │ │ ├── CheckListFromRevit_MarkupCompile.cache
│ │ │ │ ├── CheckListFromRevit_MarkupCompile.i.cache
│ │ │ │ ├── CheckListFromRevit.csproj.FileListAbsolute.txt
│ │ │ │ ├── UserControl1.g.i.cs
│ │ │ │ ├── checkwindow.g.cs
│ │ │ │ └── checkwindow.g.i.cs
│ │ ├── bin
│ │ │ └── Debug
│ │ │ │ ├── CheckListFromRevit.dll
│ │ │ │ └── CheckListFromRevit.pdb
│ │ ├── App.cs
│ │ ├── checkwindow.xaml
│ │ ├── CheckListFromRevit.addin
│ │ ├── Command.cs
│ │ ├── checkwindow.xaml.cs
│ │ └── CheckListFromRevit.csproj
│ │ └── CheckListFromRevit.sln
└── README.md
├── Reference
├── Revit Lookup
│ ├── RevitLookup.dll
│ └── RevitLookup.addin
├── Handouts
│ ├── Revit API talk 1.pdf
│ ├── Revit API talk 2.pdf
│ └── Revit API talk 3.pdf
├── Wizards
│ └── revit2014addinwizardcs-1.zip
├── Cheat sheets
│ ├── RTC2014 Revit Cheat Sheet 2 of 2.pdf
│ └── C# Cheat Sheet THE CODING GUYS 1 of 2.pdf
└── README.md
├── Dynamo
├── README.md
├── 0.6.3
│ └── getTypesFromList.py
└── 0.7.6
│ └── template.py
├── LICENSE
└── README.md
/Snippets/snippet01/snippet01.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Snippets/snippet01/snippet01.vb:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Macros/Macros.txt:
--------------------------------------------------------------------------------
1 | All Macro files will be place here for use by others.
2 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Macros/copyProjectToProject/Test.rvt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Macros/copyProjectToProject/Test.rvt
--------------------------------------------------------------------------------
/Reference/Revit Lookup/RevitLookup.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Reference/Revit Lookup/RevitLookup.dll
--------------------------------------------------------------------------------
/Macros/placeFamilyInRoom/PlaceinRoom.rvt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Macros/placeFamilyInRoom/PlaceinRoom.rvt
--------------------------------------------------------------------------------
/Reference/Handouts/Revit API talk 1.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Reference/Handouts/Revit API talk 1.pdf
--------------------------------------------------------------------------------
/Reference/Handouts/Revit API talk 2.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Reference/Handouts/Revit API talk 2.pdf
--------------------------------------------------------------------------------
/Reference/Handouts/Revit API talk 3.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Reference/Handouts/Revit API talk 3.pdf
--------------------------------------------------------------------------------
/Macros/placeViewsOnSheet/ViewsOnSheets.rvt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Macros/placeViewsOnSheet/ViewsOnSheets.rvt
--------------------------------------------------------------------------------
/Reference/Wizards/revit2014addinwizardcs-1.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Reference/Wizards/revit2014addinwizardcs-1.zip
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0.v11.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/Ex1.0/Ex1.0.v11.suo
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/obj/Debug/Ex1.0.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | G:\RTC2014\API\Forms\Ex1.0\Ex1.0\bin\Debug\Ex1.0.exe.config
2 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0.v11.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/Ex2.0/Ex2.0.v11.suo
--------------------------------------------------------------------------------
/Reference/Cheat sheets/RTC2014 Revit Cheat Sheet 2 of 2.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Reference/Cheat sheets/RTC2014 Revit Cheat Sheet 2 of 2.pdf
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/bin/Debug/Ex2.0.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/Ex2.0/Ex2.0/bin/Debug/Ex2.0.exe
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/bin/Debug/Ex2.0.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/Ex2.0/Ex2.0/bin/Debug/Ex2.0.pdb
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/Ex2.0.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/Ex2.0.exe
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/Ex2.0.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/Ex2.0.pdb
--------------------------------------------------------------------------------
/Reference/Cheat sheets/C# Cheat Sheet THE CODING GUYS 1 of 2.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Reference/Cheat sheets/C# Cheat Sheet THE CODING GUYS 1 of 2.pdf
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/bin/Debug/Ex1.0.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/Ex1.0/Ex1.0/bin/Debug/Ex1.0.vshost.exe
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/bin/Debug/Ex2.0.vshost.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/Ex2.0/Ex2.0/bin/Debug/Ex2.0.vshost.exe
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/Ex2.0.g.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/Ex2.0.g.resources
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/MainWindow.baml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/MainWindow.baml
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application.v11.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/Application/Application.v11.suo
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands.v11.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands.v11.suo
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/Application/Application/Properties/AssemblyInfo.cs
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/bin/Debug/Application.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/Application/Application/bin/Debug/Application.dll
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/bin/Debug/Application.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/Application/Application/bin/Debug/Application.pdb
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/obj/Debug/Application.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/Application/Application/obj/Debug/Application.dll
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/obj/Debug/Application.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/Application/Application/obj/Debug/Application.pdb
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/Properties/AssemblyInfo.cs
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/bin/Debug/NewCommands.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/bin/Debug/NewCommands.dll
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/bin/Debug/NewCommands.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/bin/Debug/NewCommands.pdb
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/obj/Debug/NewCommands.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/obj/Debug/NewCommands.dll
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/obj/Debug/NewCommands.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/obj/Debug/NewCommands.pdb
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/Ex2.0.csproj.GenerateResource.Cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/Ex2.0.csproj.GenerateResource.Cache
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/Ex2._0.Properties.Resources.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/Ex2._0.Properties.Resources.resources
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/obj/Debug/UserControl1.baml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/Application/Application/obj/Debug/UserControl1.baml
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit.v11.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit.v11.suo
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/Ex2.0.csprojResolveAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/Ex2.0.csprojResolveAssemblyReference.cache
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/obj/Debug/Application.g.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/Application/Application/obj/Debug/Application.g.resources
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/Ex1.0/Ex1.0/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/bin/Debug/Ex1.0.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/bin/Debug/Ex2.0.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/Properties/AssemblyInfo.cs
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/checkwindow.baml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/checkwindow.baml
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/bin/Debug/Ex1.0.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/bin/Debug/Ex2.0.vshost.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/bin/Debug/CheckListFromRevit.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/bin/Debug/CheckListFromRevit.dll
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/bin/Debug/CheckListFromRevit.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/bin/Debug/CheckListFromRevit.pdb
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/CheckListFromRevit.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/CheckListFromRevit.dll
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/CheckListFromRevit.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/CheckListFromRevit.pdb
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/Application/Application/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/obj/Debug/Application.csprojResolveAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/Application/Application/obj/Debug/Application.csprojResolveAssemblyReference.cache
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/obj/Debug/NewCommands.csprojResolveAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/obj/Debug/NewCommands.csprojResolveAssemblyReference.cache
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/Exercises/Ex2.1.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace Ex2._0.Exercises
8 | {
9 | class Ex2
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/CheckListFromRevit.g.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/CheckListFromRevit.g.resources
--------------------------------------------------------------------------------
/Dynamo/README.md:
--------------------------------------------------------------------------------
1 | Dynamo Python Scripts
2 | ========
3 |
4 | A list of various Python scripts you can embed into your Dynamo nodes.
5 |
6 | You need to use the Python scripting node or multiple Python scripting node if there is more then one outcome.
7 |
8 | Just copy the script data into a new Python node in Dynamo
9 |
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/DesignTimeResolveAssemblyReferences.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/DesignTimeResolveAssemblyReferences.cache
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/CheckListFromRevit.csprojResolveAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Gytaco/RevitAPI/HEAD/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/CheckListFromRevit.csprojResolveAssemblyReference.cache
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/Ex2.0_MarkupCompile.cache:
--------------------------------------------------------------------------------
1 | Ex2.0
2 |
3 |
4 | winexe
5 | C#
6 | .cs
7 | G:\RTC2014\API\Forms\Ex2.0\Ex2.0\obj\Debug\
8 | Ex2._0
9 | none
10 | false
11 | DEBUG;TRACE
12 | G:\RTC2014\API\Forms\Ex2.0\Ex2.0\App.xaml
13 | 11151548125
14 |
15 | 6-1916828737
16 | 12-1401562060
17 | MainWindow.xaml;
18 |
19 | False
20 |
21 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/obj/Debug/Ex1.0_MarkupCompile.i.cache:
--------------------------------------------------------------------------------
1 | Ex1.0
2 |
3 |
4 | winexe
5 | C#
6 | .cs
7 | G:\RTC2014\API\Forms\Ex1.0\Ex1.0\obj\Debug\
8 | Ex1._0
9 | none
10 | false
11 | DEBUG;TRACE
12 | G:\RTC2014\API\Forms\Ex1.0\Ex1.0\App.xaml
13 | 11151548125
14 |
15 | 13-923306594
16 | 12-1401562060
17 | MainWindow.xaml;
18 |
19 | False
20 |
21 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/Ex2.0_MarkupCompile.i.cache:
--------------------------------------------------------------------------------
1 | Ex2.0
2 |
3 |
4 | winexe
5 | C#
6 | .cs
7 | G:\RTC2014\API\Forms\Ex2.0\Ex2.0\obj\Debug\
8 | Ex2._0
9 | none
10 | false
11 | DEBUG;TRACE
12 | G:\RTC2014\API\Forms\Ex2.0\Ex2.0\App.xaml
13 | 11151548125
14 |
15 | 10-63260343
16 | 12-1401562060
17 | MainWindow.xaml;
18 |
19 | False
20 |
21 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/obj/Debug/Application_MarkupCompile.cache:
--------------------------------------------------------------------------------
1 | Application
2 |
3 |
4 | library
5 | C#
6 | .cs
7 | G:\RTC2014\API\Forms\Application\Application\obj\Debug\
8 | Application
9 | none
10 | false
11 | DEBUG;TRACE
12 |
13 | 1-98425716
14 |
15 | 5301585156
16 | 141964885060
17 | UserControl1.xaml;
18 |
19 | False
20 |
21 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/obj/Debug/Application_MarkupCompile.i.cache:
--------------------------------------------------------------------------------
1 | Application
2 |
3 |
4 | library
5 | C#
6 | .cs
7 | G:\RTC2014\API\Forms\Application\Application\obj\Debug\
8 | Application
9 | none
10 | false
11 | DEBUG;TRACE
12 |
13 | 1-98425716
14 |
15 | 6-1640714249
16 | 141964885060
17 | UserControl1.xaml;
18 |
19 | False
20 |
21 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace Ex1._0
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace Ex2._0
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/CheckListFromRevit_MarkupCompile.cache:
--------------------------------------------------------------------------------
1 | CheckListFromRevit
2 |
3 |
4 | library
5 | C#
6 | .cs
7 | C:\Users\Gytaco\Documents\Visual Studio 2012\Projects\CheckListFromRevit\CheckListFromRevit\obj\Debug\
8 | CheckListFromRevit
9 | none
10 | false
11 | DEBUG;TRACE
12 |
13 | 1-531661720
14 |
15 | 41526373465
16 | 141964885060
17 | checkwindow.xaml;
18 |
19 | False
20 |
21 |
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/CheckListFromRevit_MarkupCompile.i.cache:
--------------------------------------------------------------------------------
1 | CheckListFromRevit
2 |
3 |
4 | library
5 | C#
6 | .cs
7 | C:\Users\Gytaco\Documents\Visual Studio 2012\Projects\CheckListFromRevit\CheckListFromRevit\obj\Debug\
8 | CheckListFromRevit
9 | none
10 | false
11 | DEBUG;TRACE
12 |
13 | 1-531661720
14 |
15 | 5-415925940
16 | 141964885060
17 | checkwindow.xaml;
18 |
19 | False
20 |
21 |
--------------------------------------------------------------------------------
/Reference/Revit Lookup/RevitLookup.addin:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | RevitLookup.dll
5 | 356CDA5A-E6C5-4c2f-A9EF-B3222116B8C8
6 | RevitLookup.App
7 | Revit Lookup
8 | ADSK
9 | Autodesk, www.autodesk.com
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/obj/Debug/NewCommands.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | G:\RTC2014\API\Forms\NewCommands\NewCommands\bin\Debug\NewCommands.dll
2 | G:\RTC2014\API\Forms\NewCommands\NewCommands\bin\Debug\NewCommands.pdb
3 | G:\RTC2014\API\Forms\NewCommands\NewCommands\obj\Debug\NewCommands.csprojResolveAssemblyReference.cache
4 | G:\RTC2014\API\Forms\NewCommands\NewCommands\obj\Debug\NewCommands.dll
5 | G:\RTC2014\API\Forms\NewCommands\NewCommands\obj\Debug\NewCommands.pdb
6 |
--------------------------------------------------------------------------------
/Reference/README.md:
--------------------------------------------------------------------------------
1 | Handouts and other Files
2 | ======
3 |
4 | This contains some basic handouts and other information for the classes.
5 |
6 | The lookup .dll and .addin are from the Building Coder and allow you to look through your projects.
7 | Just put these in the Addins folder in user accounts.
8 |
9 | The zip file is for Visual Studio to automate setting up projects, this is also from the building coder with a slight customisation to work with Revit not Revit Architecture. Put this in your documents Visual Studio C# templates area.
10 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/bin/Debug/Ex1.0.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/bin/Debug/Ex2.0.vshost.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/NewCommands.addin:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Get Wall Date
5 | Returns data about a wall
6 | NewCommands.dll
7 | NewCommands.GetSelection
8 | 740d1afb-8999-4d25-8a1a-5b5dce3fd958
9 | TBC_
10 | The Building Coder, http://thebuildingcoder.typepad.com
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/App.cs:
--------------------------------------------------------------------------------
1 | #region Namespaces
2 | using System;
3 | using System.Collections.Generic;
4 | using Autodesk.Revit.ApplicationServices;
5 | using Autodesk.Revit.Attributes;
6 | using Autodesk.Revit.DB;
7 | using Autodesk.Revit.UI;
8 | #endregion
9 |
10 | namespace NewCommands
11 | {
12 | class App : IExternalApplication
13 | {
14 | public Result OnStartup(UIControlledApplication a)
15 | {
16 | return Result.Succeeded;
17 | }
18 |
19 | public Result OnShutdown(UIControlledApplication a)
20 | {
21 | return Result.Succeeded;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Visual Studio Projects/README.md:
--------------------------------------------------------------------------------
1 | Visual Studio Projects
2 | ======
3 |
4 | This is where entire projects are kept.
5 |
6 | Each project file contains a .csproj file and will do various things.
7 | As people create their own I hope they will share them and we can all help each other creating new stuff.
8 |
9 | The Learning Folder has some basic exercises from the handouts and also completed "newcommand" and "Application" Visual project to enable users to create their own UI's or simple commands rather then just using Macro's.
10 |
11 | THe UI Folder has a simple project showing how a user can create a list using WPF format.
12 |
13 | Other folders will be created and code shared as the need arises.
14 |
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/App.cs:
--------------------------------------------------------------------------------
1 | #region Namespaces
2 | using System;
3 | using System.Collections.Generic;
4 | using Autodesk.Revit.ApplicationServices;
5 | using Autodesk.Revit.Attributes;
6 | using Autodesk.Revit.DB;
7 | using Autodesk.Revit.UI;
8 | #endregion
9 |
10 | namespace CheckListFromRevit
11 | {
12 | class App : IExternalApplication
13 | {
14 | public Result OnStartup(UIControlledApplication a)
15 | {
16 | return Result.Succeeded;
17 | }
18 |
19 | public Result OnShutdown(UIControlledApplication a)
20 | {
21 | return Result.Succeeded;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Dynamo/0.6.3/getTypesFromList.py:
--------------------------------------------------------------------------------
1 | #this script takes a list of elements and returns the types only
2 | import clr
3 | clr.AddReference('RevitAPI')
4 | clr.AddReference('RevitAPIUI')
5 | from Autodesk.Revit.DB import *
6 | from System.Collections.Generic import List
7 | import Autodesk
8 |
9 | doc = IN0
10 | fams = IN1
11 |
12 | elementlist = list()
13 | idlist = list()
14 | totalist = list()
15 | #gets the list of elements and creates of list of ids
16 | for item in fams:
17 | idlist.append(item.Id)
18 |
19 | totalist = List[ElementId](idlist)
20 |
21 | collector = FilteredElementCollector(doc,totalist)
22 | collector.WhereElementIsElementType()
23 | elementlist.append(collector.ToElements())
24 |
25 | OUT = elementlist
26 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/obj/Debug/Application.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | G:\RTC2014\API\Forms\Application\Application\obj\Debug\Application.csprojResolveAssemblyReference.cache
2 | G:\RTC2014\API\Forms\Application\Application\bin\Debug\Application.dll
3 | G:\RTC2014\API\Forms\Application\Application\bin\Debug\Application.pdb
4 | G:\RTC2014\API\Forms\Application\Application\obj\Debug\Application.dll
5 | G:\RTC2014\API\Forms\Application\Application\obj\Debug\Application.pdb
6 | G:\RTC2014\API\Forms\Application\Application\obj\Debug\UserControl1.baml
7 | G:\RTC2014\API\Forms\Application\Application\obj\Debug\UserControl1.g.cs
8 | G:\RTC2014\API\Forms\Application\Application\obj\Debug\Application_MarkupCompile.cache
9 | G:\RTC2014\API\Forms\Application\Application\obj\Debug\Application.g.resources
10 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace Ex1._0
17 | {
18 | ///
19 | /// Interaction logic for MainWindow.xaml
20 | ///
21 | public partial class MainWindow : Window
22 | {
23 | public MainWindow()
24 | {
25 | InitializeComponent();
26 | }
27 |
28 | private void Calculate_Click(object sender, RoutedEventArgs e)
29 | {
30 |
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/Ex2.0.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | G:\RTC2014\API\Forms\Ex2.0\Ex2.0\bin\Debug\Ex2.0.exe.config
2 | G:\RTC2014\API\Forms\Ex2.0\Ex2.0\bin\Debug\Ex2.0.exe
3 | G:\RTC2014\API\Forms\Ex2.0\Ex2.0\bin\Debug\Ex2.0.pdb
4 | G:\RTC2014\API\Forms\Ex2.0\Ex2.0\obj\Debug\Ex2.0.csprojResolveAssemblyReference.cache
5 | G:\RTC2014\API\Forms\Ex2.0\Ex2.0\obj\Debug\MainWindow.baml
6 | G:\RTC2014\API\Forms\Ex2.0\Ex2.0\obj\Debug\MainWindow.g.cs
7 | G:\RTC2014\API\Forms\Ex2.0\Ex2.0\obj\Debug\App.g.cs
8 | G:\RTC2014\API\Forms\Ex2.0\Ex2.0\obj\Debug\Ex2.0_MarkupCompile.cache
9 | G:\RTC2014\API\Forms\Ex2.0\Ex2.0\obj\Debug\Ex2.0.g.resources
10 | G:\RTC2014\API\Forms\Ex2.0\Ex2.0\obj\Debug\Ex2._0.Properties.Resources.resources
11 | G:\RTC2014\API\Forms\Ex2.0\Ex2.0\obj\Debug\Ex2.0.csproj.GenerateResource.Cache
12 | G:\RTC2014\API\Forms\Ex2.0\Ex2.0\obj\Debug\Ex2.0.exe
13 | G:\RTC2014\API\Forms\Ex2.0\Ex2.0\obj\Debug\Ex2.0.pdb
14 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/Application.addin:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Command Application
5 | Some description for Application
6 | Application.dll
7 | Application.Command
8 | b524eb8a-2a9b-4559-92b5-a6531742143b
9 | TBC_
10 | The Building Coder, http://thebuildingcoder.typepad.com
11 |
12 |
13 | Application Application
14 | Application.dll
15 | Application.App
16 | 1a9b3711-754f-4b93-adf6-74b251c7c068
17 | TBC_
18 | The Building Coder, http://thebuildingcoder.typepad.com
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/checkwindow.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Express 2012 for Windows Desktop
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ex1.0", "Ex1.0\Ex1.0.csproj", "{F6F292FE-54F2-4D2B-9E8F-4DDA6A1E2D27}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {F6F292FE-54F2-4D2B-9E8F-4DDA6A1E2D27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {F6F292FE-54F2-4D2B-9E8F-4DDA6A1E2D27}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {F6F292FE-54F2-4D2B-9E8F-4DDA6A1E2D27}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {F6F292FE-54F2-4D2B-9E8F-4DDA6A1E2D27}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Express 2012 for Windows Desktop
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ex2.0", "Ex2.0\Ex2.0.csproj", "{1A0C4A4F-82C9-47C1-9130-1E09616E61D3}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {1A0C4A4F-82C9-47C1-9130-1E09616E61D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {1A0C4A4F-82C9-47C1-9130-1E09616E61D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {1A0C4A4F-82C9-47C1-9130-1E09616E61D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {1A0C4A4F-82C9-47C1-9130-1E09616E61D3}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Express 2012 for Windows Desktop
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Application", "Application\Application.csproj", "{8A6DE3A8-15CF-4DD0-B133-E9587C6B1236}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {8A6DE3A8-15CF-4DD0-B133-E9587C6B1236}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {8A6DE3A8-15CF-4DD0-B133-E9587C6B1236}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {8A6DE3A8-15CF-4DD0-B133-E9587C6B1236}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {8A6DE3A8-15CF-4DD0-B133-E9587C6B1236}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Express 2012 for Windows Desktop
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NewCommands", "NewCommands\NewCommands.csproj", "{97577F18-C09D-4A15-944B-E4B69EBF960F}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {97577F18-C09D-4A15-944B-E4B69EBF960F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {97577F18-C09D-4A15-944B-E4B69EBF960F}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {97577F18-C09D-4A15-944B-E4B69EBF960F}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {97577F18-C09D-4A15-944B-E4B69EBF960F}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/CheckListFromRevit.addin:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Command CheckListFromRevit
5 | Some description for CheckListFromRevit
6 | CheckListFromRevit.dll
7 | CheckListFromRevit.Command
8 | b6060db1-5460-42c8-b1c4-3e51d4e45066
9 | YTL_
10 | The Building Coder, http://thebuildingcoder.typepad.com
11 |
12 |
13 | Application CheckListFromRevit
14 | CheckListFromRevit.dll
15 | CheckListFromRevit.App
16 | 0e92946c-b33f-4bf1-86aa-201dd75937ca
17 | YTL_
18 | The Building Coder, http://thebuildingcoder.typepad.com
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Macros/getCollection/getCollection.vb:
--------------------------------------------------------------------------------
1 | ' This commend accesses wall information directly from the Revit database
2 | ' It then returns the type information of the wall such as the names and Id's and returns that to a string
3 |
4 | Public Sub Ex2_2get_Collection()
5 |
6 | 'assigns doc to the active document in use
7 | Dim document As Document = Me.ActiveUIDocument.Document
8 |
9 | 'Creates a new stringbuilder Instance
10 | Dim results As New System.Text.StringBuilder(String.Empty)
11 |
12 | 'Basic collection of wall types
13 | Dim wallCollection As IList(Of Element) = New FilteredElementCollector(document).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsElementType().ToElements()
14 |
15 | 'foreach statement to get access to the data or elements
16 | For Each e As Element In wallCollection
17 | results.AppendLine("Wall Name: " & e.Name & "- Id Number: " & e.Id.ToString())
18 | Next
19 |
20 | 'Dialog to show results
21 | TaskDialog.Show("List of Instances", results.ToString())
22 |
23 | End Sub
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/UserControl1.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Express 2012 for Windows Desktop
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CheckListFromRevit", "CheckListFromRevit\CheckListFromRevit.csproj", "{BE985B26-199F-4C9A-BD56-258C45872D92}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Any CPU = Debug|Any CPU
9 | Release|Any CPU = Release|Any CPU
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {BE985B26-199F-4C9A-BD56-258C45872D92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13 | {BE985B26-199F-4C9A-BD56-258C45872D92}.Debug|Any CPU.Build.0 = Debug|Any CPU
14 | {BE985B26-199F-4C9A-BD56-258C45872D92}.Release|Any CPU.ActiveCfg = Release|Any CPU
15 | {BE985B26-199F-4C9A-BD56-258C45872D92}.Release|Any CPU.Build.0 = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Revit Community
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Macros/getCollection/getCollection.cs:
--------------------------------------------------------------------------------
1 | /*
2 | This commend accesses wall information directly from the Revit database
3 | It then returns the type information of the wall such as the names and Id's and returns that to a string
4 | */
5 |
6 |
7 | //This code requires a reference for the stringbuilder class
8 | using System.Text;
9 |
10 | public void Ex2_2get_Collection()
11 | {
12 | //assigns doc to the active document in use - default
13 | Document doc = this.ActiveUIDocument.Document;
14 | //Creates a new stringbuilder Instance
15 | StringBuilder results = new StringBuilder(string.Empty);
16 |
17 | //Basic collection for walls
18 | ICollection elem = new FilteredElementCollector(doc)
19 | .OfCategory(BuiltInCategory.OST_Walls).WhereElementIsElementType().ToElements();
20 |
21 | //foreach statement to get access to the data or elements
22 | foreach (Element e in elem)
23 | {
24 | //TaskDialog.Show("List of Instances", Name and e.Id.ToString() );
25 | results.Append("Wall Name: " + e.Name + "- Id Number: " + e.Id.ToString() + "\n");
26 | }
27 |
28 | //Dialog to show results
29 | TaskDialog.Show("List of Instances", results.ToString());
30 | }
31 |
--------------------------------------------------------------------------------
/Macros/hideCropRegions/hideCropRegions.vb:
--------------------------------------------------------------------------------
1 | 'this macro will collect all the views and then loop through them hiding the crop region in each one
2 | Public Sub HideCropRegion()
3 |
4 | 'assigns document to the active document in use
5 | Dim document As Document = Me.ActiveUIDocument.Document
6 |
7 | 'get all the views
8 | Dim viewCollection As ienumerable(Of view) = From v As View In New FilteredElementCollector(document) _
9 | .OfCategory(BuiltInCategory.OST_Views) _
10 | .whereelementisnotelementtype _
11 | .cast(Of view)
12 |
13 | 'Start a transaction CRITICAL without transactions Revit cannot update
14 | Using rvtTransaction As New Transaction(document,"Hide Crop Regions")
15 | rvtTransaction.Start()
16 |
17 |
18 | 'loop through the views
19 | For Each v As View In viewCollection
20 |
21 | 'get the crop region parameter
22 | Dim p As Parameter = v.Parameter(BuiltInParameter.VIEWER_CROP_REGION_VISIBLE)
23 |
24 | 'if parameter exists, turn it off
25 | If p IsNot Nothing Then
26 | p.Set(0)
27 | End If
28 |
29 | Next
30 |
31 | 'Commit the changes to the Revit File
32 | rvtTransaction.Commit
33 | End Using
34 |
35 |
36 | End Sub
37 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34011
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Ex1._0.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34011
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Ex2._0.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Macros/turnOffUnderlay/turnOffUnderlay.vb:
--------------------------------------------------------------------------------
1 | 'this macro will collect all the views and then loop through them turning off the underlay in each one
2 | Public Sub TurnOffUnderlay()
3 |
4 | 'assigns document to the active document in use
5 | Dim document As Document = Me.ActiveUIDocument.Document
6 |
7 | 'get all the views
8 | Dim viewCollection As ienumerable(Of view) = From v As View In New FilteredElementCollector(document) _
9 | .OfCategory(BuiltInCategory.OST_Views) _
10 | .whereelementisnotelementtype _
11 | .cast(Of view)
12 |
13 | 'Start a transaction CRITICAL without transactions Revit cannot update
14 | Using rvtTransaction As New Transaction(document,"Hide underlays")
15 | rvtTransaction.Start()
16 |
17 |
18 | 'loop through the views
19 | For Each v As View In viewCollection
20 |
21 | 'get the underlay parameter
22 | Dim p As Parameter = v.Parameter(BuiltInParameter.VIEW_UNDERLAY_ID)
23 |
24 | 'if parameter exists, set it to nothing
25 | If p IsNot Nothing Then
26 | p.Set(New ElementId(-1))
27 | End If
28 | Next
29 |
30 | 'Commit the changes to the Revit File
31 | rvtTransaction.Commit
32 | End Using
33 |
34 |
35 | End Sub
36 |
--------------------------------------------------------------------------------
/Dynamo/0.7.6/template.py:
--------------------------------------------------------------------------------
1 | import clr
2 | import sys
3 | clr.AddReference('ProtoGeometry')
4 | from Autodesk.DesignScript.Geometry import *
5 |
6 | # Import DocumentManager and TransactionManager
7 | clr.AddReference('RevitServices')
8 | import RevitServices
9 | from RevitServices.Persistence import DocumentManager
10 | from RevitServices.Transactions import TransactionManager
11 |
12 | # Import RevitAPI
13 | clr.AddReference('RevitAPI')
14 | clr.AddReference('RevitAPIUI')
15 | import Autodesk
16 | from Autodesk.Revit.DB import *
17 | from Autodesk.Revit.UI import *
18 |
19 | #doc = DocumentManager.Instance.CurrentDBDocument
20 | #uiapp = DocumentManager.Instance.CurrentUIApplication
21 | #app = uiapp.Application
22 |
23 | #pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
24 | #sys.path.append(pyt_path)
25 |
26 | #from Autodesk.DesignScript.Geometry import *
27 |
28 | #from System import Array
29 | #from System.Collections.Generic import *
30 | #import math
31 |
32 | #The inputs to this node will be stored as a list in the IN variable.
33 | elements = IN
34 | #List Example = List[ElementId]()
35 |
36 | #TransactionManager.Instance.EnsureInTransaction(doc)
37 |
38 | #TransactionManager.Instance.TransactionTaskDone()
39 |
40 | #Assign your output to the OUT variable
41 | OUT = 0
42 |
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/CheckListFromRevit.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\Gytaco\Documents\Visual Studio 2012\Projects\CheckListFromRevit\CheckListFromRevit\obj\Debug\CheckListFromRevit.csprojResolveAssemblyReference.cache
2 | C:\Users\Gytaco\Documents\Visual Studio 2012\Projects\CheckListFromRevit\CheckListFromRevit\obj\Debug\checkwindow.baml
3 | C:\Users\Gytaco\Documents\Visual Studio 2012\Projects\CheckListFromRevit\CheckListFromRevit\obj\Debug\checkwindow.g.cs
4 | C:\Users\Gytaco\Documents\Visual Studio 2012\Projects\CheckListFromRevit\CheckListFromRevit\obj\Debug\CheckListFromRevit_MarkupCompile.cache
5 | C:\Users\Gytaco\Documents\Visual Studio 2012\Projects\CheckListFromRevit\CheckListFromRevit\obj\Debug\CheckListFromRevit.g.resources
6 | C:\Users\Gytaco\Documents\Visual Studio 2012\Projects\CheckListFromRevit\CheckListFromRevit\bin\Debug\CheckListFromRevit.dll
7 | C:\Users\Gytaco\Documents\Visual Studio 2012\Projects\CheckListFromRevit\CheckListFromRevit\bin\Debug\CheckListFromRevit.pdb
8 | C:\Users\Gytaco\Documents\Visual Studio 2012\Projects\CheckListFromRevit\CheckListFromRevit\obj\Debug\CheckListFromRevit.dll
9 | C:\Users\Gytaco\Documents\Visual Studio 2012\Projects\CheckListFromRevit\CheckListFromRevit\obj\Debug\CheckListFromRevit.pdb
10 |
--------------------------------------------------------------------------------
/Macros/exportTxt/exportTxt.vb:
--------------------------------------------------------------------------------
1 | 'This code exports a delimited tab text file of some parameters from Walls.
2 | Public Sub exportTxt()
3 |
4 | 'assigns document to the active document in use
5 | Dim document As Document = Me.ActiveUIDocument.Document
6 |
7 | 'a string to store the output files location
8 | Dim location As String = "c:\data.txt"
9 |
10 | 'Create a stingbuilder to add the data to
11 | Dim stringBuilder As New System.Text.StringBuilder()
12 |
13 | 'add header information
14 | stringBuilder.AppendLine("WallID" & Microsoft.VisualBasic.vbTab & "Name" & Microsoft.VisualBasic.vbTab & "Comments")
15 |
16 | 'Basic collection of wall types
17 | Dim wallCollection As IList(Of Element) = New FilteredElementCollector(document).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType().ToElements()
18 |
19 | 'loop through walls and add data
20 | For Each e As Element In wallCollection
21 | stringBuilder.AppendLine(e.Id.ToString & Microsoft.VisualBasic.vbTab &e.Name & Microsoft.VisualBasic.vbTab & e.Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS).AsString)
22 | Next
23 |
24 | 'write the string builder to the txt file
25 | System.IO.File.WriteAllText(location,stringBuilder.tostring)
26 |
27 | 'dialog to show result
28 | TaskDialog.Show("List of Instances", "Export Successful")
29 |
30 | End Sub
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Macros/doorTagUpdate/doorTagUpdate.cs:
--------------------------------------------------------------------------------
1 | /*
2 | The following code will update any door that has a ToRoom parameter for the name Number that is active.
3 | It will then update the comments parameter of each door with the updated value.
4 | */
5 |
6 | public void doorTagUpdate()
7 | {
8 | //Sets the active document
9 | Document doc = this.ActiveUIDocument.Document;
10 |
11 | //creates a Collection of the doors as FamilyInstances
12 | var doorColl = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Doors)
13 | .OfClass(typeof(FamilyInstance));
14 |
15 | //Uses linq queries to select the door that have a ToRoom Value
16 | IEnumerable doors =
17 | from FamilyInstance f in doorColl
18 | where f.ToRoom != null
19 | select f;
20 |
21 | //Start the transaction CRITICAL without transactions Revit cannot update
22 | using (Transaction t = new Transaction(doc, "Door Data Update"))
23 | {
24 | //Starts the transction
25 | t.Start();
26 | //goes through each door based on the filter above
27 | foreach (FamilyInstance e in doors)
28 | {
29 | //gets the ToRoom number as a string
30 | string doorToRoom = e.ToRoom.Number.ToString();
31 | //updates the comments parameter to the ToRoom value
32 | e.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS).Set(doorToRoom);
33 | }
34 | //Commits the changes to the Revit File
35 | t.Commit();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Macros/exportTxt/exportTxt.cs:
--------------------------------------------------------------------------------
1 | /*
2 | This code exports a delimited tab text file of some parameters from Walls.
3 | */
4 |
5 | //This code requires the following reference
6 | using System.IO;
7 |
8 | public void exportTxt()
9 | {
10 | //assigns doc to the active document in use - default
11 | Document doc = this.ActiveUIDocument.Document;
12 | //a string that stores the files location
13 | string location = @"C:\data.txt";
14 | //creates a private IEnumerable that accepts string DataTypes only
15 | IEnumerable Result;
16 | //creates a string list object
17 | List list = new List();
18 |
19 | //Basic collection for walls
20 | ICollection elem = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls)
21 | .WhereElementIsNotElementType().ToElements();
22 |
23 | //string header for the text file
24 | string header = ("WallID\tName\tComments");
25 | //adds the header to the top of the list
26 | list.Add(header);
27 |
28 | //foreach statement to get access to the data or elements
29 | foreach (Element e in elem)
30 | {
31 | //gets all the wall instance Id's, names and comments and formats them with tabs
32 | list.Add(e.Id.ToString() + "\t" + e.Name.ToString() + "\t" + e.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS).AsString());
33 | }
34 | //get the completed list into the Ienumerable
35 | Result = list;
36 | //writes all the information to the text file
37 | File.WriteAllLines(location, Result);
38 |
39 | //Dialog to show results
40 | TaskDialog.Show("List of Instances", "Export Successful");
41 | }
42 |
--------------------------------------------------------------------------------
/Macros/doorTagUpdate/doorTagUpdate.vb:
--------------------------------------------------------------------------------
1 | ' The following code will update any door that has a ToRoom parameter for the name Number that is active.
2 | ' It will then update the comments parameter of each door with the updated value.
3 |
4 | Public Sub doorTagUpdate()
5 |
6 | 'assigns document to the active document in use
7 | Dim document As Document = Me.ActiveUIDocument.Document
8 |
9 | 'creates a Collection of the doors as FamilyInstances
10 | Dim doorCollection As IEnumerable(Of FamilyInstance) = New FilteredElementCollector(document) _
11 | .OfCategory(BuiltInCategory.OST_Doors) _
12 | .WhereElementIsNotElementType _
13 | .ToElements().Cast(Of FamilyInstance)()
14 |
15 | 'Use linq to select doors that have a ToRoom Value
16 | Dim doorsWithRooms As IEnumerable(Of FamilyInstance) = From fi As FamilyInstance In doorCollection
17 | Where fi.ToRoom IsNot Nothing
18 | Select fi
19 |
20 | 'Start a transaction CRITICAL without transactions Revit cannot update
21 | Using rvtTransaction As New Transaction(document,"Door data update")
22 | rvtTransaction.Start()
23 |
24 | 'loop through each door based on the filter above
25 | For Each fi As FamilyInstance In doorsWithRooms
26 |
27 | 'gets the ToRoom number as a string
28 | Dim toRoom As string = fi.ToRoom.Number.ToString
29 |
30 | 'updates the comments parameter to the ToRoom value
31 | fi.Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS).Set(toRoom)
32 | Next
33 |
34 | 'Commit the changes to the Revit File
35 | rvtTransaction.Commit
36 | End Using
37 |
38 | End Sub
--------------------------------------------------------------------------------
/Macros/createRenameViews/createRenameViews.cs:
--------------------------------------------------------------------------------
1 | /*
2 | This project creates Plan, Cailing and Structural Views based on your ViewTypes in yoru project and will rename them
3 | to Level - View Type and will convert them to upper case.
4 | */
5 |
6 | public void createRenameViews()
7 | {
8 | //sets the variable to the current application
9 | Document doc = this.ActiveUIDocument.Document;
10 |
11 | //creates a collection of the levels
12 | var lvls = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Levels)
13 | .WhereElementIsNotElementType().ToElements();
14 |
15 | //starts a transaction that creates the views
16 | using (Transaction tx = new Transaction (doc, "GHD Create Views"))
17 | {
18 | tx.Start();
19 |
20 | //gets the View Types from the project using linq commands
21 | foreach (ViewFamilyType vpt in (from v in new FilteredElementCollector(doc)
22 | .OfClass(typeof(ViewFamilyType)).Cast() select v))
23 | {
24 | //looks for the floor plans, ceiling plans and structural plans only
25 | if (vpt.ViewFamily == ViewFamily.FloorPlan || vpt.ViewFamily == ViewFamily.CeilingPlan
26 | || vpt.ViewFamily == ViewFamily.StructuralPlan)
27 | {
28 | //looks at each level
29 | foreach (Level lvl in lvls)
30 | {
31 | //creates a new floor plan
32 | ViewPlan flplan = ViewPlan.Create(doc, vpt.Id, lvl.Id);
33 |
34 | //rename the View to the name of the View Type and level to upper case
35 | flplan.Name = vpt.Name.ToUpper() + " " + lvl.Name.ToUpper();
36 | }
37 | }
38 | }
39 | //commits the transaction
40 | tx.Commit();
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Macros/placeFamilyInRoom/placeInRoom.cs:
--------------------------------------------------------------------------------
1 | /*
2 | The code will get a family type called "Single" and place it into a Room with the Room Name "Roombed" and the Number 2.
3 | You can customise each of these options as you require
4 | */
5 |
6 | public void placeInRoom()
7 | {
8 | //sets the variable to the current application
9 | Document doc = this.ActiveUIDocument.Document;
10 |
11 | //gets the family by it's type name
12 | var bed = from elem in new FilteredElementCollector(doc)
13 | .OfClass(typeof(FamilySymbol))
14 | let fam = elem as FamilySymbol
15 | where fam.Name == "Single"
16 | select fam;
17 |
18 | //selets the family type
19 | FamilySymbol bed1 = bed.Single();
20 |
21 | //gets the room by its name
22 | var room2 = from elem in new FilteredElementCollector(doc)
23 | .OfClass(typeof(SpatialElement))
24 | let roo = elem as SpatialElement
25 | where roo.Name == "Roombed 2"
26 | select roo;
27 |
28 | //selects the room element
29 | Room r1 = room2.Single() as Room;
30 |
31 | //obsolete method for getting levels, will be removed or "deprecated"
32 | //Level rlevel = r1.Level;
33 | //new way to get levels
34 | Level rlevel = doc.GetElement(r1.LevelId) as Level;
35 | //gets the location of the room as a location point
36 | LocationPoint rlocation = r1.Location as LocationPoint;
37 |
38 | //converts the locationpoint into an XYZ point
39 | XYZ rPoint = new XYZ(rlocation.Point.X, rlocation.Point.Y, rlocation.Point.Z);
40 |
41 |
42 | //starts the transaction to place objects in rooms
43 | using (Transaction tr = new Transaction(doc,"Create bed in Room"))
44 | {
45 | tr.Start();
46 |
47 | //uses the place family method
48 | FamilyInstance place = doc.Create.NewFamilyInstance(rPoint, bed1, rlevel, StructuralType.NonStructural);
49 |
50 | tr.Commit();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Macros/README.md:
--------------------------------------------------------------------------------
1 | Revit Macros
2 | ========
3 |
4 | Each of the files in the folders is a single Macro. These Macros are added from the Macro VSTA in Revit.
5 |
6 | Macros are small pieces of code that users can run to do anything the Revit API can do short of complex interfaces or installation options. However the code can be written, debugged and tested then ported over to a Visual Studio project if you wish to build consistent functionality for all your users.
7 |
8 | SETUP
9 | ========
10 |
11 | To add a Macro to your Revit you need to go to the Manage tab then under the Macros manager and then Macros panel then Macros Manager.
12 |
13 | Once in the Macro manager you need to select the Applications TAB, then create a new C# Module, then you can create a number of Macro's under each C# Module.
14 |
15 | Each of the Macros in these examples are C# however we may add Python, vb or others depending on the contributions setup.
16 |
17 | These macros have been setup to run as Application Macros ONLY and your results may vary when running them as Application projects.
18 |
19 | Each .cs file contains a single Macro and is setup as follows
20 |
21 | README - A short description of what the Macro does as a Comment block, and any additional instructions that are outside of the following readme comments.
22 |
23 | Using References :- each of the using References that will be required to execute this macro that are not part of the initial Macro setup environment, you need to copy and paste these to the other "Using" references at the top of the Macro editing Environment.
24 |
25 | public void ExampleName()
26 | {
27 | MACRO CODE IS HERE COPY/PASTE THE STUFF IN BETWEEN THESE BRACKETS ONLY!!!
28 | }
29 |
30 |
31 | The second part of the file will be the Macro code itself, you need to copy/paste the code from the code block into your own named Macro. Once this is done you should be able to close and run macro as you need to.
32 |
33 | Any issues please use the issues register.
34 |
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/Command.cs:
--------------------------------------------------------------------------------
1 | #region Namespaces
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Diagnostics;
5 | using Autodesk.Revit.ApplicationServices;
6 | using Autodesk.Revit.Attributes;
7 | using Autodesk.Revit.DB;
8 | using Autodesk.Revit.UI;
9 | using Autodesk.Revit.UI.Selection;
10 | #endregion
11 |
12 | namespace CheckListFromRevit
13 | {
14 | [Transaction(TransactionMode.Manual)]
15 | public class Command : IExternalCommand
16 | {
17 | public Result Execute(
18 | ExternalCommandData commandData,
19 | ref string message,
20 | ElementSet elements)
21 | {
22 | UIApplication uiapp = commandData.Application;
23 | UIDocument uidoc = uiapp.ActiveUIDocument;
24 | Application app = uiapp.Application;
25 | Document doc = uidoc.Document;
26 |
27 |
28 | checkwindow form = new checkwindow(commandData);
29 | form.ShowDialog();
30 |
31 |
32 | /*
33 | // Access current selection
34 |
35 | Selection sel = uidoc.Selection;
36 |
37 | // Retrieve elements from database
38 |
39 | FilteredElementCollector col
40 | = new FilteredElementCollector(doc)
41 | .WhereElementIsNotElementType()
42 | .OfCategory(BuiltInCategory.INVALID)
43 | .OfClass(typeof(Wall));
44 |
45 | // Filtered element collector is iterable
46 |
47 | foreach (Element e in col)
48 | {
49 | Debug.Print(e.Name);
50 | }
51 |
52 | // Modify document within a transaction
53 |
54 | using (Transaction tx = new Transaction(doc))
55 | {
56 | tx.Start("Transaction Name");
57 | tx.Commit();
58 | }
59 | */
60 | return Result.Succeeded;
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Macros/wallSelection/wallSelection.cs:
--------------------------------------------------------------------------------
1 | /*
2 | This code enables users to select walls using a ISelectionFiler class, it then interrogates the selected wall
3 | and returns some instance and Type built in Parameters as a dialog box in Revit.
4 | */
5 |
6 | public void Ex1_4get_Selection()
7 | {
8 | //assigns doc to the active document in use - default
9 | Document doc = this.ActiveUIDocument.Document;
10 | //assings uidoc to the active User Interface in use-default
11 | UIDocument uidoc = this.ActiveUIDocument;
12 | //creates a new instance of the wallselectionFilter
13 | ISelectionFilter wallfil = new WallSelectionFilter();
14 |
15 | //gets the object selected Elementid, applies the selection filter and the string mesasge
16 | ElementId obj = uidoc.Selection.PickObject(ObjectType.Element, wallfil, "Select a Wall please").ElementId;
17 |
18 | //gets the element from the ElementID
19 | Element e = doc.GetElement(obj);
20 | //get the family type Elementid
21 | ElementId idType = e.GetTypeId();
22 | //Get the Element Type ID
23 | Element pType = doc.GetElement(idType);
24 |
25 | //gets the instance length of the object
26 | string s = e.get_Parameter(BuiltInParameter.CURVE_ELEM_LENGTH).AsValueString();
27 |
28 | //gets the type width of the object
29 | string t = pType.get_Parameter("Width").AsValueString();
30 |
31 | //Shows the values
32 | TaskDialog.Show("Example", s + " " + t );
33 | }
34 | //creates an IselectionFilter interface
35 | public class WallSelectionFilter : ISelectionFilter
36 | {
37 | //Sets up a boolean based on whether an object can be selection
38 | public bool AllowElement(Element element)
39 | {
40 | //if statement for the wall object
41 | if (element.Category.Name == "Walls")
42 | {
43 | return true;
44 | }
45 | return false;
46 | }
47 | //sets up whether a reference can be selected
48 | public bool AllowReference(Reference refer, XYZ point)
49 | {
50 | return false;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | RevitAPI
2 | ========
3 |
4 | Basic VSTA and VS Studio code heavily commented for new users to learn how to use the Revit API
5 |
6 |
7 | This is a repository for those learning the Revit API, Revit Macros and Dynamo Scripts, it will be updated as I continue to work on bits & pieces and the key feature will be making sure the code is heavily commented for new users to understand.
8 |
9 | At the moment the document should be read in conjunction with the handouts I did for RTC Australia and RTC USA, I will work out how to get this data across in an easier format.
10 |
11 | IF THIS IS YOUR FIRST VISIT HERE GO TO THE HANDOUT FOLDER AND CHECKOUT ALL THE PDF'S AND DOCUMENTS PRIOR TO STARTING
12 |
13 | Before doing anything please install the revit SDK from either the Revit installation or from online.
14 |
15 | Last notice, if you plan to use any or all of this code please check out the licence conditions, they are pretty easy to abide by :)
16 |
17 | Anything in here so far I have to credit [Jeremy Tammik](http://thebuildingcoder.typepad.com/) and [Harry Matthison](http://boostyourbim.wordpress.com/) as I have certainly used their code or parts of it for many of the examples listed.
18 |
19 | Also checkout Jeremy's code at https://github.com/jeremytammik/the_building_coder_samples
20 |
21 |
22 |
23 |
24 |
25 | Copyright, Trademarks and Attribution
26 |
27 | Autodesk, AutoCAD, and Revit are registered trademarks or trademarks of Autodesk, Inc., in the United States and other countries. This site is not sponsored or endorsed by, or affiliated with, Autodesk, Inc.
28 |
29 | Autodesk® Revit® products are wholly owned by Autodesk. Any reference to Revit, Revit Architecture, Revit MEP or Revit Structure on this site is made acknowledging this ownership. Refer to Autodesk's own web site and product pages for specific trademark and copyright information. Autodesk represents a great many products and every attempt will be made to respect their ownership whenever one of these other products is mentioned on this site.
30 |
--------------------------------------------------------------------------------
/Macros/createRenameViews/createRenameViews.vb:
--------------------------------------------------------------------------------
1 | ' This project creates Plan, Ceiling and Structural Views based on your ViewTypes in yoru project and will rename them
2 | ' to "ViewType Level" in uppercase.
3 | Public Sub CreateRenameViews()
4 |
5 | 'assigns document to the active document in use - default
6 | Dim document As Document = Me.ActiveUIDocument.Document
7 |
8 | 'get all the levels in the project
9 | Dim levelCollection As IEnumerable(Of Level) = New FilteredElementCollector(document) _
10 | .OfCategory(BuiltInCategory.OST_Levels) _
11 | .WhereElementIsNotElementType() _
12 | .ToElements() _
13 | .Cast(Of Level)()
14 |
15 | 'get all the viewtypes in the project
16 | Dim viewTypecollection As IEnumerable(Of ViewFamilyType) = New FilteredElementCollector(document) _
17 | .OfClass(GetType(ViewFamilyType)) _
18 | .WhereElementIsElementType _
19 | .Cast(Of ViewFamilyType)()
20 |
21 | 'Start a transaction CRITICAL without transactions Revit cannot update
22 | Using rvtTransaction As New Transaction(document, "Create views")
23 | rvtTransaction.Start()
24 |
25 | 'loop through all the view types found
26 | For Each v As ViewFamilyType In viewTypecollection
27 |
28 | 'look for floor, ceiling and structural plans
29 | If v.ViewFamily = ViewFamily.FloorPlan Or v.ViewFamily = ViewFamily.CeilingPlan Or v.ViewFamily = ViewFamily.StructuralPlan Then
30 |
31 | For Each l As Level In levelCollection
32 |
33 | 'create a plan
34 | Dim plan As ViewPlan = ViewPlan.Create(document, v.Id, l.Id)
35 |
36 | 'rename the plan
37 | plan.Name = Microsoft.VisualBasic.UCase(v.Name & " " & l.Name)
38 | Next
39 |
40 | End If
41 | Next
42 |
43 | 'Commit the changes to the Revit File
44 | rvtTransaction.Commit()
45 |
46 | End Using
47 |
48 |
49 | End Sub
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/Exercises/Ex1.1.cs:
--------------------------------------------------------------------------------
1 | /*
2 | //This is all our references for accessing particular commands
3 | //This is how we create regions to make our code easier to read
4 | #region Namespaces
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows;
11 | using System.Windows.Controls;
12 | using System.Windows.Data;
13 | using System.Windows.Documents;
14 | using System.Windows.Input;
15 | using System.Windows.Media;
16 | using System.Windows.Media.Imaging;
17 | using System.Windows.Navigation;
18 | using System.Windows.Shapes;
19 | #endregion
20 |
21 | //The namespace is the location where our code is located
22 | namespace Ex1._0
23 | {
24 | ///
25 | /// Interaction logic for MainWindow.xaml
26 | /// // a partial class is a special type of class that relies on other classes for it's functionality
27 | ///
28 | public partial class MainWindow : Window
29 | {
30 | public string filename;
31 | //This is the constructor that is the instructions used to create the class
32 | public MainWindow()
33 | {
34 | //This is the command that creates the MainWindow as a window in Windows OS
35 | InitializeComponent();
36 | }
37 | //This is an method that tells the computer what to do when we click a button.
38 | private void Calculate_Click(object sender, RoutedEventArgs e)
39 | {
40 | //asigns space DataType int to these to variable names
41 | int ivalue1;
42 | int ivalue2;
43 |
44 | //converts the text in the text box from a string to an int
45 | ivalue1 = Convert.ToInt32(value1.Text);
46 | ivalue2 = Convert.ToInt32(value2.Text);
47 |
48 | //creates a new int and gets the result of the addition of two int values
49 | int iresult = ivalue1 + ivalue2;
50 |
51 | //This gets the result of the two values and puts the value into the text of the textbox
52 | tbResult.Text = iresult.ToString();
53 | }
54 | }
55 | }
56 | */
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/checkwindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 | using Autodesk.Revit.DB;
15 | using Autodesk.Revit.ApplicationServices;
16 | using Autodesk.Revit.UI;
17 |
18 | namespace CheckListFromRevit
19 | {
20 | ///
21 | /// Interaction logic for UserControl1.xaml
22 | ///
23 | public partial class checkwindow : Window
24 | {
25 | //creates a private document to access all areas of the class
26 | private Document doc;
27 |
28 | //adds an argument to the constructor to access the revit application
29 | public checkwindow(ExternalCommandData Data)
30 | {
31 | //initailises the dialog
32 | InitializeComponent();
33 | //gets the active document
34 | doc = Data.Application.ActiveUIDocument.Document;
35 | }
36 | //this is the method for clicking the CreateList button
37 | private void bClick(object sender, RoutedEventArgs e)
38 | {
39 | //gets a collection wall types
40 | ICollection wallT = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls)
41 | .WhereElementIsElementType().ToElements();
42 | //cycles through the wall types
43 | foreach (Element ew in wallT)
44 | {
45 | //adds the walltype names one by one to the list
46 | ObjectList.Items.Add(ew.Name);
47 | }
48 |
49 | }
50 | //method for clicking the ClearList Button
51 | private void Button_Click_1(object sender, RoutedEventArgs e)
52 | {
53 | //Deletes the objects in the list
54 | ObjectList.Items.Clear();
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/Macros/wallSelection/wallSelection.vb:
--------------------------------------------------------------------------------
1 | ' This code enables users to select walls using a ISelectionFiler class, it then interrogates the selected wall
2 | ' and returns some instance and Type built in Parameters as a dialog box in Revit.
3 |
4 | Public Sub Ex1_4get_Selection()
5 | 'assigns doc to the active document in use - default
6 | Dim document As Document = Me.ActiveUIDocument.Document
7 |
8 | 'assings uidoc to the active User Interface in use-default
9 | Dim uidoc = Me.ActiveUIDocument
10 |
11 | 'creates a new instance of the wallselectionFilter
12 | Dim wallFilter As ISelectionFilter = New WallSelectionFilter()
13 |
14 | 'gets the object selected Elementid, applies the selection filter and the string mesasge
15 | Dim ElementId As Elementid = uidoc.Selection.PickObject(ObjectType.Element,wallFilter,"Select a Wall Please").ElementId
16 |
17 | 'gets the element from the ElementID
18 | Dim e As Element = document.GetElement(ElementId)
19 |
20 | 'get the family type Elementid
21 | Dim typeId As ElementId = e.GetTypeId
22 |
23 | 'Get the family
24 | dim familyType As Element = document.GetElement(typeId)
25 |
26 | 'gets the length of the wall (this is in decimal feet, revits internal units)
27 | Dim length As Double = e.Parameter(BuiltInParameter.CURVE_ELEM_LENGTH).AsDouble
28 |
29 | 'gets the type width of the object (this is in decimal feet, revits internal units)
30 | dim width as double = familyType.Parameter("Width").AsDouble
31 |
32 | 'Shows the values
33 | TaskDialog.Show("Example", length & " " & width )
34 |
35 | End Sub
36 |
37 |
38 |
39 |
40 | 'creates an IselectionFilter interface
41 | Public Class WallSelectionFilter
42 | Implements ISelectionFilter
43 |
44 | 'Sets up a boolean based on whether an object can be selection
45 | Public Function AllowElement(element As Element) As Boolean Implements ISelectionFilter.allowElement
46 | Return element.Category.Name = "Walls"
47 | End Function
48 |
49 | 'sets up whether a reference can be selected
50 | Public Function AllowReference(reference As Reference, point As XYZ)As Boolean Implements ISelectionFilter.allowReference
51 | Return false
52 | End Function
53 |
54 | End Class
--------------------------------------------------------------------------------
/Macros/renameExportDWG/renameExportDWG.vb:
--------------------------------------------------------------------------------
1 | 'This is a simple routine that allows a user to customise the naming of their DWG exports. It will save people alot
2 | 'of time. Please make sure you rename the ExportDWGSettings to "Adam" or a custom export setting name
3 | 'as well as change the folder location before using this feature.
4 |
5 | Public Sub renameExportDWG()
6 |
7 | 'assigns document to the active document in use
8 | Dim document As Document = Me.ActiveUIDocument.Document
9 |
10 | 'sets the name of the DWGexport
11 | Dim dwgExportName As String = "Adam"
12 |
13 | 'a string to store the out files folder
14 | Dim location As String = "c:\"
15 |
16 | 'get the project number
17 | Dim projectNumber As String = document.ProjectInformation.Parameter(BuiltInParameter.PROJECT_NUMBER).AsString
18 |
19 | 'get the export settings named above
20 | Dim exportSettings As ExportDWGSettings = (From es As ExportDWGSettings In New FilteredElementCollector(document).ofclass(GetType(ExportDWGSettings)).cast(Of ExportDWGSettings)
21 | where es.name =dwgExportName
22 | Select es).first
23 |
24 |
25 | 'gets a collection of the sheets in the project
26 | Dim sheetCollection As IEnumerable(Of ViewSheet) = New FilteredElementCollector(document).ofclass(GetType(ViewSheet)).WhereElementIsNotElementType.cast(Of ViewSheet)
27 |
28 |
29 | 'Start a transaction CRITICAL without transactions Revit cannot update
30 | Using rvtTransaction As New Transaction(document,"comment updates")
31 | rvtTransaction.Start()
32 |
33 |
34 | For Each sheet As ViewSheet In sheetCollection
35 |
36 | 'set of the name of the DWG to exported
37 | Dim sheetName As String = projectNumber & "-" & sheet.Name
38 |
39 | 'creates a new sheet id list
40 | Dim idList As New List(Of ElementId)
41 |
42 | 'adds the sheet id to the list because the Exporter requires it
43 | idList.Add(sheet.Id)
44 |
45 | 'export the sheet as a DWG
46 | document.Export(location,sheetName,idList,exportSettings.GetDWGExportOptions)
47 |
48 | Next
49 |
50 |
51 | 'Commit the changes to the Revit File
52 | rvtTransaction.Commit
53 |
54 | End Using
55 |
56 | End Sub
--------------------------------------------------------------------------------
/Macros/importTxt/importTxt.cs:
--------------------------------------------------------------------------------
1 | /*
2 | This will import the modified text file from the exportTxt.cs file in this folder and update any comment values
3 | that might have been changed.
4 | */
5 |
6 | //this file requires the following reference
7 | using System.IO;
8 |
9 | public void Ex5_1txt_Import()
10 | {
11 | //assigns doc to the active document in use - default
12 | Document doc = this.ActiveUIDocument.Document;
13 |
14 | //string that stores the tiles location
15 | string location = @"C:\data.txt";
16 | //array string with no size
17 | string[] aData;
18 |
19 | //command that reads all the lines in our text file from the location
20 | aData = File.ReadAllLines(location);
21 | //gets the length of our string array
22 | int len = (aData.Length - 1);
23 |
24 | //transaction to update our parameters
25 | using (Transaction t = new Transaction(doc, "comment updates"))
26 | {
27 | //start the transaction
28 | t.Start();
29 |
30 | //a for statement that is similar to foreach but is structured for arrays
31 | for (int i = 1; i <= len; i++)
32 | {
33 | //get the char location of the first tab in a line of text
34 | int iNo = aData[i].IndexOf('\t');
35 | //remove the rest of the string based on the position of the character
36 | string sId = aData[i].Remove(iNo);
37 |
38 | //removes the Id data from the string line
39 | string sComment1 = aData[i].Remove(0, iNo + 1);
40 | //get the char location of the second(now first) tab in the line of text
41 | int iNo2 = sComment1.IndexOf('\t');
42 | //removes the name data from the line of text leaving only comments
43 | string sComment2 = sComment1.Remove(0, iNo2 + 1);
44 |
45 | //convert the string id into an integer
46 | int iid = Int32.Parse(sId);
47 | //create a new elementid from the converted integer
48 | ElementId obj = new ElementId(iid);
49 | //get the element from the element id
50 | Element e = doc.GetElement(obj);
51 |
52 | //update the comments parameter with the information in the text
53 | e.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS).Set(sComment2);
54 | }
55 | //commit the transaction
56 | t.Commit();
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/Macros/renameExportDWG/renameExportDWG.cs:
--------------------------------------------------------------------------------
1 | /*
2 | This is a simple routine that allows a user to customise the naming of their DWG exports. It will save people alot
3 | of time. Please make sure you rename the ExportDWGSettings to "Adam" or a custom export setting name
4 | as well as change the folder location before using this feature.
5 | */
6 |
7 | public void renameExportDWG()
8 | {
9 | //sets the variable to the current application
10 | Document doc = this.ActiveUIDocument.Document;
11 | //sets the name of the DWGexport
12 | string dwgexportname = "Adam";
13 | //sets the folder location for our files to save to
14 | string folder = @"C:\";
15 | //gets the project Number as a string
16 | string projinfo = new FilteredElementCollector(doc).OfClass(typeof(ProjectInfo))
17 | .ToElements().FirstOrDefault().get_Parameter(BuiltInParameter.PROJECT_NUMBER).AsString();
18 |
19 | //gets the Export DWG Settings named above as dwgexportname
20 | ExportDWGSettings edwg = new FilteredElementCollector(doc).OfClass(typeof(ExportDWGSettings))
21 | .Where(dwg => dwg.Name == dwgexportname).First() as ExportDWGSettings;
22 |
23 | //gets a collection of the sheets in the project
24 | ICollection sheet = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Sheets)
25 | .WhereElementIsNotElementType().ToElements();
26 |
27 | //starts the transaction to export the sheets
28 | Transaction tran = new Transaction(doc, "DWG Export");
29 | tran.Start();
30 |
31 | //gets each sheet as a element
32 | foreach (Element e in sheet)
33 | {
34 | //looks at the ViewSheet properties rather then element properties of each sheet
35 | ViewSheet s = e as ViewSheet;
36 | //sets of the name of the DWG to exported
37 | string shtName = projinfo + "-" + s.SheetNumber + "_" + s.Name;
38 | //creates a new sheet id list
39 | IList shtId = new List();
40 | //adds the single sheet id to the list because the Exporter requires it
41 | shtId.Add(e.Id);
42 | //gets the Export options from the export settings
43 | DWGExportOptions dwgEO = edwg.GetDWGExportOptions();
44 |
45 | //This method runs the DWG creation tool
46 | doc.Export(folder, shtName, shtId, dwgEO);
47 | }
48 | tran.Commit();
49 | }
50 |
--------------------------------------------------------------------------------
/Macros/importTxt/importTxt.vb:
--------------------------------------------------------------------------------
1 | 'This will import the modified text file from the exportTxt.vb file in this folder and update any comment values
2 | 'that might have been changed.
3 | Public Sub importTxt()
4 |
5 | 'assigns document to the active document in use
6 | Dim document As Document = Me.ActiveUIDocument.Document
7 |
8 | 'a string to store the input files location
9 | Dim location As String = "c:\data.txt"
10 |
11 | 'read data from txt file into an array. Each item in the array represents one line in the txt file.
12 | Dim data As String() = System.IO.File.ReadAllLines(location)
13 |
14 |
15 | 'Start a transaction CRITICAL without transactions Revit cannot update
16 | Using rvtTransaction As New Transaction(document,"comment updates")
17 | rvtTransaction.Start()
18 |
19 |
20 | 'A for statement that is similar to foreach but is structured for arrays. ie it will loop through the data items.
21 | 'Start at item 1 as item 0 is the header row.
22 | For i As Integer = 1 To data.Count-1
23 |
24 | 'get the location of the first TAB in the line of text
25 | Dim iNo As Integer = data(i).indexof(Microsoft.VisualBasic.vbTab)
26 |
27 | 'remove all the charcters after the first TAB, and convert to integer
28 | Dim id As integer =cint(data(i).remove(iNo))
29 |
30 | 'remove all the charcters before the first tab
31 | Dim comment1 As String = data(i).remove(0, iNo + 1)
32 |
33 | 'get the location of the second TAB (now first)
34 | Dim iNo2 As Integer = comment1.indexof(Microsoft.VisualBasic.vbTab)
35 |
36 | 'remove all the charcters before the TAB leaving only the comment data
37 | Dim comment As String = comment1.remove(0, iNo2 + 1)
38 |
39 | 'create an elment id from the id integer
40 | Dim elementId As elementid = New ElementId(id)
41 |
42 | 'get the element using the element id
43 | Dim element As Element = document.GetElement(ElementId)
44 |
45 | 'update the comments parameter with the information in the text
46 | Element.Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS).Set(comment)
47 |
48 | Next
49 |
50 |
51 | 'Commit the changes to the Revit File
52 | rvtTransaction.Commit
53 |
54 | End Using
55 |
56 | End Sub
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("Ex1.0")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("Ex1.0")]
15 | [assembly: AssemblyCopyright("Copyright © 2014")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("Ex2.0")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("Ex2.0")]
15 | [assembly: AssemblyCopyright("Copyright © 2014")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/App.g.cs:
--------------------------------------------------------------------------------
1 | #pragma checksum "..\..\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "634B96B180516B69FFAB423F226AC2F0"
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by a tool.
5 | // Runtime Version:4.0.30319.34014
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 |
12 | using System;
13 | using System.Diagnostics;
14 | using System.Windows;
15 | using System.Windows.Automation;
16 | using System.Windows.Controls;
17 | using System.Windows.Controls.Primitives;
18 | using System.Windows.Data;
19 | using System.Windows.Documents;
20 | using System.Windows.Ink;
21 | using System.Windows.Input;
22 | using System.Windows.Markup;
23 | using System.Windows.Media;
24 | using System.Windows.Media.Animation;
25 | using System.Windows.Media.Effects;
26 | using System.Windows.Media.Imaging;
27 | using System.Windows.Media.Media3D;
28 | using System.Windows.Media.TextFormatting;
29 | using System.Windows.Navigation;
30 | using System.Windows.Shapes;
31 | using System.Windows.Shell;
32 |
33 |
34 | namespace Ex2._0 {
35 |
36 |
37 | ///
38 | /// App
39 | ///
40 | public partial class App : System.Windows.Application {
41 |
42 | ///
43 | /// InitializeComponent
44 | ///
45 | [System.Diagnostics.DebuggerNonUserCodeAttribute()]
46 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
47 | public void InitializeComponent() {
48 |
49 | #line 4 "..\..\App.xaml"
50 | this.StartupUri = new System.Uri("MainWindow.xaml", System.UriKind.Relative);
51 |
52 | #line default
53 | #line hidden
54 | }
55 |
56 | ///
57 | /// Application Entry Point.
58 | ///
59 | [System.STAThreadAttribute()]
60 | [System.Diagnostics.DebuggerNonUserCodeAttribute()]
61 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
62 | public static void Main() {
63 | Ex2._0.App app = new Ex2._0.App();
64 | app.InitializeComponent();
65 | app.Run();
66 | }
67 | }
68 | }
69 |
70 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/obj/Debug/App.g.i.cs:
--------------------------------------------------------------------------------
1 | #pragma checksum "..\..\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "C5EACC5C196D47BED54188B899D63EE4"
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by a tool.
5 | // Runtime Version:4.0.30319.34011
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 |
12 | using System;
13 | using System.Diagnostics;
14 | using System.Windows;
15 | using System.Windows.Automation;
16 | using System.Windows.Controls;
17 | using System.Windows.Controls.Primitives;
18 | using System.Windows.Data;
19 | using System.Windows.Documents;
20 | using System.Windows.Ink;
21 | using System.Windows.Input;
22 | using System.Windows.Markup;
23 | using System.Windows.Media;
24 | using System.Windows.Media.Animation;
25 | using System.Windows.Media.Effects;
26 | using System.Windows.Media.Imaging;
27 | using System.Windows.Media.Media3D;
28 | using System.Windows.Media.TextFormatting;
29 | using System.Windows.Navigation;
30 | using System.Windows.Shapes;
31 | using System.Windows.Shell;
32 |
33 |
34 | namespace Ex1._0 {
35 |
36 |
37 | ///
38 | /// App
39 | ///
40 | public partial class App : System.Windows.Application {
41 |
42 | ///
43 | /// InitializeComponent
44 | ///
45 | [System.Diagnostics.DebuggerNonUserCodeAttribute()]
46 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
47 | public void InitializeComponent() {
48 |
49 | #line 4 "..\..\App.xaml"
50 | this.StartupUri = new System.Uri("MainWindow.xaml", System.UriKind.Relative);
51 |
52 | #line default
53 | #line hidden
54 | }
55 |
56 | ///
57 | /// Application Entry Point.
58 | ///
59 | [System.STAThreadAttribute()]
60 | [System.Diagnostics.DebuggerNonUserCodeAttribute()]
61 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
62 | public static void Main() {
63 | Ex1._0.App app = new Ex1._0.App();
64 | app.InitializeComponent();
65 | app.Run();
66 | }
67 | }
68 | }
69 |
70 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/obj/Debug/App.g.i.cs:
--------------------------------------------------------------------------------
1 | #pragma checksum "..\..\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "634B96B180516B69FFAB423F226AC2F0"
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by a tool.
5 | // Runtime Version:4.0.30319.34014
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 |
12 | using System;
13 | using System.Diagnostics;
14 | using System.Windows;
15 | using System.Windows.Automation;
16 | using System.Windows.Controls;
17 | using System.Windows.Controls.Primitives;
18 | using System.Windows.Data;
19 | using System.Windows.Documents;
20 | using System.Windows.Ink;
21 | using System.Windows.Input;
22 | using System.Windows.Markup;
23 | using System.Windows.Media;
24 | using System.Windows.Media.Animation;
25 | using System.Windows.Media.Effects;
26 | using System.Windows.Media.Imaging;
27 | using System.Windows.Media.Media3D;
28 | using System.Windows.Media.TextFormatting;
29 | using System.Windows.Navigation;
30 | using System.Windows.Shapes;
31 | using System.Windows.Shell;
32 |
33 |
34 | namespace Ex2._0 {
35 |
36 |
37 | ///
38 | /// App
39 | ///
40 | public partial class App : System.Windows.Application {
41 |
42 | ///
43 | /// InitializeComponent
44 | ///
45 | [System.Diagnostics.DebuggerNonUserCodeAttribute()]
46 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
47 | public void InitializeComponent() {
48 |
49 | #line 4 "..\..\App.xaml"
50 | this.StartupUri = new System.Uri("MainWindow.xaml", System.UriKind.Relative);
51 |
52 | #line default
53 | #line hidden
54 | }
55 |
56 | ///
57 | /// Application Entry Point.
58 | ///
59 | [System.STAThreadAttribute()]
60 | [System.Diagnostics.DebuggerNonUserCodeAttribute()]
61 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
62 | public static void Main() {
63 | Ex2._0.App app = new Ex2._0.App();
64 | app.InitializeComponent();
65 | app.Run();
66 | }
67 | }
68 | }
69 |
70 |
--------------------------------------------------------------------------------
/Macros/deleteElements/deleteElements.cs:
--------------------------------------------------------------------------------
1 | /*
2 | This code will delete views, filters and view templates from your Project
3 | */
4 |
5 | public void deleteElements()
6 | {
7 | //sets the variable to the current application
8 | Document doc = this.ActiveUIDocument.Document;
9 |
10 | //uses linq to select the views and templates to delete
11 | var ViewDelExport = from elem in new FilteredElementCollector(doc)
12 | .OfClass(typeof(View))
13 | let type = elem as View
14 | where type.ViewType == ViewType.AreaPlan ||
15 | type.ViewType == ViewType.CeilingPlan ||
16 | type.ViewType == ViewType.ColumnSchedule ||
17 | type.ViewType == ViewType.CostReport ||
18 | type.ViewType == ViewType.Detail ||
19 | type.ViewType == ViewType.DraftingView ||
20 | type.ViewType == ViewType.Legend ||
21 | type.ViewType == ViewType.LoadsReport ||
22 | type.ViewType == ViewType.PanelSchedule ||
23 | type.ViewType == ViewType.PresureLossReport ||
24 | type.ViewType == ViewType.Rendering ||
25 | type.ViewType == ViewType.Report ||
26 | type.ViewType == ViewType.Section ||
27 | type.ViewType == ViewType.ThreeD ||
28 | type.ViewType == ViewType.Walkthrough ||
29 | type.ViewType == ViewType.Elevation ||
30 | type.ViewType == ViewType.Undefined ||
31 | type.ViewType == ViewType.DrawingSheet ||
32 | type.IsTemplate
33 | select type;
34 |
35 | //gets the element id's of the views and adds them to a list
36 | var deleteViews = ViewDelExport.Select(view => view.Id).ToList();
37 |
38 | //gets all the element id's of the filters in a project
39 | var deletefilters = new FilteredElementCollector(doc).OfClass(typeof(ParameterFilterElement))
40 | .WhereElementIsNotElementType().ToElementIds();
41 |
42 | //create a new transaction
43 | Transaction tx = new Transaction(doc);
44 | //starts the new transaction
45 | tx.Start("Delete All View Templates");
46 | //delete all the views
47 | doc.Delete(deleteViews);
48 | //delete the filters in the project
49 | doc.Delete(deletefilters);
50 | //commits the transaction
51 | tx.Commit();
52 | }
53 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/Command.cs:
--------------------------------------------------------------------------------
1 | #region Namespaces
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Diagnostics;
5 | using System.Windows;
6 | using Autodesk.Revit.ApplicationServices;
7 | using Autodesk.Revit.Attributes;
8 | using Autodesk.Revit.DB;
9 | using Autodesk.Revit.UI;
10 | using Autodesk.Revit.UI.Selection;
11 | #endregion
12 |
13 | namespace Application
14 | {
15 | [Transaction(TransactionMode.Manual)]
16 | public class getSelection : IExternalCommand
17 | {
18 | public Result Execute(
19 | ExternalCommandData commandData,
20 | ref string message,
21 | ElementSet elements)
22 | {
23 | UIApplication uiapp = commandData.Application;
24 | UIDocument uidoc = uiapp.ActiveUIDocument;
25 | Document doc = uidoc.Document;
26 |
27 | examplecommands.getSelection(doc, uidoc);
28 |
29 | return Result.Succeeded;
30 | }
31 | }
32 | [Transaction(TransactionMode.Manual)]
33 | public class getCollection : IExternalCommand
34 | {
35 | public Result Execute(
36 | ExternalCommandData commandData,
37 | ref string message,
38 | ElementSet elements)
39 | {
40 | UIApplication uiapp = commandData.Application;
41 | UIDocument uidoc = uiapp.ActiveUIDocument;
42 | Document doc = uidoc.Document;
43 |
44 | examplecommands.getCollection(doc, uidoc);
45 |
46 | return Result.Succeeded;
47 | }
48 | }
49 | [Transaction(TransactionMode.Manual)]
50 | public class updateDoor : IExternalCommand
51 | {
52 | public Result Execute(
53 | ExternalCommandData commandData,
54 | ref string message,
55 | ElementSet elements)
56 | {
57 | UIApplication uiapp = commandData.Application;
58 | UIDocument uidoc = uiapp.ActiveUIDocument;
59 | Document doc = uidoc.Document;
60 |
61 | examplecommands.updateDoor(doc, uidoc);
62 |
63 | return Result.Succeeded;
64 | }
65 | }
66 | [Transaction(TransactionMode.Manual)]
67 | public class importData : IExternalCommand
68 | {
69 | public Result Execute(
70 | ExternalCommandData commandData,
71 | ref string message,
72 | ElementSet elements)
73 | {
74 | UIApplication uiapp = commandData.Application;
75 | UIDocument uidoc = uiapp.ActiveUIDocument;
76 | Document doc = uidoc.Document;
77 |
78 | UserControl1 form = new UserControl1(doc);
79 | form.ShowDialog();
80 |
81 | return Result.Succeeded;
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/Exercises/Ex1.2.cs:
--------------------------------------------------------------------------------
1 | /*
2 | //This is all our references for accessing particular commands
3 | //This is how we create regions to make our code easier to read
4 | #region Namespaces
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows;
11 | using System.Windows.Controls;
12 | using System.Windows.Data;
13 | using System.Windows.Documents;
14 | using System.Windows.Input;
15 | using System.Windows.Media;
16 | using System.Windows.Media.Imaging;
17 | using System.Windows.Navigation;
18 | using System.Windows.Shapes;
19 | #endregion
20 |
21 | //The namespace is the location where our code is located
22 | namespace Ex1._0
23 | {
24 | ///
25 | /// Interaction logic for MainWindow.xaml
26 | /// // a partial class is a special type of class that relies on other classes for it's functionality
27 | ///
28 | public partial class MainWindow : Window
29 | {
30 | public string filename;
31 | //This is the constructor that is the instructions used to create the class
32 | public MainWindow()
33 | {
34 | //This is the command that creates the MainWindow as a window in Windows OS
35 | InitializeComponent();
36 | }
37 | //This is an method that tells the computer what to do when we click a button.
38 | private void Calculate_Click(object sender, RoutedEventArgs e)
39 | {
40 | //asigns space DataType int to these to variable names
41 | int ivalue1;
42 | int ivalue2;
43 |
44 | //try to convert the text in the textbox to an int if successful bvaluetest equals true
45 | //and the out value is the int conversion result
46 | bool bvaluetest = Int32.TryParse(value1.Text, out ivalue1);
47 | //if statement that checks if the bvaluetext is true or false
48 | if (bvaluetest == false)
49 | {
50 | //If the text cannot be converted displays the following message and exits the code
51 | MessageBox.Show("Please enter a whole number");
52 | }
53 |
54 | bool bvaluetest1 = Int32.TryParse(value2.Text, out ivalue2);
55 | if (bvaluetest1 == false)
56 | {
57 | MessageBox.Show("Please enter a whole number");
58 | }
59 |
60 | //creates a new int and gets the result of the addition of two int values
61 | int iresult = ivalue1 + ivalue2;
62 |
63 | //This gets the result of the two values and puts the value into the text of the textbox
64 | tbResult.Text = iresult.ToString();
65 | }
66 | }
67 | }
68 | */
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/Command.cs:
--------------------------------------------------------------------------------
1 | #region Namespaces
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Diagnostics;
5 | using Autodesk.Revit.ApplicationServices;
6 | using Autodesk.Revit.Attributes;
7 | using Autodesk.Revit.DB;
8 | using Autodesk.Revit.UI;
9 | using Autodesk.Revit.UI.Selection;
10 | #endregion
11 |
12 | namespace NewCommands
13 | {
14 | [Transaction(TransactionMode.Manual)]
15 | public class GetSelection : IExternalCommand
16 | {
17 | public UIDocument uidoc;
18 | public Document doc;
19 |
20 | public Result Execute(
21 | ExternalCommandData commandData,
22 | ref string message,
23 | ElementSet elements)
24 | {
25 | UIApplication uiapp = commandData.Application;
26 | uidoc = uiapp.ActiveUIDocument;
27 | Application app = uiapp.Application;
28 | doc = uidoc.Document;
29 |
30 | //creates a new instance of the wallselectionFilter
31 | ISelectionFilter wallfil = new WallSelectionFilter();
32 |
33 | //gets the object selected Elementid, applies the selection filter and the string mesasge
34 | ElementId obj = uidoc.Selection.PickObject(ObjectType.Element, wallfil, "Select a Wall please").ElementId;
35 |
36 | //gets the element from the ElementID
37 | Element e = doc.GetElement(obj);
38 | //get the family type Elementid
39 | ElementId idType = e.GetTypeId();
40 | //Get the Element Type ID
41 | Element pType = doc.GetElement(idType);
42 |
43 | //gets the instance length of the object
44 | string s = e.get_Parameter(BuiltInParameter.CURVE_ELEM_LENGTH).AsValueString();
45 |
46 | //gets the type width of the object
47 | string t = pType.get_Parameter(BuiltInParameter.WALL_ATTR_WIDTH_PARAM).AsValueString();
48 |
49 | //Shows the values
50 | TaskDialog.Show("Example", s + " " + t);
51 |
52 | return Result.Succeeded;
53 | }
54 | //creates an IselectionFilter interface
55 | public class WallSelectionFilter : ISelectionFilter
56 | {
57 | //Sets up a boolean based on whether an object can be selection
58 | public bool AllowElement(Element element)
59 | {
60 | //if statement for the wall object
61 | if (element.Category.Name == "Walls")
62 | {
63 | return true;
64 | }
65 | return false;
66 | }
67 | //sets up whether a reference can be selected
68 | public bool AllowReference(Reference refer, XYZ point)
69 | {
70 | return false;
71 | }
72 | }
73 | }
74 | }
75 |
76 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/Exercises/Ex1.3.cs:
--------------------------------------------------------------------------------
1 | /*
2 | //This is all our references for accessing particular commands
3 | //This is how we create regions to make our code easier to read
4 | #region Namespaces
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows;
11 | using System.Windows.Controls;
12 | using System.Windows.Data;
13 | using System.Windows.Documents;
14 | using System.Windows.Input;
15 | using System.Windows.Media;
16 | using System.Windows.Media.Imaging;
17 | using System.Windows.Navigation;
18 | using System.Windows.Shapes;
19 | #endregion
20 |
21 | //The namespace is the location where our code is located
22 | namespace Ex1._0
23 | {
24 | ///
25 | /// Interaction logic for MainWindow.xaml
26 | /// // a partial class is a special type of class that relies on other classes for it's functionality
27 | ///
28 | public partial class MainWindow : Window
29 | {
30 | public string filename;
31 | //This is the constructor that is the instructions used to create the class
32 | public MainWindow()
33 | {
34 | //This is the command that creates the MainWindow as a window in Windows OS
35 | InitializeComponent();
36 | }
37 | //This is an method that tells the computer what to do when we click a button.
38 | private void Calculate_Click(object sender, RoutedEventArgs e)
39 | {
40 | //asigns space DataType int to these to variable names
41 | //this runs our checker method that checks if the value can be converted
42 | //to an int and returns a result, otherwise we get a warning message
43 | int ivalue1 = checker(value1.Text);
44 | int ivalue2 = checker(value2.Text);
45 |
46 | //creates a new int and gets the result of the addition of two int values
47 | int iresult = ivalue1 + ivalue2;
48 |
49 | //This gets the result of the two values and puts the value into the text of the textbox
50 | tbResult.Text = iresult.ToString();
51 | }
52 | //method called checker that takes a string argument and if correct returns the converted int
53 | int checker(string text)
54 | {
55 | //this assigns the field ivalue to an int
56 | int ivalue;
57 | //checks to see if the text can be converted to an int and creates a bool as well as converts the text to an int
58 | bool bvaluetest = Int32.TryParse(text, out ivalue);
59 | //If statement to check if the conversion was successful
60 | if (bvaluetest != true)
61 | {
62 | //If not successful a warning message displays and no assignment of data is performed
63 | MessageBox.Show("Please enter a whole Number");
64 | }
65 | //returns the int value to the checker Method to be used as one of the calculated values
66 | return ivalue;
67 | }
68 | }
69 | }
70 | */
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34011
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Ex1._0.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ex1._0.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34011
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Ex2._0.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ex2._0.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/Macros/deleteElements/deleteElements.vb:
--------------------------------------------------------------------------------
1 | 'This code will delete views, filters and view templates from your Project
2 | Public Sub deleteElements()
3 |
4 | 'assigns document to the active document in use
5 | Dim document As Document = Me.ActiveUIDocument.Document
6 |
7 |
8 | ''get all the views and view template ids. Internally revit see view templates as view.
9 |
10 | ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
11 | '' original code. Doesn't actually get all views
12 | ' Dim viewidCollection As IEnumerable(Of ElementId) = From v As View In New FilteredElementCollector(document).OfCategory(BuiltInCategory.OST_Views).cast(Of view)
13 | ' Where v.ViewType = ViewType.AreaPlan Or _
14 | ' v.ViewType = ViewType.CeilingPlan Or _
15 | ' v.ViewType = ViewType.ColumnSchedule Or _
16 | ' v.ViewType = ViewType.CostReport Or _
17 | ' v.ViewType = ViewType.Detail Or _
18 | ' v.ViewType = ViewType.DraftingView Or _
19 | ' v.ViewType = ViewType.Legend Or _
20 | ' v.ViewType = ViewType.LoadsReport Or _
21 | ' v.ViewType = ViewType.PanelSchedule Or _
22 | ' v.ViewType = ViewType.PresureLossReport Or _
23 | ' v.ViewType = ViewType.Rendering Or _
24 | ' v.ViewType = ViewType.Report Or _
25 | ' v.ViewType = ViewType.Section Or _
26 | ' v.ViewType = ViewType.ThreeD Or _
27 | ' v.ViewType = ViewType.Walkthrough Or _
28 | ' v.ViewType = ViewType.Elevation Or _
29 | ' v.ViewType = ViewType.Undefined Or _
30 | ' v.ViewType = ViewType.DrawingSheet Or _
31 | ' v.IsTemplate
32 | ' Select v.Id
33 | ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
34 |
35 |
36 | 'updated code gets element ids of all views and view templates except project browser, system browser and active view as these cannot be deleted
37 | Dim viewCollection As list(Of ElementId) = (From v As View In New FilteredElementCollector(document).OfCategory(BuiltInCategory.OST_Views).cast(Of view)
38 | Where v.ViewType <> ViewType.ProjectBrowser And _
39 | v.ViewType <> ViewType.SystemBrowser And _
40 | v.ViewType <> ViewType.Internal And _
41 | v.Id <> document.ActiveView.id
42 | Select v.id).tolist
43 |
44 |
45 | 'get all the view filter ids
46 | Dim filteridCollection As list(Of ElementId) = (New FilteredElementCollector(document) _
47 | .ofclass(GetType(ParameterFilterElement)) _
48 | .WhereElementIsNotElementType _
49 | .ToElementids()).tolist
50 |
51 | 'Start a transaction CRITICAL without transactions Revit cannot update
52 | Using rvtTransaction As New Transaction(document,"Delete all views")
53 | rvtTransaction.Start()
54 |
55 | 'delete the views
56 | document.Delete(viewCollection)
57 |
58 | 'delete the filters
59 | document.Delete(filteridCollection)
60 |
61 | 'Commit the changes to the Revit File
62 | rvtTransaction.Commit
63 |
64 | End Using
65 |
66 |
67 | End Sub
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/Exercises/Ex1.4.cs:
--------------------------------------------------------------------------------
1 | /*
2 | //This is all our references for accessing particular commands
3 | //This is how we create regions to make our code easier to read
4 | #region Namespaces
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using System.Text;
9 | using System.Threading.Tasks;
10 | using System.Windows;
11 | using System.Windows.Controls;
12 | using System.Windows.Data;
13 | using System.Windows.Documents;
14 | using System.Windows.Input;
15 | using System.Windows.Media;
16 | using System.Windows.Media.Imaging;
17 | using System.Windows.Navigation;
18 | using System.Windows.Shapes;
19 | #endregion
20 |
21 | //The namespace is the location where our code is located
22 | namespace Ex1._0
23 | {
24 | ///
25 | /// Interaction logic for MainWindow.xaml
26 | /// // a partial class is a special type of class that relies on other classes for it's functionality
27 | ///
28 | public partial class MainWindow : Window
29 | {
30 | public string filename;
31 | //This is the constructor that is the instructions used to create the class
32 | public MainWindow()
33 | {
34 | //This is the command that creates the MainWindow as a window in Windows OS
35 | InitializeComponent();
36 | }
37 | //This is an method that tells the computer what to do when we click a button.
38 | private void Calculate_Click(object sender, RoutedEventArgs e)
39 | {
40 | //asigns space DataType int to these to variable names
41 | //this runs our checker method that checks if the value can be converted
42 | //to an int and returns a result, otherwise we get a warning message
43 | int ivalue1 = checker(value1.Text);
44 | int ivalue2 = checker(value2.Text);
45 |
46 | //assigns space for DataType int to variable name result
47 | int iresult;
48 | //
49 | if (rbPlus.IsChecked == true)
50 | {
51 | iresult = ivalue1 + ivalue2;
52 | }
53 | else
54 | {
55 | iresult = ivalue1 - ivalue2;
56 | }
57 |
58 | //This gets the result of the two values and puts the value into the text of the textbox
59 | tbResult.Text = iresult.ToString();
60 | }
61 | //method called checker that takes a string argument and if correct returns the converted int
62 | int checker(string text)
63 | {
64 | //this assigns the field ivalue to an int
65 | int ivalue;
66 | //checks to see if the text can be converted to an int and creates a bool as well as converts the text to an int
67 | bool bvaluetest = Int32.TryParse(text, out ivalue);
68 | //If statement to check if the conversion was successful
69 | if (bvaluetest != true)
70 | {
71 | //If not successful a warning message displays and no assignment of data is performed
72 | MessageBox.Show("Please enter a whole Number");
73 | }
74 | //returns the int value to the checker Method to be used as one of the calculated values
75 | return ivalue;
76 | }
77 | }
78 | }
79 | */
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/UserControl1.g.i.cs:
--------------------------------------------------------------------------------
1 | #pragma checksum "..\..\UserControl1.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "4EC5EEDD70B631BBBDC96C3A2CCACE44"
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by a tool.
5 | // Runtime Version:4.0.30319.34014
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 |
12 | using System;
13 | using System.Diagnostics;
14 | using System.Windows;
15 | using System.Windows.Automation;
16 | using System.Windows.Controls;
17 | using System.Windows.Controls.Primitives;
18 | using System.Windows.Data;
19 | using System.Windows.Documents;
20 | using System.Windows.Ink;
21 | using System.Windows.Input;
22 | using System.Windows.Markup;
23 | using System.Windows.Media;
24 | using System.Windows.Media.Animation;
25 | using System.Windows.Media.Effects;
26 | using System.Windows.Media.Imaging;
27 | using System.Windows.Media.Media3D;
28 | using System.Windows.Media.TextFormatting;
29 | using System.Windows.Navigation;
30 | using System.Windows.Shapes;
31 | using System.Windows.Shell;
32 |
33 |
34 | namespace CheckListFromRevit {
35 |
36 |
37 | ///
38 | /// checkwindow
39 | ///
40 | public partial class checkwindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
41 |
42 | private bool _contentLoaded;
43 |
44 | ///
45 | /// InitializeComponent
46 | ///
47 | [System.Diagnostics.DebuggerNonUserCodeAttribute()]
48 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
49 | public void InitializeComponent() {
50 | if (_contentLoaded) {
51 | return;
52 | }
53 | _contentLoaded = true;
54 | System.Uri resourceLocater = new System.Uri("/CheckListFromRevit;component/usercontrol1.xaml", System.UriKind.Relative);
55 |
56 | #line 1 "..\..\UserControl1.xaml"
57 | System.Windows.Application.LoadComponent(this, resourceLocater);
58 |
59 | #line default
60 | #line hidden
61 | }
62 |
63 | [System.Diagnostics.DebuggerNonUserCodeAttribute()]
64 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
65 | [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
66 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
67 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
68 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
69 | void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
70 | this._contentLoaded = true;
71 | }
72 | }
73 | }
74 |
75 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/NewCommands/NewCommands/NewCommands.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 |
7 |
8 |
9 |
10 | {97577F18-C09D-4A15-944B-E4B69EBF960F}
11 | Library
12 | Properties
13 | NewCommands
14 | v4.0
15 | 512
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 | Program
26 | $(ProgramW6432)\Autodesk\Revit 2014\Revit.exe
27 |
28 |
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 | Program
36 | $(ProgramW6432)\Autodesk\Revit 2014\Revit.exe
37 |
38 |
39 |
40 | C:\Program Files\Autodesk\Revit 2014\RevitAPI.dll
41 | False
42 |
43 |
44 | C:\Program Files\Autodesk\Revit 2014\RevitAPIUI.dll
45 | False
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 | copy "$(ProjectDir)NewCommands.addin" "$(AppData)\Autodesk\REVIT\Addins\2014"
71 | copy "$(ProjectDir)bin\debug\NewCommands.dll" "$(AppData)\Autodesk\REVIT\Addins\2014"
72 |
73 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/App.cs:
--------------------------------------------------------------------------------
1 | #region Namespaces
2 | using System;
3 | using System.Collections.Generic;
4 | using Autodesk.Revit.ApplicationServices;
5 | using Autodesk.Revit.Attributes;
6 | using Autodesk.Revit.DB;
7 | using Autodesk.Revit.UI;
8 |
9 | using System.Windows.Media.Imaging;
10 | #endregion
11 |
12 | namespace Application
13 | {
14 | class App : IExternalApplication
15 | {
16 | //sets the address for the dll file
17 | public string assemblyloca = @"C:\Users\Gytaco\AppData\Roaming\Autodesk\Revit\Addins\2014\Application.dll";
18 |
19 | //Built in startup command for Revit
20 | public Result OnStartup(UIControlledApplication a)
21 | {
22 | //the name of the new tab to be created
23 | string tabName = "RTC 2014";
24 | //method to create the tab
25 | a.CreateRibbonTab(tabName);
26 | //method to create a new panel
27 | RibbonPanel panel1 = a.CreateRibbonPanel(tabName, "Programming");
28 |
29 | //Buttons go in this area
30 | PullDown(panel1);
31 | updateDoor(panel1);
32 | //return succeeded
33 | return Result.Succeeded;
34 | }
35 |
36 | public void PullDown(RibbonPanel panel)
37 | {
38 | //creates a Push button for the get selection command
39 | PushButtonData bgetselect = new PushButtonData("getselec", "Get Selection", assemblyloca, "Application.getSelection");
40 | //creates a Push button for the get Collection command
41 | PushButtonData bgetCollect = new PushButtonData("getcoll", "Get Collection", assemblyloca, "Application.getCollection");
42 | //creates a pull down menu
43 | PulldownButtonData pdb1 = new PulldownButtonData("WallsSelection","Wall Selector");
44 | //assigns the pulldown menu to our panel
45 | PulldownButton pdb = panel.AddItem(pdb1) as PulldownButton;
46 | //adds the buttons above to the pulldown menu
47 | pdb.AddPushButton(bgetselect);
48 | pdb.AddPushButton(bgetCollect);
49 |
50 | }
51 |
52 | public void updateDoor(RibbonPanel panel)
53 | {
54 | //This where we setup the command it's using in this case the HelloWorld.CS
55 | PushButtonData pushButtondataHello = new PushButtonData("updateDoor", "Update Door Data", assemblyloca, "Application.updateDoor");
56 | // This is how we add the button to our Panel
57 | PushButton pushButtonHello = panel.AddItem(pushButtondataHello) as PushButton;
58 | //This is how we add an Icon
59 | //Make sure you reference WindowsBase and PresentationCore, and import System.Windows.Media.Imaging namespace.
60 | pushButtonHello.LargeImage = new BitmapImage(new Uri(@"C:\Users\Gytaco\AppData\Roaming\Autodesk\Revit\Addins\2014\Images\image.png"));
61 | //Add a tooltip
62 | pushButtonHello.ToolTip = "This tool updates the doors to contain ToRoom data in the comments parameter";
63 |
64 | PushButtonData importTextbutton = new PushButtonData("importData", "Import Comments for Walls", assemblyloca, "Application.importData");
65 | PushButton importText = panel.AddItem(importTextbutton) as PushButton;
66 | }
67 |
68 | public Result OnShutdown(UIControlledApplication a)
69 | {
70 | return Result.Succeeded;
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/Macros/placeViewsOnSheet/placeViewsOnSheets.cs:
--------------------------------------------------------------------------------
1 | /*
2 | This code has a placeholder sheet that allows users to move a single sheet and the views in other drawings
3 | will update.
4 | YOU NEED TO USE THIS WITH THE REVIT FILE CALLED THE SAME NAME IN THIS FOLDER!!
5 | */
6 |
7 | public void Ex08Op_PlaceMoveViewsOnSheets()
8 | {
9 | //sets the variable to the active document
10 | Document doc = this.ActiveUIDocument.Document;
11 | //creates an empty viewport object
12 | Viewport vpe = null;
13 |
14 | //collection to get the current viewports in our project
15 | var fcoll = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Viewports)
16 | .WhereElementIsNotElementType().ToElements();
17 |
18 | //goes through the viewports and the gets the drafting view called Placement Setup
19 | foreach (Element e in fcoll)
20 | {
21 | Viewport vp = e as Viewport;
22 | if(vp != null)
23 | {
24 | //gets the Viewport name which is the drafting sheet name
25 | string svp = vp.get_Parameter(BuiltInParameter.VIEWPORT_SHEET_NAME).AsString();
26 |
27 | if( svp == "Placement Setup")
28 | {
29 | vpe = vp;
30 | break;
31 | }
32 | }
33 | }
34 | //gets the centre location of the viewport cropbox or boundary area (becareful with this!!
35 | //If views are not the same size when place they will not align
36 | XYZ plcLoc = vpe.GetBoxCenter();
37 |
38 | //collection to get the single legend in the project
39 | var lcoll = from elem in new FilteredElementCollector(doc)
40 | .OfClass(typeof(View))
41 | let type = elem as View
42 | where type.ViewType == ViewType.Legend
43 | select type;
44 |
45 | //get the elementid of the single legend (Won't work if you have more then 1 legend)
46 | ElementId lid = lcoll.Select(elid => elid.Id).FirstOrDefault();
47 |
48 | //collector to get all the sheets in the project
49 | var sheetColl = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Sheets)
50 | .WhereElementIsNotElementType().ToElements();
51 |
52 | //starts the transaction
53 | using (Transaction t = new Transaction(doc, "Place Legends"))
54 | {
55 | t.Start();
56 |
57 | //cycles through the sheets in the collection
58 | foreach (ViewSheet vs in sheetColl)
59 | {
60 | //set a placeholder element to null
61 | Element evp = null;
62 | //gets a list of all the elementid's of the viewports on a sheet
63 | ICollection vpcoll = vs.GetAllViewports();
64 | //checks if viewports exist
65 | if(vpcoll.Count == 0)
66 | {
67 | //if no viewports exists creates a sheet
68 | Viewport.Create(doc, vs.Id, lid, plcLoc);
69 | }
70 | //else if viewports exist runs the next code
71 | else
72 | {
73 | //cycles through the elementid's of the viewports collected
74 | foreach (ElementId vpid in vpcoll)
75 | {
76 | //gets the placeholder from above and puts an element inside it
77 | evp = doc.GetElement(vpid);
78 | //sets the element as a Viewport object i able
79 | Viewport vp = evp as Viewport;
80 | //checks if the elementid is a valid viewport object otherwise doesn't work
81 | if (vp != null)
82 | {
83 | //gets the name of the legend with a built in category
84 | string svp = vp.get_Parameter(BuiltInParameter.VIEW_NAME).AsString();
85 | //checks if the view is already on the sheet
86 | if(svp == "Placement View")
87 | {
88 | //if the names line up moves the legends to the updated position
89 | vp.SetBoxCenter(plcLoc);
90 | }
91 | }
92 | }
93 | }
94 | }
95 | t.Commit();
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/Application.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 |
7 |
8 |
9 |
10 | {8A6DE3A8-15CF-4DD0-B133-E9587C6B1236}
11 | Library
12 | Properties
13 | Application
14 | v4.0
15 | 512
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 | Program
26 | $(ProgramW6432)\Autodesk\Revit 2014\Revit.exe
27 |
28 |
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 | Program
36 | $(ProgramW6432)\Autodesk\Revit 2014\Revit.exe
37 |
38 |
39 |
40 |
41 |
42 | C:\Program Files\Autodesk\Revit 2014\RevitAPI.dll
43 | False
44 |
45 |
46 | C:\Program Files\Autodesk\Revit 2014\RevitAPIUI.dll
47 | False
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | UserControl1.xaml
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | Designer
75 | MSBuild:Compile
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | copy "$(ProjectDir)Application.addin" "$(AppData)\Autodesk\REVIT\Addins\2014"
85 | copy "$(ProjectDir)bin\debug\Application.dll" "$(AppData)\Autodesk\REVIT\Addins\2014"
86 |
87 |
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/CheckListFromRevit.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Debug
5 | AnyCPU
6 |
7 |
8 |
9 |
10 | {BE985B26-199F-4C9A-BD56-258C45872D92}
11 | Library
12 | Properties
13 | CheckListFromRevit
14 | v4.0
15 | 512
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 | Program
26 | $(ProgramW6432)\Autodesk\Revit 2014\Revit.exe
27 |
28 |
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 | Program
36 | $(ProgramW6432)\Autodesk\Revit 2014\Revit.exe
37 |
38 |
39 |
40 |
41 |
42 | $(ProgramW6432)\Autodesk\Revit 2014\RevitAPI.dll
43 | False
44 |
45 |
46 | $(ProgramW6432)\Autodesk\Revit 2014\RevitAPIUI.dll
47 | False
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | checkwindow.xaml
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | Designer
74 | MSBuild:Compile
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | copy "$(ProjectDir)CheckListFromRevit.addin" "$(AppData)\Autodesk\REVIT\Addins\2014"
84 | copy "$(ProjectDir)bin\debug\CheckListFromRevit.dll" "$(AppData)\Autodesk\REVIT\Addins\2014"
85 |
86 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
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 |
--------------------------------------------------------------------------------
/Macros/hideSetColour/hideSetColour.cs:
--------------------------------------------------------------------------------
1 | /*
2 | This code will hide and set the colours of any elements in yoru active view. There are additional search functionalities
3 | I have left in as tags to query and access objects.
4 | */
5 |
6 | public void hideSetColour()
7 | {
8 | //sets the variable to the current application
9 | Application app = this.Application;
10 | //sets the variable to the current document
11 | Document doc = this.ActiveUIDocument.Document;
12 | //gets the active view
13 | ElementId aview = this.ActiveUIDocument.ActiveView.Id;
14 |
15 | #region setup a colour override
16 | /*
17 | //create a new colour
18 | Color color = new Color(150, 200, 200);
19 |
20 | //gets the element of the fill pattern solid fill
21 | var fpcoll = from elem in new FilteredElementCollector(doc)
22 | .OfClass(typeof(FillPatternElement))
23 | let type = elem as FillPatternElement
24 | where type.Name == "Solid fill"
25 | select type;
26 | //gets the element id from the element
27 | var fpid = fpcoll.Select(fp => fp.Id).FirstOrDefault();
28 |
29 | //set the colour of the projection surface colour and the fill pattern
30 | var col = new OverrideGraphicSettings();
31 | col.SetProjectionFillColor(color);
32 | col.SetProjectionFillPatternId(fpid);
33 | */
34 | #endregion
35 |
36 | #region Linq to get Views by Name
37 | /*
38 | //LINQ query that uses a filtered element collector to get the view by name
39 | var viewget = from elem in new FilteredElementCollector(doc)
40 | .OfClass(typeof(ViewPlan))
41 | let type = elem as ViewPlan
42 | where type.Name == "Level 1"
43 | select type;
44 |
45 | //gets the element id of the view
46 | ElementId eid = viewget.Select(view => view.Id).FirstOrDefault();
47 | */
48 | #endregion
49 |
50 | //basic option to use a filter
51 | ICollection fiid = new FilteredElementCollector(doc, aview).OfCategory(BuiltInCategory.OST_Walls)
52 | .WhereElementIsNotElementType().ToElementIds();
53 |
54 | #region Linq to get elements by multiple categories
55 | /*
56 | //how to use multiple categories in a filtered collection
57 | ICollection fiid = new FilteredElementCollector(doc, eid)
58 | //applies a logical filter which allows user to add multiple categories
59 | .WherePasses(new LogicalOrFilter(new List
60 | {
61 | new ElementCategoryFilter(BuiltInCategory.OST_Walls),
62 | new ElementCategoryFilter(BuiltInCategory.OST_Floors)
63 | }))
64 | .WhereElementIsNotElementType().ToElementIds();
65 | */
66 | #endregion
67 |
68 | #region Linq to get elements by parameter values
69 | /*
70 | //Using LINQ lets the user select objects via a parameter value
71 | var elemget = from elem in new FilteredElementCollector(doc, eid)
72 | .OfClass(typeof(Wall)).WhereElementIsNotElementType()
73 | let type = elem as Wall
74 | where type.Name == "Generic - 300mm"
75 | select type;
76 |
77 |
78 | ICollection fiid = elemget.Select(elid => elid.Id).ToList();
79 | */
80 | #endregion
81 |
82 | //starts the transaction
83 | using (Transaction t = new Transaction(doc, "Hide Elements"))
84 | {
85 | t.Start();
86 |
87 | //uses the GetElement method to get the View
88 | View flrplan = doc.GetElement(aview) as View;
89 |
90 | //methods to hide the elements in the view based on their element id's
91 | flrplan.HideElements(fiid);
92 |
93 | #region set colour by element override
94 | /*
95 | var leftid = new FilteredElementCollector(doc, aview).WhereElementIsNotElementType().ToElementIds();
96 |
97 | //apply the override by element to the remaining visible elements
98 | foreach (ElementId feid in leftid)
99 | {
100 | flrplan.SetElementOverrides(feid, col);
101 | }
102 | */
103 | #endregion
104 |
105 | t.Commit();
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/UserControl1.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using System.Windows.Documents;
9 | using System.Windows.Input;
10 | using System.Windows.Media;
11 | using System.Windows.Media.Imaging;
12 | using System.Windows.Navigation;
13 | using System.Windows.Shapes;
14 | using System.IO;
15 |
16 | using Autodesk.Revit.DB;
17 | using Autodesk.Revit.UI;
18 |
19 | namespace Application
20 | {
21 | ///
22 | /// Interaction logic for UserControl1.xaml
23 | ///
24 | public partial class UserControl1 : Window
25 | {
26 | public string filename;
27 | public static Document doc;
28 |
29 | public UserControl1(Document doco)
30 | {
31 | doc = doco;
32 | InitializeComponent();
33 | }
34 |
35 | private void bopen_Clik(object sender, RoutedEventArgs e)
36 | {
37 |
38 | //Creates a select file dialog box in windows
39 | Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
40 |
41 | //Displays only that type of format file
42 | dlg.DefaultExt = ".txt";
43 | //Displays the string in the options for file selection
44 | dlg.Filter = "Text documents (.txt)|*.txt";
45 |
46 | //opens the Dialog box
47 | Nullable result = dlg.ShowDialog();
48 |
49 | //gets the location and filename as a text string
50 | filename = dlg.FileName;
51 | File_Location.Text = filename;
52 |
53 |
54 | }
55 |
56 |
57 |
58 | private void getResults_Click(object sender, RoutedEventArgs e)
59 | {
60 | //array string with no size
61 | string[] aData;
62 | //command that reads all the lines in our text file from the location
63 | aData = File.ReadAllLines(filename);
64 | //gets the length of our string array
65 | int len = (aData.Length - 1);
66 |
67 | //transaction to update our parameters
68 | using (Transaction t = new Transaction(doc, "comment updates"))
69 | {
70 | //start the transaction
71 | t.Start();
72 |
73 | //a for statement that is similar to foreach but is structured for arrays
74 | for (int i = 1; i <= len; i++)
75 | {
76 | //get the char location of the first tab in a line of text
77 | int iNo = aData[i].IndexOf('\t');
78 | //remove the rest of the string based on the position of the character
79 | string sId = aData[i].Remove(iNo);
80 |
81 | //removes the Id data from the string line
82 | string sComment1 = aData[i].Remove(0, iNo + 1);
83 | //get the char location of the second(now first) tab in the line of text
84 | int iNo2 = sComment1.IndexOf('\t');
85 | //removes the name data from the line of text leaving only comments
86 | string sComment2 = sComment1.Remove(0, iNo2 + 1);
87 |
88 | //convert the string id into an integer
89 | int iid = Int32.Parse(sId);
90 | //create a new elementid from the converted integer
91 | ElementId obj = new ElementId(iid);
92 | //get the element from the element id
93 | Element ge = doc.GetElement(obj);
94 |
95 | //update the comments parameter with the information in the text
96 | ge.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS).Set(sComment2);
97 | }
98 | //commit the transaction
99 | t.Commit();
100 | }
101 | TaskDialog.Show("Import Success!!", "Your Results have imported successfully");
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/examplecommands.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using Autodesk.Revit.DB;
6 | using Autodesk.Revit.UI;
7 | using Autodesk.Revit.UI.Selection;
8 |
9 | namespace Application
10 | {
11 | class examplecommands
12 | {
13 |
14 | //first exercise put into a user interface
15 | public static void getSelection(Document doc, UIDocument uidoc)
16 | {
17 | ISelectionFilter wallfil = new WallSelectionFilter();
18 |
19 | //gets the object selected Elementid, applies the selection filter and the string mesasge
20 | ElementId obj = uidoc.Selection.PickObject(ObjectType.Element, wallfil, "Select a Wall please").ElementId;
21 |
22 | //gets the element from the ElementID
23 | Element e = doc.GetElement(obj);
24 | //get the family type Elementid
25 | ElementId idType = e.GetTypeId();
26 | //Get the Element Type ID
27 | Element pType = doc.GetElement(idType);
28 |
29 | //gets the instance length of the object
30 | string s = e.get_Parameter(BuiltInParameter.CURVE_ELEM_LENGTH).AsValueString();
31 |
32 | //gets the type width of the object
33 | string t = pType.get_Parameter(BuiltInParameter.WALL_ATTR_WIDTH_PARAM).AsValueString();
34 |
35 | //Shows the values
36 | TaskDialog.Show("Example", s + " " + t );
37 | }
38 | //creates an IselectionFilter interface
39 | class WallSelectionFilter : ISelectionFilter
40 | {
41 | //Sets up a boolean based on whether an object can be selection
42 | public bool AllowElement(Element element)
43 | {
44 | //if statement for the wall object
45 | if (element.Category.Name == "Walls")
46 | {
47 | return true;
48 | }
49 | return false;
50 | }
51 | //sets up whether a reference can be selected
52 | public bool AllowReference(Reference refer, XYZ point)
53 | {
54 | return false;
55 | }
56 | }
57 | //second exercise put into a user interface
58 | public static void getCollection(Document doc, UIDocument uidoc)
59 | {
60 | //Creates a new stringbuilder Instance
61 | StringBuilder results = new StringBuilder(string.Empty);
62 |
63 | //Basic collection for walls
64 | ICollection elem = new FilteredElementCollector(doc)
65 | .OfCategory(BuiltInCategory.OST_Walls).WhereElementIsElementType().ToElements();
66 |
67 | //foreach statement to get access to the data or elements
68 | foreach (Element e in elem)
69 | {
70 | //TaskDialog.Show("List of Instances", Name and e.Id.ToString() );
71 | results.Append("Wall Name: " + e.Name + "- Id Number: " + e.Id.ToString() + "\n");
72 | }
73 |
74 | //Dialog to show results
75 | TaskDialog.Show("List of Instances", results.ToString());
76 | }
77 | //third exervise put into a user interface
78 | public static void updateDoor(Document doc, UIDocument uidoc)
79 | {
80 | //creates a Collection of the doors as FamilyInstances
81 | var doorColl = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Doors)
82 | .OfClass(typeof(FamilyInstance));
83 |
84 | //Uses linq queries to select the door that have a ToRoom Value
85 | IEnumerable doors =
86 | from FamilyInstance f in doorColl
87 | where f.ToRoom != null
88 | select f;
89 |
90 | //Start the transaction CRITICAL without transactions Revit cannot update
91 | using (Transaction t = new Transaction(doc, "Door Data Update"))
92 | {
93 | //Starts the transction
94 | t.Start();
95 | //goes through each door based on the filter above
96 | foreach (FamilyInstance e in doors)
97 | {
98 | //gets the ToRoom number as a string
99 | string doorToRoom = e.ToRoom.Number.ToString();
100 | //updates the comments parameter to the ToRoom value
101 | e.get_Parameter(BuiltInParameter.ALL_MODEL_INSTANCE_COMMENTS).Set(doorToRoom);
102 | }
103 | //Commits the changes to the Revit File
104 | t.Commit();
105 | }
106 | }
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/Macros/interiorFloorByRoom/interiorFloorByRoom.cs:
--------------------------------------------------------------------------------
1 | /*
2 | The code will get all the rooms in the project and make an individual floor to each of the internal boundaries.
3 | It will then offset the floor by the floor type thickness. It is just set to the current floor for now.
4 | */
5 |
6 | //SPECTIAL NOTE: you need to put code in a line above the following
7 | //private void Module_Startup(object sender, EventArgs e)
8 | //That code you need to copy paste is
9 | public List changefloorheight = new List();
10 | //there are better ways to handle this but this was faster :)
11 |
12 | public void interiorFloorByRoom()
13 | {
14 | //SETUP public ILIST in the CLASS!!!!
15 |
16 |
17 | //sets the variable to the current appliction
18 | Application app = this.Application;
19 | //sets the variable to the active project
20 | Document doc = this.ActiveUIDocument.Document;
21 |
22 | //finds all the rooms in the project
23 | ICollection eRoom = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Rooms)
24 | .WhereElementIsNotElementType().ToElements();
25 |
26 | //cycles through each room in the project
27 | foreach (Element e in eRoom)
28 | {
29 | //gets the element as a room object
30 | Room r = e as Room;
31 | //creates a new array of curves to store the room outline
32 | CurveArray floor = new CurveArray();
33 | //sets the rules for the spatial element boundaries (centre, external/internal etc..)
34 | SpatialElementBoundaryOptions opt = new SpatialElementBoundaryOptions();
35 | //sets the option to respect the wall finish of the room
36 | opt.SpatialElementBoundaryLocation = SpatialElementBoundaryLocation.Finish;
37 | //gets the boundary segements of the room and applies the options
38 | IList> loops = r.GetBoundarySegments(opt);
39 | //loops through the boundary for the segments
40 | foreach (IList a in loops)
41 | {
42 | //cycles through boundary to get the individual curves
43 | foreach (AliasBoundarySegment item in a)
44 | {
45 | //get the curve
46 | Curve floorCurve = item.Curve;
47 | //adds the curve to the curve array
48 | floor.Append(floorCurve);
49 | }
50 | }
51 | //clears the change floor height for each Room so it starts new again
52 | changefloorheight.Clear();
53 | //this starts the an event tracker to watch when our program creates objects and looks
54 | //for the Floor object to be created so we can get the id number of the new item
55 | app.DocumentChanged += new EventHandler(OnDocumentChanged);
56 | //starts the transaction
57 | Transaction tran = new Transaction(doc, "Generate Floor");
58 | tran.Start();
59 | //creates the floor object
60 | doc.Create.NewFloor(floor, false);
61 | //commits the transaction
62 | tran.Commit();
63 | //turns off the event tracker for the object creation
64 | app.DocumentChanged -= new EventHandler(OnDocumentChanged );
65 | //cycles through all the objects id's that were created while the event was open
66 | foreach (ElementId id in changefloorheight)
67 | {
68 | //tries to select the element id as a floor object
69 | Floor fltest = doc.GetElement(id) as Floor;
70 | //If the object is not null then it is a floor otherwise it will skip this and check
71 | //the next id
72 | if (fltest != null)
73 | {
74 | //gets the parameters of the floor thickness
75 | Parameter p = fltest.get_Parameter(BuiltInParameter.FLOOR_ATTR_THICKNESS_PARAM);
76 | //gets the parameter of the floor above height level
77 | Parameter offset = fltest.get_Parameter(BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM);
78 | //starts another transaction to update the floor parameter
79 | Transaction tran2 = new Transaction(doc, "Generate Floor");
80 | tran2.Start();
81 | //sets the offset of the floor to the desired height
82 | offset.Set(p.AsDouble());
83 | //commits the transaction
84 | tran2.Commit();
85 | }
86 | }
87 | }
88 | }
89 | //this method turns on and off the even track that tracks changes to the revit database
90 | void OnDocumentChanged(object sender, DocumentChangedEventArgs e)
91 | {
92 | //finds the element id of the room based on looking for the floor only
93 | changefloorheight.AddRange(e.GetAddedElementIds());
94 | }
95 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/Ex2.0.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {1A0C4A4F-82C9-47C1-9130-1E09616E61D3}
8 | WinExe
9 | Properties
10 | Ex2._0
11 | Ex2.0
12 | v4.5
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | 4.0
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | MSBuild:Compile
54 | Designer
55 |
56 |
57 | App.xaml
58 | Code
59 |
60 |
61 |
62 |
63 |
64 | MainWindow.xaml
65 |
66 |
67 | Code
68 |
69 |
70 | True
71 | True
72 | Resources.resx
73 |
74 |
75 | True
76 | Settings.settings
77 | True
78 |
79 |
80 | ResXFileCodeGenerator
81 | Resources.Designer.cs
82 |
83 |
84 | SettingsSingleFileGenerator
85 | Settings.Designer.cs
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 | MSBuild:Compile
95 | Designer
96 |
97 |
98 |
99 |
100 |
107 |
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/checkwindow.g.cs:
--------------------------------------------------------------------------------
1 | #pragma checksum "..\..\checkwindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "8D5D8AAAE097FAB90DCDEBC495F85ECA"
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by a tool.
5 | // Runtime Version:4.0.30319.34014
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 |
12 | using System;
13 | using System.Diagnostics;
14 | using System.Windows;
15 | using System.Windows.Automation;
16 | using System.Windows.Controls;
17 | using System.Windows.Controls.Primitives;
18 | using System.Windows.Data;
19 | using System.Windows.Documents;
20 | using System.Windows.Ink;
21 | using System.Windows.Input;
22 | using System.Windows.Markup;
23 | using System.Windows.Media;
24 | using System.Windows.Media.Animation;
25 | using System.Windows.Media.Effects;
26 | using System.Windows.Media.Imaging;
27 | using System.Windows.Media.Media3D;
28 | using System.Windows.Media.TextFormatting;
29 | using System.Windows.Navigation;
30 | using System.Windows.Shapes;
31 | using System.Windows.Shell;
32 |
33 |
34 | namespace CheckListFromRevit {
35 |
36 |
37 | ///
38 | /// checkwindow
39 | ///
40 | public partial class checkwindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
41 |
42 |
43 | #line 8 "..\..\checkwindow.xaml"
44 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
45 | internal System.Windows.Controls.ListBox ObjectList;
46 |
47 | #line default
48 | #line hidden
49 |
50 |
51 | #line 9 "..\..\checkwindow.xaml"
52 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
53 | internal System.Windows.Controls.Button bCreate;
54 |
55 | #line default
56 | #line hidden
57 |
58 | private bool _contentLoaded;
59 |
60 | ///
61 | /// InitializeComponent
62 | ///
63 | [System.Diagnostics.DebuggerNonUserCodeAttribute()]
64 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
65 | public void InitializeComponent() {
66 | if (_contentLoaded) {
67 | return;
68 | }
69 | _contentLoaded = true;
70 | System.Uri resourceLocater = new System.Uri("/CheckListFromRevit;component/checkwindow.xaml", System.UriKind.Relative);
71 |
72 | #line 1 "..\..\checkwindow.xaml"
73 | System.Windows.Application.LoadComponent(this, resourceLocater);
74 |
75 | #line default
76 | #line hidden
77 | }
78 |
79 | [System.Diagnostics.DebuggerNonUserCodeAttribute()]
80 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
81 | [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
82 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
83 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
84 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
85 | void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
86 | switch (connectionId)
87 | {
88 | case 1:
89 | this.ObjectList = ((System.Windows.Controls.ListBox)(target));
90 | return;
91 | case 2:
92 | this.bCreate = ((System.Windows.Controls.Button)(target));
93 |
94 | #line 9 "..\..\checkwindow.xaml"
95 | this.bCreate.Click += new System.Windows.RoutedEventHandler(this.bClick);
96 |
97 | #line default
98 | #line hidden
99 | return;
100 | case 3:
101 |
102 | #line 10 "..\..\checkwindow.xaml"
103 | ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1);
104 |
105 | #line default
106 | #line hidden
107 | return;
108 | }
109 | this._contentLoaded = true;
110 | }
111 | }
112 | }
113 |
114 |
--------------------------------------------------------------------------------
/Visual Studio Projects/WPFExamples/Bonus Stuff/CheckListFromRevit/CheckListFromRevit/obj/Debug/checkwindow.g.i.cs:
--------------------------------------------------------------------------------
1 | #pragma checksum "..\..\checkwindow.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "8D5D8AAAE097FAB90DCDEBC495F85ECA"
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by a tool.
5 | // Runtime Version:4.0.30319.34014
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 |
12 | using System;
13 | using System.Diagnostics;
14 | using System.Windows;
15 | using System.Windows.Automation;
16 | using System.Windows.Controls;
17 | using System.Windows.Controls.Primitives;
18 | using System.Windows.Data;
19 | using System.Windows.Documents;
20 | using System.Windows.Ink;
21 | using System.Windows.Input;
22 | using System.Windows.Markup;
23 | using System.Windows.Media;
24 | using System.Windows.Media.Animation;
25 | using System.Windows.Media.Effects;
26 | using System.Windows.Media.Imaging;
27 | using System.Windows.Media.Media3D;
28 | using System.Windows.Media.TextFormatting;
29 | using System.Windows.Navigation;
30 | using System.Windows.Shapes;
31 | using System.Windows.Shell;
32 |
33 |
34 | namespace CheckListFromRevit {
35 |
36 |
37 | ///
38 | /// checkwindow
39 | ///
40 | public partial class checkwindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
41 |
42 |
43 | #line 8 "..\..\checkwindow.xaml"
44 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
45 | internal System.Windows.Controls.ListBox ObjectList;
46 |
47 | #line default
48 | #line hidden
49 |
50 |
51 | #line 9 "..\..\checkwindow.xaml"
52 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
53 | internal System.Windows.Controls.Button bCreate;
54 |
55 | #line default
56 | #line hidden
57 |
58 | private bool _contentLoaded;
59 |
60 | ///
61 | /// InitializeComponent
62 | ///
63 | [System.Diagnostics.DebuggerNonUserCodeAttribute()]
64 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
65 | public void InitializeComponent() {
66 | if (_contentLoaded) {
67 | return;
68 | }
69 | _contentLoaded = true;
70 | System.Uri resourceLocater = new System.Uri("/CheckListFromRevit;component/checkwindow.xaml", System.UriKind.Relative);
71 |
72 | #line 1 "..\..\checkwindow.xaml"
73 | System.Windows.Application.LoadComponent(this, resourceLocater);
74 |
75 | #line default
76 | #line hidden
77 | }
78 |
79 | [System.Diagnostics.DebuggerNonUserCodeAttribute()]
80 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
81 | [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
82 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
83 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
84 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
85 | void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
86 | switch (connectionId)
87 | {
88 | case 1:
89 | this.ObjectList = ((System.Windows.Controls.ListBox)(target));
90 | return;
91 | case 2:
92 | this.bCreate = ((System.Windows.Controls.Button)(target));
93 |
94 | #line 9 "..\..\checkwindow.xaml"
95 | this.bCreate.Click += new System.Windows.RoutedEventHandler(this.bClick);
96 |
97 | #line default
98 | #line hidden
99 | return;
100 | case 3:
101 |
102 | #line 10 "..\..\checkwindow.xaml"
103 | ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1);
104 |
105 | #line default
106 | #line hidden
107 | return;
108 | }
109 | this._contentLoaded = true;
110 | }
111 | }
112 | }
113 |
114 |
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex1.0/Ex1.0/Ex1.0.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {F6F292FE-54F2-4D2B-9E8F-4DDA6A1E2D27}
8 | WinExe
9 | Properties
10 | Ex1._0
11 | Ex1.0
12 | v4.5
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | 4.0
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | MSBuild:Compile
54 | Designer
55 |
56 |
57 | MSBuild:Compile
58 | Designer
59 |
60 |
61 | App.xaml
62 | Code
63 |
64 |
65 |
66 |
67 |
68 |
69 | MainWindow.xaml
70 | Code
71 |
72 |
73 |
74 |
75 | Code
76 |
77 |
78 | True
79 | True
80 | Resources.resx
81 |
82 |
83 | True
84 | Settings.settings
85 | True
86 |
87 |
88 | ResXFileCodeGenerator
89 | Resources.Designer.cs
90 |
91 |
92 | SettingsSingleFileGenerator
93 | Settings.Designer.cs
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
108 |
--------------------------------------------------------------------------------
/Macros/copyProjectToProject/copyProj2Proj.vb:
--------------------------------------------------------------------------------
1 | ' This routine is more complex and has a few error handlers around it. It will copy across filters, Wall types and Wall Tags
2 | ' from a open project called Text.rvt to your current open project.
3 | ' TAKE NOTE: When having files open if your Windows Folder open for hide file extentions is turned on then this will not
4 | ' work and you will need to remove the .rvt from the file name.
5 | Public Sub copyProj2Proj()
6 |
7 | 'assign application to the current applicaton
8 | Dim application As Autodesk.Revit.ApplicationServices.Application = Me.Application
9 |
10 | 'assigns document to the active document in use - default
11 | Dim document As Document = Me.ActiveUIDocument.Document
12 |
13 | 'set the source document name
14 | Dim sourceDocumentName As String = "Test.rvt"
15 |
16 | 'get the source document
17 | Dim sourceDocument As Document = (From d As document In application.Documents.Cast(Of Document)
18 | Where d.Title = sourceDocumentName
19 | Select d).first
20 |
21 | 'create a list to store the list of categories that will be copied
22 | Dim categoriesToCopy As New List(Of BuiltInCategory)
23 |
24 | 'add wall and walltags to the category list
25 | categoriesToCopy.Add(BuiltInCategory.OST_Walls)
26 | categoriesToCopy.Add(BuiltInCategory.OST_WallTags)
27 |
28 | 'setup a collector for the source document
29 | Dim collector As New FilteredElementCollector(sourceDocument)
30 |
31 | 'setup a multicategoryfilter base on the category list
32 | Dim filter As New ElementMulticategoryFilter(categoriesToCopy)
33 |
34 | 'run the collector and get the wall and tag types to copy
35 | Dim wallsToCopy As iEnumerable(Of ElementId) = collector _
36 | .WherePasses(filter) _
37 | .WhereElementIsElementType _
38 | .ToElementIds
39 |
40 | 'get all the parameter filter ids
41 | Dim paramFiltersToCopy As List(Of elementid) = New FilteredElementCollector(sourceDocument) _
42 | .ofclass(GetType(ParameterFilterElement)) _
43 | .ToElementIds.ToList
44 |
45 | 'combine the lists
46 | Dim allElementsToCopy As New List(Of ElementId)
47 | allElementsToCopy.Addrange(wallsToCopy)
48 | allElementsToCopy.AddRange(paramFiltersToCopy)
49 |
50 | 'check we have at least one thing to copy
51 | If allElementsToCopy.Count>0 Then
52 |
53 | 'Start a transaction CRITICAL without transactions Revit cannot update
54 | Using rvtTransaction As New Transaction(document,"Copy families and filters")
55 | rvtTransaction.Start()
56 |
57 | 'set the copypaste options to use destination items when duplicates are found
58 | Dim copyOptions As New CopyPasteOptions()
59 | copyoptions.SetDuplicateTypeNamesHandler(New DuplicateTypeNamesHandler())
60 |
61 | 'copy elements
62 | ElementTransformUtils.CopyElements(sourceDocument,allElementsToCopy,document,Transform.Identity,copyOptions)
63 |
64 | 'setup a failure handler to supress warnings when the transaction is commited
65 | Dim failureOptions As FailureHandlingOptions = rvtTransaction.GetFailureHandlingOptions
66 | failureoptions.SetFailuresPreprocessor(New FailuresPreprocessor)
67 |
68 | 'Commit the changes to the Revit File
69 | rvtTransaction.Commit(failureOptions)
70 |
71 | End Using
72 |
73 | End If
74 |
75 | End Sub
76 |
77 |
78 |
79 |
80 | 'This class supresses duplication type warning dialog by forcing copy paste to use destination project types
81 | Public Class DuplicateTypeNamesHandler
82 | Implements IDuplicateTypeNamesHandler
83 |
84 | Public Function OnDuplicateTypeNamesFound(args As DuplicateTypeNamesHandlerArgs) As DuplicateTypeAction Implements IDuplicateTypeNamesHandler.OnDuplicateTypeNamesFound
85 |
86 | 'Always use duplicate destination types when asked
87 | Return DuplicateTypeAction.UseDestinationTypes
88 |
89 | End Function
90 |
91 | End Class
92 |
93 |
94 |
95 |
96 | 'This class silently handles failures caused by finding duplicates and allows revit to continue
97 | Public Class FailuresPreprocessor
98 | Implements IFailuresPreprocessor
99 |
100 | Public Function PreprocessFailures(ByVal failuresAccessor As FailuresAccessor) As FailureProcessingResult Implements IFailuresPreprocessor.PreprocessFailures
101 |
102 | 'look through all the failure messages
103 | For Each failureMessage As FailureMessageAccessor In failuresAccessor.GetFailureMessages
104 |
105 | 'Delete any "Can't paste duplicate types. Only non duplicate types will be pasted." messages
106 | If failureMessage.GetFailureDefinitionId = BuiltInFailures.CopyPasteFailures.CannotCopyDuplicates Then
107 | failuresAccessor.DeleteWarning(failureMessage)
108 | End If
109 | Next
110 |
111 | 'all othe messages will have to be dealt with interactively by the user
112 | Return FailureProcessingResult.Continue
113 |
114 | End Function
115 |
116 | End Class
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/Ex2.0/Ex2.0/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | //This is all our references for accessing particular commands
2 | //This is how we create regions to make our code easier to read
3 | #region Namespaces
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows;
10 | using System.Windows.Controls;
11 | using System.Windows.Data;
12 | using System.Windows.Documents;
13 | using System.Windows.Input;
14 | using System.Windows.Media;
15 | using System.Windows.Media.Imaging;
16 | using System.Windows.Navigation;
17 | using System.Windows.Shapes;
18 | #endregion
19 |
20 | //The namespace is the location where our code is located
21 | namespace Ex2._0
22 | {
23 | ///
24 | /// Interaction logic for MainWindow.xaml
25 | /// // a partial class is a special type of class that relies on other classes for it's functionality
26 | ///
27 | public partial class MainWindow : Window
28 | {
29 | public string filename;
30 | //This is the constructor that is the instructions used to create the class
31 | public MainWindow()
32 | {
33 | //This is the command that creates the MainWindow as a window in Windows OS
34 | InitializeComponent();
35 | }
36 | //This is an method that tells the computer what to do when we click a button.
37 | private void Calculate_Click(object sender, RoutedEventArgs e)
38 | {
39 | int i1 = checker(value1.Text);
40 | int i2 = checker(value2.Text);
41 |
42 | int result;
43 |
44 | if (rbplus.IsChecked == true)
45 | {
46 | result = i1 + i2;
47 | }
48 | else
49 | {
50 | result = i1 - i2;
51 | }
52 |
53 | tbResult.Text = result.ToString();
54 | }
55 | //This is a method that returns the calculating ints after checking they can be ints
56 | int checker(string text)
57 | {
58 | //this assigns the field ivalue to an int
59 | int ivalue;
60 | //checks to see if the text can be converted to an int and creates a bool as well as converts the text to an int
61 | bool bvaluetest = Int32.TryParse(text, out ivalue);
62 | //If statement to check if the conversion was successful
63 | if (bvaluetest != true)
64 | {
65 | //If not successful a warning message displays and no assignment of data is performed
66 | MessageBox.Show("Please enter a whole Number");
67 | }
68 | //returns the int value to the checker Method to be used as one of the calculated values
69 | return ivalue;
70 | }
71 | #region String Manipulators
72 | private void bToUpper_Click(object sender, RoutedEventArgs e)
73 | {
74 | //string result;
75 | //result = tbstring.Text.ToUpper();
76 | //tbstringresult1.Text = result;
77 |
78 | //sets the text to upper case and stores it in the textbox
79 | tbstringresult1.Text = tbstring.Text.ToUpper();
80 | }
81 |
82 | private void bToLower_Click(object sender, RoutedEventArgs e)
83 | {
84 | //sets the text to lower case and stores it in the textblock
85 | tbstringresult1.Text = tbstring.Text.ToLower();
86 | }
87 |
88 | private void bRSpaces_Click(object sender, RoutedEventArgs e)
89 | {
90 | //removes all the spaces from the text string and stores it in the textblock
91 | tbstringresult1.Text = tbstring.Text.Replace(" ", string.Empty);
92 | }
93 | #endregion
94 | //Concatenates (joins) the strings together to make a single string
95 | private void bConcatenate_Click(object sender, RoutedEventArgs e)
96 | {
97 | //tbstringresult2.Text = (tbconc1.Text + tbconc2.Text + tbconc3.Text + tbconc4.Text);
98 | tbstringresult2.Text = (tbconc1.Text + tbSeperator.Text + tbconc2.Text + tbSeperator.Text + tbconc3.Text + tbSeperator.Text + tbconc4.Text);
99 | }
100 | //creates a dialogbox to allow users to select the correct file
101 | private void bopenfile_Click(object sender, RoutedEventArgs e)
102 | {
103 | //Creates a select file dialog box in windows
104 | Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
105 |
106 | //Displays only that type of format file
107 | dlg.DefaultExt = ".txt";
108 | //Displays the string in the options for file selection
109 | dlg.Filter = "Text documents (.txt)|*.txt";
110 |
111 | //opens the Dialog box
112 | Nullable result = dlg.ShowDialog();
113 |
114 | //gets the location and filename as a text string
115 | filename = dlg.FileName;
116 | tbFileLocation.Text = filename;
117 |
118 |
119 | }
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/Macros/hideSetColour/hideSetColour.vb:
--------------------------------------------------------------------------------
1 | ' This code will hide and set the colours of any elements in yoru active view. There are additional search functionalities
2 | ' I have left in as tags to query and access objects.
3 | Public Sub HideSetColour()
4 |
5 | 'assign application to the current applicaton
6 | Dim application As Autodesk.Revit.ApplicationServices.Application = Me.Application
7 |
8 | 'assigns document to the active document in use - default
9 | Dim document As Document = Me.ActiveUIDocument.Document
10 |
11 | 'get the active view
12 | Dim activeView As View = document.ActiveView
13 |
14 | 'create a color
15 | Dim color As New Color(150, 200, 200)
16 |
17 | 'get the solid fill pattern
18 | Dim fillPattern As FillPatternElement = (From fp As FillPatternElement In New FilteredElementCollector(document) _
19 | .ofclass(GetType(FillPatternElement)) _
20 | .cast(Of FillPatternElement)() _
21 | Where fp.Name = "Solid fill"
22 | Select fp).FirstOrDefault
23 |
24 | 'setup the overide
25 | Dim overrideSettings As New OverrideGraphicSettings()
26 | overrideSettings.SetProjectionFillColor(color)
27 | overrideSettings.SetProjectionFillPatternId(fillPattern.id)
28 |
29 | 'find the view called "level 1" we will hide elements in this view later
30 | Dim viewToHideElementsIn As view = (From v As view In New FilteredElementCollector(document) _
31 | .ofclass(GetType(viewPlan)) _
32 | .cast(Of view)()
33 | Where v.name = "Level 1"
34 | Select v).FirstOrDefault
35 |
36 |
37 |
38 |
39 | '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
40 | 'collection 1: All the walls in the project
41 | Dim collectionI As iEnumerable(Of ElementId) = New FilteredElementCollector(document) _
42 | .OfCategory(BuiltInCategory.OST_Walls) _
43 | .WhereElementIsNotElementType() _
44 | .ToElementIds
45 |
46 |
47 |
48 |
49 | '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
50 | 'collection 2: Elements from multiple categories using an or filter
51 | 'create a list of category filters
52 | Dim categoryFilterList As New list(Of elementFilter)
53 | categoryFilterList.add(New ElementCategoryFilter(BuiltInCategory.OST_Walls))
54 | categoryFilterList.add(New ElementCategoryFilter(BuiltInCategory.OST_Floors))
55 |
56 | 'setup an OR filter
57 | Dim orFilter As New LogicalOrFilter(categoryFilterList)
58 |
59 | 'get collection
60 | Dim collectionII As iEnumerable(Of ElementId) = New FilteredElementCollector(document) _
61 | .WherePasses(orFilter) _
62 | .ToElementIds
63 |
64 |
65 |
66 |
67 | '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
68 | 'collection 3: Elements based upon parameter values. In this case walls with type named "Generic - 300mm"
69 | Dim collectionIII As iEnumerable(Of ElementId) = (From w As wall In New FilteredElementCollector(document) _
70 | .OfCategory(BuiltInCategory.OST_Walls) _
71 | .WhereElementIsNotElementType() _
72 | .Cast(Of Wall)()
73 | Where w.name = "Generic - 300mm)"
74 | Select w.id)
75 |
76 |
77 | 'Start a transaction CRITICAL without transactions Revit cannot update
78 | Using rvtTransaction As New Transaction(document, "Create views")
79 | rvtTransaction.Start()
80 |
81 | 'hide the walls (collectionI) in the current view
82 | activeView.HideElements(collectionI.ToList)
83 |
84 | 'get all the remaining elements in the active view
85 | Dim remainingElements As iEnumerable(Of elementId) = New FilteredElementCollector(document, activeView.id) _
86 | .WhereElementIsNotElementType() _
87 | .toElementIds
88 |
89 | 'override the colour and projection pattern of the remaining elements
90 | For Each id As ElementId In remainingElements
91 | activeView.setElementOverrides(id, overrideSettings)
92 | Next
93 |
94 | 'Commit the changes to the Revit File
95 | rvtTransaction.Commit()
96 |
97 | End Using
98 |
99 |
100 | End Sub
--------------------------------------------------------------------------------
/Visual Studio Projects/Learning/APISetup/Application/Application/obj/Debug/UserControl1.g.cs:
--------------------------------------------------------------------------------
1 | #pragma checksum "..\..\UserControl1.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "AD2A690E977453BFA2930DCF4DB19F10"
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by a tool.
5 | // Runtime Version:4.0.30319.34014
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 |
12 | using System;
13 | using System.Diagnostics;
14 | using System.Windows;
15 | using System.Windows.Automation;
16 | using System.Windows.Controls;
17 | using System.Windows.Controls.Primitives;
18 | using System.Windows.Data;
19 | using System.Windows.Documents;
20 | using System.Windows.Ink;
21 | using System.Windows.Input;
22 | using System.Windows.Markup;
23 | using System.Windows.Media;
24 | using System.Windows.Media.Animation;
25 | using System.Windows.Media.Effects;
26 | using System.Windows.Media.Imaging;
27 | using System.Windows.Media.Media3D;
28 | using System.Windows.Media.TextFormatting;
29 | using System.Windows.Navigation;
30 | using System.Windows.Shapes;
31 | using System.Windows.Shell;
32 |
33 |
34 | namespace Application {
35 |
36 |
37 | ///
38 | /// UserControl1
39 | ///
40 | public partial class UserControl1 : System.Windows.Window, System.Windows.Markup.IComponentConnector {
41 |
42 |
43 | #line 8 "..\..\UserControl1.xaml"
44 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
45 | internal System.Windows.Controls.Button bopenfile;
46 |
47 | #line default
48 | #line hidden
49 |
50 |
51 | #line 9 "..\..\UserControl1.xaml"
52 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
53 | internal System.Windows.Controls.Button bgetResults;
54 |
55 | #line default
56 | #line hidden
57 |
58 |
59 | #line 10 "..\..\UserControl1.xaml"
60 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
61 | internal System.Windows.Controls.TextBox File_Location;
62 |
63 | #line default
64 | #line hidden
65 |
66 | private bool _contentLoaded;
67 |
68 | ///
69 | /// InitializeComponent
70 | ///
71 | [System.Diagnostics.DebuggerNonUserCodeAttribute()]
72 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
73 | public void InitializeComponent() {
74 | if (_contentLoaded) {
75 | return;
76 | }
77 | _contentLoaded = true;
78 | System.Uri resourceLocater = new System.Uri("/Application;component/usercontrol1.xaml", System.UriKind.Relative);
79 |
80 | #line 1 "..\..\UserControl1.xaml"
81 | System.Windows.Application.LoadComponent(this, resourceLocater);
82 |
83 | #line default
84 | #line hidden
85 | }
86 |
87 | [System.Diagnostics.DebuggerNonUserCodeAttribute()]
88 | [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
89 | [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
90 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
91 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
92 | [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
93 | void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
94 | switch (connectionId)
95 | {
96 | case 1:
97 | this.bopenfile = ((System.Windows.Controls.Button)(target));
98 |
99 | #line 8 "..\..\UserControl1.xaml"
100 | this.bopenfile.Click += new System.Windows.RoutedEventHandler(this.bopen_Clik);
101 |
102 | #line default
103 | #line hidden
104 | return;
105 | case 2:
106 | this.bgetResults = ((System.Windows.Controls.Button)(target));
107 |
108 | #line 9 "..\..\UserControl1.xaml"
109 | this.bgetResults.Click += new System.Windows.RoutedEventHandler(this.getResults_Click);
110 |
111 | #line default
112 | #line hidden
113 | return;
114 | case 3:
115 | this.File_Location = ((System.Windows.Controls.TextBox)(target));
116 | return;
117 | }
118 | this._contentLoaded = true;
119 | }
120 | }
121 | }
122 |
123 |
--------------------------------------------------------------------------------