mirror of
https://github.com/jeremytammik/RevitSdkSamples.git
synced 2026-09-26 20:51:31 +00:00
updated to Revit 2023 SDK
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace Revit.SDK.Samples.CreateComplexAreaRein.CS
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Linq;
|
||||
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
@@ -50,54 +51,67 @@ namespace Revit.SDK.Samples.CreateComplexAreaRein.CS
|
||||
m_currentDoc = Command.CommandData.Application.ActiveUIDocument.Document;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get necessary data when create AreaReinforcement on a horizontal floor
|
||||
/// </summary>
|
||||
/// <param name="floor">floor on which to create AreaReinforcemen</param>
|
||||
/// <param name="refer">reference of the horizontal face on the floor</param>
|
||||
/// <param name="curves">curves compose the horizontal face of the floor</param>
|
||||
/// <returns>is successful</returns>
|
||||
public bool GetFloorGeom(Floor floor, ref Reference refer, ref IList<Curve> curves)
|
||||
{
|
||||
//get horizontal face's reference
|
||||
FaceArray faces = GeomUtil.GetFaces(floor);
|
||||
foreach (Face face in faces)
|
||||
/// <summary>
|
||||
/// get necessary data when create AreaReinforcement on a horizontal floor
|
||||
/// </summary>
|
||||
/// <param name="floor">floor on which to create AreaReinforcemen</param>
|
||||
/// <param name="refer">reference of the horizontal face on the floor</param>
|
||||
/// <param name="curves">curves compose the horizontal face of the floor</param>
|
||||
/// <returns>is successful</returns>
|
||||
public bool GetFloorGeom(Floor floor, ref Reference refer, ref IList<Curve> curves)
|
||||
{
|
||||
//get horizontal face's reference
|
||||
FaceArray faces = GeomUtil.GetFaces(floor);
|
||||
foreach (Face face in faces)
|
||||
{
|
||||
if (GeomUtil.IsHorizontalFace(face))
|
||||
{
|
||||
if (GeomUtil.IsHorizontalFace(face))
|
||||
{
|
||||
refer = face.Reference;
|
||||
break;
|
||||
}
|
||||
refer = face.Reference;
|
||||
break;
|
||||
}
|
||||
if (null == refer)
|
||||
}
|
||||
if (null == refer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//get analytical model profile
|
||||
AnalyticalPanel model = null;
|
||||
Document document = floor.Document;
|
||||
AnalyticalToPhysicalAssociationManager assocManager = AnalyticalToPhysicalAssociationManager.GetAnalyticalToPhysicalAssociationManager(document);
|
||||
if (assocManager != null)
|
||||
{
|
||||
ElementId associatedElementId = assocManager.GetAssociatedElementId(floor.Id);
|
||||
if (associatedElementId != ElementId.InvalidElementId)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//get analytical model profile
|
||||
AnalyticalModel model = floor.GetAnalyticalModel();
|
||||
if (null == model)
|
||||
{
|
||||
return false;
|
||||
Element associatedElement = document.GetElement(associatedElementId);
|
||||
if (associatedElement != null && associatedElement is AnalyticalPanel)
|
||||
{
|
||||
model = associatedElement as AnalyticalPanel;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (null == model)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
curves = model.GetCurves(AnalyticalCurveType.ActiveCurves);
|
||||
curves = model.GetOuterContour().ToList();
|
||||
if (!GeomUtil.IsRectangular(curves))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
curves = AddInlaidCurves(curves, 0.5);
|
||||
|
||||
if (!GeomUtil.IsRectangular(curves))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
curves = AddInlaidCurves(curves, 0.5);
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// create CurveArray which contain 8 curves, 4 is exterior lines and 4 is interior lines
|
||||
/// </summary>
|
||||
/// <param name="curves"></param>
|
||||
/// <param name="scale"></param>
|
||||
/// <returns></returns>
|
||||
private IList<Curve> AddInlaidCurves(IList<Curve> curves, double scale)
|
||||
/// <summary>
|
||||
/// create CurveArray which contain 8 curves, 4 is exterior lines and 4 is interior lines
|
||||
/// </summary>
|
||||
/// <param name="curves"></param>
|
||||
/// <param name="scale"></param>
|
||||
/// <returns></returns>
|
||||
private IList<Curve> AddInlaidCurves(IList<Curve> curves, double scale)
|
||||
{
|
||||
//because curves is readonly, can't use method Curve.Append(Curve)
|
||||
List<Line> lines = new List<Line>();
|
||||
|
||||
Reference in New Issue
Block a user