Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Revit 2018 and 2019 removed #1413

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions Revit_Core_Adapter/Listener/Files/BHoM_2018.Addin

This file was deleted.

11 changes: 0 additions & 11 deletions Revit_Core_Adapter/Listener/Files/BHoM_2019.Addin

This file was deleted.

48 changes: 6 additions & 42 deletions Revit_Core_Adapter/Revit_Core_Adapter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,13 @@
<PropertyGroup>
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
<OutputPath>..\Build\</OutputPath>
<Configurations>Debug;Release;Debug2018;Release2018;Debug2019;Release2019;Debug2020;Release2020;Debug2021;Release2021;Debug2022;Release2022;Debug2023;Release2023</Configurations>
<Configurations>Debug;Release;Debug2020;Release2020;Debug2021;Release2021;Debug2022;Release2022;Debug2023;Release2023</Configurations>
<TargetFramework>net480</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">
<AssemblyName>Revit_Core_Adapter_2018</AssemblyName>
<DefineConstants>REVIT2018</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug2018' Or '$(Configuration)'=='Release2018'">
<AssemblyName>Revit_Core_Adapter_2018</AssemblyName>
<DefineConstants>REVIT2018</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug2019' Or '$(Configuration)'=='Release2019'">
<AssemblyName>Revit_Core_Adapter_2019</AssemblyName>
<DefineConstants>REVIT2019</DefineConstants>
<AssemblyName>Revit_Core_Adapter_2020</AssemblyName>
<DefineConstants>REVIT2020</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug2020' Or '$(Configuration)'=='Release2020'">
<AssemblyName>Revit_Core_Adapter_2020</AssemblyName>
Expand All @@ -47,13 +39,7 @@
</PropertyGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">
<Exec Command="C:\Windows\System32\xcopy &quot;$(ProjectDir)Listener\Files\BHoM_2018.Addin&quot; &quot;C:\Users\$(Username)\AppData\Roaming\Autodesk\Revit\Addins\2018\&quot; /Y /I /E&#xD;&#xA;xcopy &quot;$(TargetDir)$(TargetFileName)&quot; &quot;C:\\ProgramData\\BHoM\\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)Listener\Files\Resources&quot; &quot;C:\ProgramData\BHoM\Resources\Revit&quot; /Y /I /E" />
</Target>
<Target Name="PostBuild2018" AfterTargets="PostBuildEvent" Condition="'$(Configuration)'=='Debug2018' Or '$(Configuration)'=='Release2018'">
<Exec Command="C:\Windows\System32\xcopy &quot;$(ProjectDir)Listener\Files\BHoM_2018.Addin&quot; &quot;C:\Users\$(Username)\AppData\Roaming\Autodesk\Revit\Addins\2018\&quot; /Y /I /E&#xD;&#xA;xcopy &quot;$(TargetDir)$(TargetFileName)&quot; &quot;C:\\ProgramData\\BHoM\\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)Listener\Files\Resources&quot; &quot;C:\ProgramData\BHoM\Resources\Revit&quot; /Y /I /E" />
</Target>
<Target Name="PostBuild2019" AfterTargets="PostBuildEvent" Condition="'$(Configuration)'=='Debug2019' Or '$(Configuration)'=='Release2019'">
<Exec Command="C:\Windows\System32\xcopy &quot;$(ProjectDir)Listener\Files\BHoM_2019.Addin&quot; &quot;C:\Users\$(Username)\AppData\Roaming\Autodesk\Revit\Addins\2019\&quot; /Y /I /E&#xD;&#xA;xcopy &quot;$(TargetDir)$(TargetFileName)&quot; &quot;C:\\ProgramData\\BHoM\\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)Listener\Files\Resources&quot; &quot;C:\ProgramData\BHoM\Resources\Revit&quot; /Y /I /E" />
<Exec Command="C:\Windows\System32\xcopy &quot;$(ProjectDir)Listener\Files\BHoM_2020.Addin&quot; &quot;C:\Users\$(Username)\AppData\Roaming\Autodesk\Revit\Addins\2020\&quot; /Y /I /E&#xD;&#xA;xcopy &quot;$(TargetDir)$(TargetFileName)&quot; &quot;C:\\ProgramData\\BHoM\\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)Listener\Files\Resources&quot; &quot;C:\ProgramData\BHoM\Resources\Revit&quot; /Y /I /E" />
</Target>
<Target Name="PostBuild2020" AfterTargets="PostBuildEvent" Condition="'$(Configuration)'=='Debug2020' Or '$(Configuration)'=='Release2020'">
<Exec Command="C:\Windows\System32\xcopy &quot;$(ProjectDir)Listener\Files\BHoM_2020.Addin&quot; &quot;C:\Users\$(Username)\AppData\Roaming\Autodesk\Revit\Addins\2020\&quot; /Y /I /E&#xD;&#xA;xcopy &quot;$(TargetDir)$(TargetFileName)&quot; &quot;C:\\ProgramData\\BHoM\\Assemblies&quot; /Y&#xD;&#xA;xcopy &quot;$(TargetDir)Listener\Files\Resources&quot; &quot;C:\ProgramData\BHoM\Resources\Revit&quot; /Y /I /E" />
Expand Down Expand Up @@ -141,27 +127,11 @@
<Private>False</Private>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="RevitAPI" Condition="'$(Configuration)'=='Debug2018' Or '$(Configuration)'=='Release2018' Or '$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">
<HintPath>..\libs\2018\RevitAPI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPIUI" Condition="'$(Configuration)'=='Debug2018' Or '$(Configuration)'=='Release2018' Or '$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">
<HintPath>..\libs\2018\RevitAPIUI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPI" Condition="'$(Configuration)'=='Debug2019' Or '$(Configuration)'=='Release2019'">
<HintPath>..\libs\2019\RevitAPI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPIUI" Condition="'$(Configuration)'=='Debug2019' Or '$(Configuration)'=='Release2019'">
<HintPath>..\libs\2019\RevitAPIUI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPI" Condition="'$(Configuration)'=='Debug2020' Or '$(Configuration)'=='Release2020'">
<Reference Include="RevitAPI" Condition="'$(Configuration)'=='Debug2020' Or '$(Configuration)'=='Release2020' Or '$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">
<HintPath>..\libs\2020\RevitAPI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPIUI" Condition="'$(Configuration)'=='Debug2020' Or '$(Configuration)'=='Release2020'">
<Reference Include="RevitAPIUI" Condition="'$(Configuration)'=='Debug2020' Or '$(Configuration)'=='Release2020' Or '$(Configuration)'=='Debug' Or '$(Configuration)'=='Release'">
<HintPath>..\libs\2020\RevitAPIUI.dll</HintPath>
<Private>False</Private>
</Reference>
Expand Down Expand Up @@ -213,12 +183,6 @@
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="Listener\Files\BHoM_2018.Addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Listener\Files\BHoM_2019.Addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Listener\Files\BHoM_2020.Addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
2 changes: 1 addition & 1 deletion Revit_Core_Engine/Convert/FromSI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static partial class Convert
[Input("value", "Numerical value to be converted to BHoM-specific units.")]
[Input("quantity", "Quantity type to use when converting from Revit internal units to BHoM-specific units.")]
[Output("converted", "Input value converted from internal Revit units to BHoM-specific units for the input quantity type.")]
#if (REVIT2018 || REVIT2019 || REVIT2020)
#if (REVIT2020)
public static double FromSI(this double value, UnitType quantity)
#else
public static double FromSI(this double value, ForgeTypeId quantity)
Expand Down
4 changes: 2 additions & 2 deletions Revit_Core_Engine/Convert/Physical/ToRevit/Floor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static Floor ToRevitFloor(this oM.Physical.Elements.Floor floor, Document
BH.oM.Geometry.Plane slabPlane = planarSurface.FitPlane();
if (1 - Math.Abs(Vector.ZAxis.DotProduct(slabPlane.Normal)) <= settings.AngleTolerance)
{
#if (REVIT2018 || REVIT2019 || REVIT2020 || REVIT2021)
#if (REVIT2020 || REVIT2021)
if (floorType.Category.Id.IntegerValue == (int)BuiltInCategory.OST_StructuralFoundation)
revitFloor = document.Create.NewFoundationSlab(curve.ToRevitCurveArray(), floorType, level, true, XYZ.BasisZ);
else
Expand All @@ -103,7 +103,7 @@ public static Floor ToRevitFloor(this oM.Physical.Elements.Floor floor, Document
XYZ start = ln.ClosestPoint(curve.IStartPoint(), true).ToRevit();
Autodesk.Revit.DB.Line line = Autodesk.Revit.DB.Line.CreateBound(start, start + dir);

#if (REVIT2018 || REVIT2019 || REVIT2020 || REVIT2021)
#if (REVIT2020 || REVIT2021)
revitFloor = document.Create.NewSlab(curve.ToRevitCurveArray(), level, line, -tan, true);
#else
revitFloor = Floor.Create(document, new List<CurveLoop> { curve.ToRevitCurveLoop() }, floorType.Id, level.Id, true, line, -tan);
Expand Down
4 changes: 0 additions & 4 deletions Revit_Core_Engine/Convert/Revit/ToRevit/Viewport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ public static Viewport ToRevitViewport(this oM.Adapters.Revit.Elements.Viewport
return null;

List<View> viewList = new FilteredElementCollector(document).OfClass(typeof(View)).Cast<View>().ToList();
#if (REVIT2018 || REVIT2019)
View view = viewList.FirstOrDefault(x => !x.IsTemplate && x.ViewName == viewport.ViewName);
#else
View view = viewList.FirstOrDefault(x => !x.IsTemplate && x.Name == viewport.ViewName);
#endif

if (view == null)
return null;
Expand Down
2 changes: 1 addition & 1 deletion Revit_Core_Engine/Convert/Structure/FromRevit/Bars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static List<Bar> BarsFromRevit(this FamilyInstance familyInstance, RevitS

// Get bar curve
List<oM.Geometry.ICurve> locationCurves = null;
#if (REVIT2018 || REVIT2019 || REVIT2020 || REVIT2021 || REVIT2022)
#if (REVIT2020 || REVIT2021 || REVIT2022)
AnalyticalModelStick analyticalModel = familyInstance.GetAnalyticalModel() as AnalyticalModelStick;
if (analyticalModel != null)
{
Expand Down
2 changes: 1 addition & 1 deletion Revit_Core_Engine/Convert/ToSI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static partial class Convert
[Input("value", "Numerical value to be converted to internal Revit units.")]
[Input("quantity", "Quantity type to use when converting from BHoM-specific units to Revit internal units.")]
[Output("converted", "Input value converted from BHoM-specific units to internal Revit units for the input quantity type.")]
#if (REVIT2018 || REVIT2019 || REVIT2020)
#if (REVIT2020)
public static double ToSI(this double value, UnitType quantity)
#else
public static double ToSI(this double value, ForgeTypeId quantity)
Expand Down
2 changes: 1 addition & 1 deletion Revit_Core_Engine/Create/Definition/Parameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static partial class Create
[Output("definition", "Revit parameter Definition created based on the input properties.")]
public static Definition Parameter(Document document, string parameterName, string typeName, string groupName, bool instance, IEnumerable<string> categoryNames, bool shared, string discipline = "")
{
#if (REVIT2018 || REVIT2019 || REVIT2020 || REVIT2021 || REVIT2022)
#if (REVIT2020 || REVIT2021 || REVIT2022)
List<ParameterType> parameterTypes = new List<ParameterType>();
foreach (ParameterType pt in Enum.GetValues(typeof(ParameterType)))
{
Expand Down
2 changes: 1 addition & 1 deletion Revit_Core_Engine/Create/Definition/ProjectParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static partial class Create
[Input("instance", "If true, the created parameter will be an instance parameter, otherwise it will be a type parameter.")]
[Input("categories", "Categories, to which the created parameter is bound. It will get bound to all categories if this value is null.")]
[Output("definition", "Revit project parameter Definition created based on the input properties.")]
#if (REVIT2018 || REVIT2019 || REVIT2020 || REVIT2021 || REVIT2022)
#if (REVIT2020 || REVIT2021 || REVIT2022)
public static Definition ProjectParameter(Document document, string parameterName, ParameterType parameterType, BuiltInParameterGroup parameterGroup, bool instance, IEnumerable<Category> categories)
#else
public static Definition ProjectParameter(Document document, string parameterName, ForgeTypeId parameterType, BuiltInParameterGroup parameterGroup, bool instance, IEnumerable<Category> categories)
Expand Down
2 changes: 1 addition & 1 deletion Revit_Core_Engine/Create/Definition/SharedParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static partial class Create
[Input("instance", "If true, the created parameter will be an instance parameter, otherwise it will be a type parameter.")]
[Input("categories", "Categories, to which the created parameter is bound. It will get bound to all categories if this value is null.")]
[Output("definition", "Revit shared parameter Definition created based on the input properties.")]
#if (REVIT2018 || REVIT2019 || REVIT2020 || REVIT2021 || REVIT2022)
#if (REVIT2020 || REVIT2021 || REVIT2022)
public static Definition SharedParameter(Document document, string parameterName, ParameterType parameterType, string parameterGroup, bool instance, IEnumerable<Category> categories)
#else
public static Definition SharedParameter(Document document, string parameterName, ForgeTypeId parameterType, string parameterGroup, bool instance, IEnumerable<Category> categories)
Expand Down
4 changes: 0 additions & 4 deletions Revit_Core_Engine/Create/View/View3D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,7 @@ public static View View3D(this Document document, string viewName = null, Boundi
{
try
{
#if (REVIT2018 || REVIT2019)
result.ViewName = viewName;
#else
result.Name = viewName;
#endif
}
catch
{
Expand Down
15 changes: 1 addition & 14 deletions Revit_Core_Engine/Modify/CopyCharacteristics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,26 +157,13 @@ public static void CopyCharacteristics(this SolidMaterial toMaterial, ThermalAss
[Input("fromAsset", "Source Revit StructuralAsset to copy the material characteristics from.")]
public static void CopyCharacteristics(this IMaterialFragment toMaterial, StructuralAsset fromAsset)
{
double density = fromAsset.Density.ToSI(SpecTypeId.MassDensity);

#if (REVIT2018 || REVIT2019)
double dampingRatio = fromAsset.DampingRatio;
#else

#endif
toMaterial.Density = fromAsset.Density.ToSI(SpecTypeId.MassDensity);

oM.Geometry.Vector youngsModulus = BH.Engine.Geometry.Create.Vector(fromAsset.YoungModulus.X.ToSI(SpecTypeId.Stress), fromAsset.YoungModulus.Y.ToSI(SpecTypeId.Stress), fromAsset.YoungModulus.Z.ToSI(SpecTypeId.Stress));
oM.Geometry.Vector thermalExpansionCoeff = BH.Engine.Geometry.Create.Vector(fromAsset.ThermalExpansionCoefficient.X.ToSI(SpecTypeId.ThermalExpansionCoefficient), fromAsset.ThermalExpansionCoefficient.Y.ToSI(SpecTypeId.ThermalExpansionCoefficient), fromAsset.ThermalExpansionCoefficient.Z.ToSI(SpecTypeId.ThermalExpansionCoefficient));
oM.Geometry.Vector poissonsRatio = BH.Engine.Geometry.Create.Vector(fromAsset.PoissonRatio.X, fromAsset.PoissonRatio.Y, fromAsset.PoissonRatio.Z);
oM.Geometry.Vector shearModulus = BH.Engine.Geometry.Create.Vector(fromAsset.ShearModulus.X.ToSI(SpecTypeId.Stress), fromAsset.ShearModulus.Y.ToSI(SpecTypeId.Stress), fromAsset.ShearModulus.Z.ToSI(SpecTypeId.Stress));

toMaterial.Density = density;
#if (REVIT2018 || REVIT2019)
toMaterial.DampingRatio = dampingRatio;
#else

#endif

if (toMaterial is Aluminium)
{
Aluminium material = toMaterial as Aluminium;
Expand Down
5 changes: 1 addition & 4 deletions Revit_Core_Engine/Modify/SetViewName.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@ public static void SetViewName(this View view, string viewName)
uniqueName = $"{viewName} ({number})";
}

#if (REVIT2018 || REVIT2019)
view.ViewName = uniqueName;
#else
view.Name = uniqueName;
#endif

if (uniqueName != viewName)
{
BH.Engine.Base.Compute.RecordWarning($"There is already a view named '{viewName}'. It has been named '{uniqueName}' instead.");
Expand Down
2 changes: 0 additions & 2 deletions Revit_Core_Engine/Objects/Active2dViewVisibilityContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
using System;
using System.ComponentModel;

#if (!REVIT2018 && !REVIT2019)
namespace BH.Revit.Engine.Core
{
[Description("Class used to extract elements visible in the active view of the host document if that view is of 2d type. See " + nameof(Query.ElementIdsByVisibleInActiveView) + " for usage example.")]
Expand Down Expand Up @@ -134,4 +133,3 @@ public void OnText(TextNode node)
/***************************************************/
}
}
#endif
10 changes: 2 additions & 8 deletions Revit_Core_Engine/Objects/SpecTypeId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
using BH.oM.Base.Attributes;
using System.ComponentModel;

#if (REVIT2018 || REVIT2019 || REVIT2020)
#if (REVIT2020)
namespace BH.Revit.Engine.Core
{
[Description("This class is defined by BHoM only for Revit Versions < 2021. Revit versions from 2021 onwards define an equivalent class with the same name as part of their API." +
Expand Down Expand Up @@ -183,15 +183,9 @@ public static partial class SpecTypeId
public static UnitType CostRatePower { [NotImplemented] get { return NonExistentUnitType(nameof(CostRatePower), 2021); } }
public static UnitType CostRateEnergy { [NotImplemented] get { return NonExistentUnitType(nameof(CostRateEnergy), 2021); } }
public static UnitType CostPerArea { [NotImplemented] get { return NonExistentUnitType(nameof(CostPerArea), 2021); } }
public static UnitType AngularSpeed { [NotImplemented] get { return NonExistentUnitType(nameof(AngularSpeed), 2021); } }

#if (REVIT2018 || REVIT2019)
public static UnitType Time { [NotImplemented] get { return NonExistentUnitType(nameof(Time), 2020); } }
public static UnitType Speed { [NotImplemented] get { return NonExistentUnitType(nameof(Speed), 2020); } }
#else
public static UnitType AngularSpeed { [NotImplemented] get { return NonExistentUnitType(nameof(AngularSpeed), 2021); } }
public static UnitType Time { get { return UnitType.UT_TimeInterval; } }
public static UnitType Speed { get { return UnitType.UT_Speed; } }
#endif

public static class Boolean
{
Expand Down
2 changes: 1 addition & 1 deletion Revit_Core_Engine/Objects/UnitTypeId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
using BH.oM.Base.Attributes;
using System.ComponentModel;

#if (REVIT2018 || REVIT2019 || REVIT2020)
#if (REVIT2020)
namespace BH.Revit.Engine.Core
{
[Description("This class is defined by BHoM only for Revit Versions < 2021. Revit versions from 2021 onwards define an equivalent class with the same name as part of their API." +
Expand Down
2 changes: 1 addition & 1 deletion Revit_Core_Engine/Query/AnalyticalOutlines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static List<ICurve> AnalyticalOutlines(this HostObject hostObject, RevitS
{
List<ICurve> result = new List<ICurve>();

#if (REVIT2018 || REVIT2019 || REVIT2020 || REVIT2021 || REVIT2022)
#if (REVIT2020 || REVIT2021 || REVIT2022)
AnalyticalModel analyticalModel = hostObject.GetAnalyticalModel();
if (analyticalModel == null)
return null;
Expand Down
4 changes: 2 additions & 2 deletions Revit_Core_Engine/Query/BHoMUnitType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace BH.Revit.Engine.Core
{
public static partial class Query
{
#if (REVIT2018 || REVIT2019 || REVIT2020)
#if (REVIT2020)

/***************************************************/
/**** Public methods ****/
Expand Down Expand Up @@ -145,7 +145,7 @@ public static DisplayUnitType BHoMUnitType(this UnitType quantity)
/***************************************************/

#endif
#if (!REVIT2018 && !REVIT2019 && !REVIT2020)
#if (!REVIT2020)

/***************************************************/
/**** Public methods ****/
Expand Down
Loading
Loading