updated to Revit 2023 SDK

This commit is contained in:
Jeremy Tammik
2022-04-07 09:12:58 +02:00
parent e3434c5200
commit ab02648986
342 changed files with 6496 additions and 3140 deletions
+3 -3
View File
@@ -85,7 +85,7 @@ namespace Revit.SDK.Samples.ModelLines.CS
{
// Private members
String m_text; // The display text
int m_id; // The real value - id
ElementId m_id; // The real value - id
// Properties
/// <summary>
@@ -102,7 +102,7 @@ namespace Revit.SDK.Samples.ModelLines.CS
/// <summary>
/// The real value of the comboBox, as the ValueMember
/// </summary>
public int Id
public ElementId Id
{
get
{
@@ -116,7 +116,7 @@ namespace Revit.SDK.Samples.ModelLines.CS
/// </summary>
/// <param name="typeName">indicate model curve type</param>
/// <param name="id">the element id</param>
public IdInfo(String typeName, int id)
public IdInfo(String typeName, ElementId id)
{
m_id = id; // Store the element id
+10 -13
View File
@@ -77,7 +77,7 @@ namespace Revit.SDK.Samples.ModelLines.CS
// Add all ModelEllipses' id information into the list
foreach (ModelCurve ellipse in m_ellipseArray)
{
IdInfo info = new IdInfo("ModelEllipse", ellipse.Id.IntegerValue);
IdInfo info = new IdInfo("ModelEllipse", ellipse.Id);
idArray.Add(info);
}
// return a read only list
@@ -98,7 +98,7 @@ namespace Revit.SDK.Samples.ModelLines.CS
// Add all ModelHermiteSplines' id information into the list
foreach (ModelCurve hermite in m_hermiteArray)
{
IdInfo info = new IdInfo("ModelHermiteSpline", hermite.Id.IntegerValue);
IdInfo info = new IdInfo("ModelHermiteSpline", hermite.Id);
idArray.Add(info);
}
// return a read only list
@@ -120,7 +120,7 @@ namespace Revit.SDK.Samples.ModelLines.CS
// Add all ModelNurbSplines' id information into the list
foreach (ModelCurve nurb in m_nurbArray)
{
IdInfo info = new IdInfo("ModelNurbSpline", nurb.Id.IntegerValue);
IdInfo info = new IdInfo("ModelNurbSpline", nurb.Id);
idArray.Add(info);
}
// return a read only list
@@ -140,7 +140,7 @@ namespace Revit.SDK.Samples.ModelLines.CS
// Add all SketchPlane' id information into the list
foreach (SketchPlane sketch in m_sketchArray)
{
IdInfo info = new IdInfo("SketchPlane", sketch.Id.IntegerValue);
IdInfo info = new IdInfo("SketchPlane", sketch.Id);
idArray.Add(info);
}
// return a read only list
@@ -238,7 +238,7 @@ namespace Revit.SDK.Samples.ModelLines.CS
/// <param name="sketchId">the id of the sketch plane</param>
/// <param name="startPoint">the start point of the line</param>
/// <param name="endPoint">the end point of the line</param>
public void CreateLine(int sketchId, Autodesk.Revit.DB.XYZ startPoint, Autodesk.Revit.DB.XYZ endPoint)
public void CreateLine(ElementId sketchId, Autodesk.Revit.DB.XYZ startPoint, Autodesk.Revit.DB.XYZ endPoint)
{
try
{
@@ -284,7 +284,7 @@ namespace Revit.SDK.Samples.ModelLines.CS
/// <param name="startPoint">the start point of the arc</param>
/// <param name="endPoint">the end point of the arc</param>
/// <param name="thirdPoint">the third point which is on the arc</param>
public void CreateArc(int sketchId, Autodesk.Revit.DB.XYZ startPoint, Autodesk.Revit.DB.XYZ endPoint, Autodesk.Revit.DB.XYZ thirdPoint)
public void CreateArc(ElementId sketchId, Autodesk.Revit.DB.XYZ startPoint, Autodesk.Revit.DB.XYZ endPoint, Autodesk.Revit.DB.XYZ thirdPoint)
{
try
{
@@ -329,7 +329,7 @@ namespace Revit.SDK.Samples.ModelLines.CS
/// <param name="sketchId">the id of the sketch plane</param>
/// <param name="elementId">the element id which copy the curve from</param>
/// <param name="offsetPoint">the offset direction from the copied line</param>
public void CreateOthers(int sketchId, int elementId, Autodesk.Revit.DB.XYZ offsetPoint)
public void CreateOthers(ElementId sketchId, ElementId elementId, Autodesk.Revit.DB.XYZ offsetPoint)
{
// First get the sketch plane by the giving element id.
SketchPlane workPlane = GetSketchPlaneById(sketchId);
@@ -502,13 +502,10 @@ namespace Revit.SDK.Samples.ModelLines.CS
/// </summary>
/// <param name="id">the element id value</param>
/// <returns>the corresponding element</returns>
Autodesk.Revit.DB.Element GetElementById(int id)
Autodesk.Revit.DB.Element GetElementById(ElementId id)
{
// Create a Autodesk.Revit.DB.ElementId data
Autodesk.Revit.DB.ElementId elementId = new Autodesk.Revit.DB.ElementId(id);
// Get the corresponding element
return m_revit.ActiveUIDocument.Document.GetElement(elementId);
return m_revit.ActiveUIDocument.Document.GetElement(id);
}
@@ -517,7 +514,7 @@ namespace Revit.SDK.Samples.ModelLines.CS
/// </summary>
/// <param name="id">the element id value</param>
/// <returns>the corresponding sketch plane</returns>
SketchPlane GetSketchPlaneById(int id)
SketchPlane GetSketchPlaneById(ElementId id)
{
// First get the sketch plane by the giving element id.
SketchPlane workPlane = GetElementById(id) as SketchPlane;
+2 -6
View File
@@ -29,7 +29,6 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -39,7 +38,6 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<CodeAnalysisRuleSet />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
@@ -48,8 +46,7 @@
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>
</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
@@ -59,8 +56,7 @@
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>
</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
+4 -4
View File
@@ -229,8 +229,8 @@ namespace Revit.SDK.Samples.ModelLines.CS
Autodesk.Revit.DB.XYZ secondPoint; // Store the data of second point for line or arc
Autodesk.Revit.DB.XYZ thirdPoint; // Store the data of third point only for arc
Autodesk.Revit.DB.XYZ offsetPoint; // Store the data of offset point for other lines
int modelLineId; // Store the selected element id using in creation
int sketchPlaneId; // Store the selected sketch id using in creation
ElementId modelLineId; // Store the selected element id using in creation
ElementId sketchPlaneId; // Store the selected sketch id using in creation
// First, get the create curve type.
LineType createType = GetCurveType();
@@ -246,7 +246,7 @@ namespace Revit.SDK.Samples.ModelLines.CS
try
{
// Get the sketch plane id from the combobox control
sketchPlaneId = (int)sketchPlaneComboBox.SelectedValue;
sketchPlaneId = (ElementId)sketchPlaneComboBox.SelectedValue;
// get other necessary information to create model lines
switch (createType)
@@ -268,7 +268,7 @@ namespace Revit.SDK.Samples.ModelLines.CS
case LineType.ModelHermiteSpline: // to create model hermite spline
case LineType.ModelNurbSpline: // to create model nurb spline
// Get the selected element id which copy curve from
modelLineId = (int)elementIdComboBox.SelectedValue;
modelLineId = (ElementId)elementIdComboBox.SelectedValue;
offsetPoint = offsetPointUserControl.GetPointData();// offset point
m_dataBuffer.CreateOthers(sketchPlaneId, modelLineId, offsetPoint);
// Rebind the data source of the elementIdComboBox to refresh it