Skip to content

Commit f610e42

Browse files
Updated to Revit 2022 and removed deprecated APIs
1 parent cccce15 commit f610e42

15 files changed

+102
-83
lines changed

Labs/1_Revit_API_Intro/SourceCS/IntroCs.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@
5959
</PropertyGroup>
6060
<ItemGroup>
6161
<Reference Include="RevitAPI">
62-
<HintPath>C:\Program Files\Autodesk\Revit 2022\RevitAPI.dll</HintPath>
62+
<HintPath>..\..\..\..\..\..\..\Program Files\Autodesk\Revit 2022\RevitAPI.dll</HintPath>
6363
<Private>False</Private>
6464
</Reference>
6565
<Reference Include="RevitAPIUI">
66-
<HintPath>C:\Program Files\Autodesk\Revit 2022\RevitAPIUI.dll</HintPath>
66+
<HintPath>..\..\..\..\..\..\..\Program Files\Autodesk\Revit 2022\RevitAPIUI.dll</HintPath>
6767
<Private>False</Private>
6868
</Reference>
6969
<Reference Include="System" />

Labs/2_Revit_UI_API/SourceCS/UiCs.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@
6565
<RequiredTargetFramework>3.0</RequiredTargetFramework>
6666
</Reference>
6767
<Reference Include="RevitAPI">
68-
<HintPath>C:\Program Files\Autodesk\Revit 2021\RevitAPI.dll</HintPath>
68+
<HintPath>..\..\..\..\..\..\..\Program Files\Autodesk\Revit 2022\RevitAPI.dll</HintPath>
6969
<Private>False</Private>
7070
</Reference>
7171
<Reference Include="RevitAPIUI">
72-
<HintPath>C:\Program Files\Autodesk\Revit 2021\RevitAPIUI.dll</HintPath>
72+
<HintPath>..\..\..\..\..\..\..\Program Files\Autodesk\Revit 2022\RevitAPIUI.dll</HintPath>
7373
<Private>False</Private>
7474
</Reference>
7575
<Reference Include="System" />

Labs/2_Revit_UI_API/SourceVB/UiVb.vbproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@
7070
<RequiredTargetFramework>3.0</RequiredTargetFramework>
7171
</Reference>
7272
<Reference Include="RevitAPI">
73-
<HintPath>C:\Program Files\Autodesk\Revit 2021\RevitAPI.dll</HintPath>
73+
<HintPath>..\..\..\..\..\..\..\Program Files\Autodesk\Revit 2022\RevitAPI.dll</HintPath>
7474
<Private>False</Private>
7575
</Reference>
7676
<Reference Include="RevitAPIUI">
77-
<HintPath>C:\Program Files\Autodesk\Revit 2021\RevitAPIUI.dll</HintPath>
77+
<HintPath>..\..\..\..\..\..\..\Program Files\Autodesk\Revit 2022\RevitAPIUI.dll</HintPath>
7878
<Private>False</Private>
7979
</Reference>
8080
<Reference Include="System" />
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Labs/3_Revit_Family_API/SourceCS/2_ColumnLshape.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,13 +503,15 @@ void addParameters()
503503

504504
// API parameter group for Dimension is PG_GEOMETRY:
505505
//
506+
ForgeTypeId builtinParamGroup = new ForgeTypeId(BuiltInParameterGroup.PG_GEOMETRY.ToString());
507+
ForgeTypeId parameterTypeId = new ForgeTypeId(SpecTypeId.Length.ToString());
506508
FamilyParameter paramTw = mgr.AddParameter(
507-
"Tw", BuiltInParameterGroup.PG_GEOMETRY,
508-
ParameterType.Length, false);
509+
"Tw", builtinParamGroup,
510+
parameterTypeId, false);
509511

510512
FamilyParameter paramTd = mgr.AddParameter(
511-
"Td", BuiltInParameterGroup.PG_GEOMETRY,
512-
ParameterType.Length, false);
513+
"Td", builtinParamGroup,
514+
parameterTypeId, false);
513515

514516
// set initial values:
515517
//

Labs/3_Revit_Family_API/SourceCS/3_ColumnFormulaMaterial.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -517,13 +517,15 @@ void addParameters()
517517

518518
// API parameter group for Dimension is PG_GEOMETRY:
519519
//
520+
ForgeTypeId builtinParamGroup=new ForgeTypeId(BuiltInParameterGroup.PG_GEOMETRY.ToString());
521+
ForgeTypeId parametertype = new ForgeTypeId(SpecTypeId.Length.ToString());
520522
FamilyParameter paramTw = mgr.AddParameter(
521-
"Tw", BuiltInParameterGroup.PG_GEOMETRY,
522-
ParameterType.Length, false);
523+
"Tw", builtinParamGroup,
524+
parametertype, false);
523525

524526
FamilyParameter paramTd = mgr.AddParameter(
525-
"Td", BuiltInParameterGroup.PG_GEOMETRY,
526-
ParameterType.Length, false);
527+
"Td", builtinParamGroup,
528+
parametertype, false);
527529

528530
// set initial values:
529531
//
@@ -793,7 +795,9 @@ public void addMaterials(Extrusion pSolid)
793795
// this time we use instance parameter so that we can change it at instance level.
794796
//
795797
FamilyManager pFamilyMgr = _doc.FamilyManager;
796-
FamilyParameter famParamFinish = pFamilyMgr.AddParameter("ColumnFinish", BuiltInParameterGroup.PG_MATERIALS, ParameterType.Material, true);
798+
ForgeTypeId builtinParamGroup = new ForgeTypeId(BuiltInParameterGroup.PG_MATERIALS.ToString());
799+
ForgeTypeId parametertype = new ForgeTypeId(SpecTypeId.Reference.Material.ToString());
800+
FamilyParameter famParamFinish = pFamilyMgr.AddParameter("ColumnFinish", builtinParamGroup,parametertype, true);
797801

798802
// (2b.1) associate material parameter to the family parameter we just added
799803
//

Labs/3_Revit_Family_API/SourceCS/4_ColumnVisibility.cs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -516,15 +516,17 @@ void addParameters()
516516
{
517517
FamilyManager mgr = _doc.FamilyManager;
518518

519-
// API parameter group for Dimension is PG_GEOMETRY:
520-
//
519+
// API parameter group for Dimension is PG_GEOMETRY:
520+
//
521+
ForgeTypeId builtinParamgroupTypeId = new ForgeTypeId(BuiltInParameterGroup.PG_GEOMETRY.ToString());
522+
ForgeTypeId parameterTypeId = new ForgeTypeId(SpecTypeId.Length.ToString());
521523
FamilyParameter paramTw = mgr.AddParameter(
522-
"Tw", BuiltInParameterGroup.PG_GEOMETRY,
523-
ParameterType.Length, false );
524+
"Tw", builtinParamgroupTypeId,
525+
parameterTypeId, false );
524526

525527
FamilyParameter paramTd = mgr.AddParameter(
526-
"Td", BuiltInParameterGroup.PG_GEOMETRY,
527-
ParameterType.Length, false );
528+
"Td", builtinParamgroupTypeId,
529+
parameterTypeId, false );
528530

529531
// set initial values:
530532
//
@@ -783,13 +785,14 @@ public void addMaterials( Extrusion pSolid )
783785
// (2a) this add a material to the solid base. but then, we cannot change it for each column.
784786
//
785787
//pSolid.Parameter("Material").Set(idMat)
786-
787788
// (2b) add a parameter for material finish
788789
//
789790
// this time we use instance parameter so that we can change it at instance level.
790791
//
792+
ForgeTypeId builtinParamgroupTypeId = new ForgeTypeId(BuiltInParameterGroup.PG_MATERIALS.ToString());
793+
ForgeTypeId parameterTypeId = new ForgeTypeId(SpecTypeId.Reference.Material.ToString());
791794
FamilyManager pFamilyMgr = _doc.FamilyManager;
792-
FamilyParameter famParamFinish = pFamilyMgr.AddParameter( "ColumnFinish", BuiltInParameterGroup.PG_MATERIALS, ParameterType.Material, true );
795+
FamilyParameter famParamFinish = pFamilyMgr.AddParameter( "ColumnFinish", builtinParamgroupTypeId,parameterTypeId, true );
793796

794797
// (2b.1) associate material parameter to the family parameter we just added
795798
//

0 commit comments

Comments
 (0)