Skip to content

Commit ed74b14

Browse files
author
Jeremy Tammik
authored
Merge pull request #8 from NK29/master
migration from Revit 2020 to Revit 2021
2 parents 33a8c4e + 12a06a0 commit ed74b14

33 files changed

+70
-61
lines changed
39 Bytes
Binary file not shown.
-967 Bytes
Binary file not shown.

Labs/1_Revit_API_Intro/SourceCS/IntroCs.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<OutputType>Library</OutputType>
1010
<AppDesignerFolder>Properties</AppDesignerFolder>
1111
<RootNamespace>IntroCs</RootNamespace>
12-
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
12+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<FileUpgradeFlags>
1515
</FileUpgradeFlags>

Labs/1_Revit_API_Intro/SourceCS/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion( "2020.0.0.0" )]
36-
[assembly: AssemblyFileVersion( "2020.0.0.0" )]
35+
[assembly: AssemblyVersion( "2021.0.0.0" )]
36+
[assembly: AssemblyFileVersion( "2021.0.0.0" )]

Labs/1_Revit_API_Intro/SourceVB/IntroVb.vbproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<RootNamespace>IntroVb</RootNamespace>
1111
<FileAlignment>512</FileAlignment>
1212
<MyType>Windows</MyType>
13-
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
13+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
1414
<OptionExplicit>On</OptionExplicit>
1515
<OptionCompare>Binary</OptionCompare>
1616
<OptionStrict>Off</OptionStrict>

Labs/1_Revit_API_Intro/SourceVB/My Project/AssemblyInfo.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
3131
' by using the '*' as shown below:
3232
' <Assembly: AssemblyVersion("1.0.*")>
3333

34-
<Assembly: AssemblyVersion("2020.0.0.0")>
35-
<Assembly: AssemblyFileVersion("2020.0.0.0")>
34+
<Assembly: AssemblyVersion("2021.0.0.0")>
35+
<Assembly: AssemblyFileVersion("2021.0.0.0")>
1.41 KB
Binary file not shown.
-27 Bytes
Binary file not shown.

Labs/2_Revit_UI_API/SourceCS/2_Selection.cs

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -184,33 +184,39 @@ public void PickMethod_PickObject()
184184
/// Note: when you run this code, you will see "Finish" and "Cancel" buttons in the dialog bar.
185185
/// </summary>
186186
public void PickMethod_PickObjects()
187-
{
188-
IList<Reference> refs = _uiDoc.Selection.PickObjects(ObjectType.Element, "Select multiple elemens");
189-
190-
// Put it in a List form.
191-
IList<Element> elems = new List<Element>();
192-
foreach (Reference r in refs)
193187
{
194-
//elems.Add( r.Element ); // 2011 Warning: 'Autodesk.Revit.DB.Reference.Element' is obsolete:
195-
// 'Property will be removed. Use Document.GetElement(Reference) instead'
196-
elems.Add(_uiDoc.Document.GetElement(r)); // 2012
188+
IList<Reference> refs = _uiDoc.Selection.PickObjects(ObjectType.Element, "Select multiple elemens");
189+
190+
// Put it in a List form.
191+
IList<ElementId> elems = new List<ElementId>();
192+
foreach (Reference r in refs)
193+
{
194+
//elems.Add( r.Element ); // 2011 Warning: 'Autodesk.Revit.DB.Reference.Element' is obsolete:
195+
// 'Property will be removed. Use Document.GetElement(Reference) instead'
196+
elems.Add(r.ElementId); // 2012
197+
}
198+
199+
ShowElementList(elems, "Pick Objects: ");
197200
}
198201

199-
ShowElementList(elems, "Pick Objects: ");
200-
}
201202

202203
/// <summary>
203204
/// Minimum PickElementByRectangle
204205
/// </summary>
205206
public void PickMethod_PickElementByRectangle()
206-
{
207-
// Note: PickElementByRectangle returns the list of element. not reference.
208-
IList<Element> elems = _uiDoc.Selection.PickElementsByRectangle("Select by rectangle");
209-
210-
// Show it.
207+
{
208+
// Note: PickElementByRectangle returns the list of element. not reference.
209+
IList<Element> elems = _uiDoc.Selection.PickElementsByRectangle("Select by rectangle");
210+
IList<ElementId> eids = new List<ElementId>();
211+
foreach(Element e in elems)
212+
{
213+
eids.Add(e.Id);
214+
}
215+
// Show it.
216+
217+
ShowElementList(eids, "Pick By Rectangle: ");
218+
}
211219

212-
ShowElementList(elems, "Pick By Rectangle: ");
213-
}
214220

215221
/// <summary>
216222
/// Minimum PickPoint
@@ -268,7 +274,7 @@ public void PickEdge()
268274
Reference r = _uiDoc.Selection.PickObject(ObjectType.Edge, "Select an edge");
269275
Element e = _uiDoc.Document.GetElement(r);
270276
//Edge oEdge = r.GeometryObject as Edge; // 2011
271-
Face oEdge = e.GetGeometryObjectFromReference(r) as Face; // 2012
277+
Edge oEdge = e.GetGeometryObjectFromReference(r) as Edge; // 2012
272278

273279
// Show it.
274280
string msg = "";
@@ -558,11 +564,11 @@ public Result Execute(
558564
_uiDoc = _uiApp.ActiveUIDocument;
559565
_doc = _uiDoc.Document;
560566

561-
using (Transaction transaction = new Transaction(_doc))
567+
// using (Transaction transaction = new Transaction(_doc))
562568
{
563-
transaction.Start("Create House");
569+
// transaction.Start("Create House");
564570
CreateHouseInteractive(_uiDoc);
565-
transaction.Commit();
571+
// transaction.Commit();
566572
}
567573

568574
return Result.Succeeded;

Labs/2_Revit_UI_API/SourceCS/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion( "2020.0.0.0" )]
36-
[assembly: AssemblyFileVersion( "2020.0.0.0" )]
35+
[assembly: AssemblyVersion( "2021.0.0.0" )]
36+
[assembly: AssemblyFileVersion( "2021.0.0.0" )]

0 commit comments

Comments
 (0)