Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
chuongmep committed Feb 24, 2023
2 parents 0e68d69 + 2d3d47c commit 024cd75
Show file tree
Hide file tree
Showing 38 changed files with 2,125 additions and 105 deletions.
23 changes: 23 additions & 0 deletions OpenMEP.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionIt
docs\pkg.json = docs\pkg.json
CHANGELOG.md = CHANGELOG.md
docs\OpenMEP_DynamoCustomization.xml = docs\OpenMEP_DynamoCustomization.xml
docs\OpenMEPSandbox_DynamoCustomization.xml = docs\OpenMEPSandbox_DynamoCustomization.xml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeployInstaller", "DeployInstaller\DeployInstaller.csproj", "{C7835EFE-E1C7-48B2-90D0-E943D43A905D}"
Expand All @@ -18,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "_build", "build\_build.cspr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenMEPTest", "OpenMEPTest\OpenMEPTest.csproj", "{C4A7A7CC-2B34-4359-B16E-F8F2082CB840}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenMEPSandbox", "OpenMEPSandbox\OpenMEPSandbox.csproj", "{5FDD66F2-49B5-4896-B6FB-79B1CC457904}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug R20|Any CPU = Debug R20|Any CPU
Expand Down Expand Up @@ -87,5 +90,25 @@ Global
{C4A7A7CC-2B34-4359-B16E-F8F2082CB840}.Release R23|Any CPU.ActiveCfg = Debug|Any CPU
{C4A7A7CC-2B34-4359-B16E-F8F2082CB840}.Release R23.1|Any CPU.ActiveCfg = Debug|Any CPU
{C4A7A7CC-2B34-4359-B16E-F8F2082CB840}.Installer|Any CPU.ActiveCfg = Debug|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Debug R20|Any CPU.ActiveCfg = Debug R20|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Debug R20|Any CPU.Build.0 = Debug R20|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Debug R21|Any CPU.ActiveCfg = Debug R21|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Debug R21|Any CPU.Build.0 = Debug R21|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Debug R22|Any CPU.ActiveCfg = Debug R22|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Debug R22|Any CPU.Build.0 = Debug R22|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Debug R23|Any CPU.ActiveCfg = Debug R23|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Debug R23|Any CPU.Build.0 = Debug R23|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Debug R23.1|Any CPU.ActiveCfg = Debug R23.1|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Debug R23.1|Any CPU.Build.0 = Debug R23.1|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Release R20|Any CPU.ActiveCfg = Release R20|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Release R20|Any CPU.Build.0 = Release R20|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Release R21|Any CPU.ActiveCfg = Release R21|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Release R21|Any CPU.Build.0 = Release R21|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Release R22|Any CPU.ActiveCfg = Release R22|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Release R22|Any CPU.Build.0 = Release R22|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Release R23|Any CPU.ActiveCfg = Release R23|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Release R23|Any CPU.Build.0 = Release R23|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Release R23.1|Any CPU.ActiveCfg = Release R23.1|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Release R23.1|Any CPU.Build.0 = Release R23.1|Any CPU
EndGlobalSection
EndGlobal
2 changes: 1 addition & 1 deletion OpenMEP/Application/Dynamo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static string Version()
return version.ToString();
}

#if R20
#if R20 || R21
#else
/// <summary>
/// return current file name of script opening
Expand Down
3 changes: 2 additions & 1 deletion OpenMEP/Element/Fitting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ private Fitting()
/// </summary>
/// <param name="fitting">fitting to get</param>
/// <returns name="systemtype">system type of fitting</returns>
[NodeCategory("Query")]
public static global::Revit.Elements.Element? SystemType(global::Revit.Elements.Element fitting)
{
Autodesk.Revit.DB.Element element = fitting.InternalElement;
Expand Down Expand Up @@ -213,7 +214,7 @@ private Fitting()
// Get Current Unit
FormatOptions units = doc.GetUnits().GetFormatOptions(SpecTypeId.PipeSize);
double value = UnitUtils.ConvertToInternalUnits(radius, units.GetUnitTypeId());
connectors.ForEach(x => x.Radius = value);
connectors.ForEach(x => x!.Radius = value);
TransactionManager.Instance.TransactionTaskDone();
return fitting;
}
Expand Down
2 changes: 2 additions & 0 deletions OpenMEP/Element/FlexPipe.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Autodesk.Revit.DB;
using Dynamo.Graph.Nodes;
using OpenMEP.Helpers;
using Revit.GeometryConversion;
using RevitServices.Persistence;
Expand Down Expand Up @@ -109,6 +110,7 @@ private FlexPipe()
/// The set operation will fail if the modification makes the connection invalid.
/// </remarks>
///<returns name="points">list point of flex pipe</returns>
[NodeCategory("Query")]
public static List<Autodesk.DesignScript.Geometry.Point> Points(Autodesk.Revit.DB.Plumbing.FlexPipe flexPipe)
{
return flexPipe.Points.Select(x=>x.ToPoint()).ToList();
Expand Down
1 change: 1 addition & 0 deletions OpenMEP/Element/Insulation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ private Insulation()
/// </summary>
/// <param name="element">the element to check</param>
/// <returns name="bool">true if element is insulation</returns>
[NodeCategory("Query")]
public bool IsAddInsulationOrLining(Revit.Elements.Element element)
{
Autodesk.Revit.DB.Element e = element.InternalElement;
Expand Down
3 changes: 3 additions & 0 deletions OpenMEP/Element/Pipe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ Autodesk.DesignScript.Geometry.Point point
/// </summary>
/// <param name="pipe">pipe to get</param>
/// <returns name="systemtype">system type of pipe</returns>
[NodeCategory("Query")]
public static global::Revit.Elements.Element? SystemType(global::Revit.Elements.Element pipe)
{
if (pipe == null) throw new ArgumentNullException(nameof(pipe));
Expand Down Expand Up @@ -601,6 +602,7 @@ public static double GetRoughness(global::Revit.Elements.Element pipe)
/// </summary>
/// <param name="pipe">pipe to get shape</param>
/// <returns name="connectorProfileType">connectorProfileType</returns>
[NodeCategory("Query")]
public static dynamic? Shape(global::Revit.Elements.Element pipe)
{
Autodesk.Revit.DB.Plumbing.Pipe? pipeInternalElement = pipe.InternalElement as Autodesk.Revit.DB.Plumbing.Pipe;
Expand All @@ -616,6 +618,7 @@ public static double GetRoughness(global::Revit.Elements.Element pipe)
///<remarks>
/// If the curve does not belong to any systems, the value will be <see langword="null" />.
/// If the curve belongs to more than one system, the first available value is returned. </remarks>
[NodeCategory("Query")]
public static global::Revit.Elements.Element? MEPSystem(global::Revit.Elements.Element pipe)
{
Autodesk.Revit.DB.Plumbing.Pipe? pipeInternalElement = pipe.InternalElement as Autodesk.Revit.DB.Plumbing.Pipe;
Expand Down
43 changes: 1 addition & 42 deletions OpenMEP/Geometry/Point.cs
Original file line number Diff line number Diff line change
@@ -1,50 +1,9 @@
using Autodesk.Revit.DB;

namespace OpenMEP.Geometry;
namespace OpenMEP.Geometry;

public class Point
{
private Point()
{

}

/// <summary>
/// Project a point onto a plane
/// </summary>
/// <param name="point">point need to project</param>
/// <param name="planeNormal">vector normal of plane</param>
/// <returns name="point">new point projected on plane</returns>
public static Autodesk.DesignScript.Geometry.Point ProjectOntoPlane(
Autodesk.DesignScript.Geometry.Point point,
Autodesk.DesignScript.Geometry.Vector planeNormal )
{
double a = planeNormal.X;
double b = planeNormal.Y;
double c = planeNormal.Z;

double dx = ( b * b + c * c ) * point.X - ( a * b ) * point.Y - ( a * c ) * point.Z;
double dy = -( b * a ) * point.X + ( a * a + c * c ) * point.Y - ( b * c ) * point.Z;
double dz = -( c * a ) * point.X - ( c * b ) * point.Y + ( a * a + b * b ) * point.Z;
return Autodesk.DesignScript.Geometry.Point.ByCoordinates( dx, dy, dz );
}

/// <summary>
/// Get the centroid of a list of points
/// </summary>
/// <param name="points">list of points</param>
/// <returns name="point">centroid</returns>
public static Autodesk.DesignScript.Geometry.Point Centroid( List<Autodesk.DesignScript.Geometry.Point> points )
{
double x = 0;
double y = 0;
double z = 0;
foreach ( Autodesk.DesignScript.Geometry.Point point in points )
{
x += point.X;
y += point.Y;
z += point.Z;
}
return Autodesk.DesignScript.Geometry.Point.ByCoordinates( x / points.Count, y / points.Count, z / points.Count );
}
}
38 changes: 38 additions & 0 deletions OpenMEP/Helpers/Convert.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System.Reflection;
using Autodesk.DesignScript.Runtime;
using Autodesk.Revit.DB;
using GShark.Geometry;
using Revit.Elements;
using Revit.GeometryConversion;
using RevitServices.Persistence;
using Arc = Autodesk.Revit.DB.Arc;
using dynCategory = Revit.Elements.Category;
using dynDocument = Revit.Application.Document;
using dynElement = Revit.Elements.Element;
Expand All @@ -13,13 +15,16 @@
using dynFamilyParameter = Revit.Elements.FamilyParameter;
#endif
using dynParameter = Revit.Elements.Parameter;
using Line = Autodesk.Revit.DB.Line;
using Plane = Autodesk.Revit.DB.Plane;
using Point = Autodesk.DesignScript.Geometry.Point;
using rvtCategory = Autodesk.Revit.DB.Category;
using rvtDocument = Autodesk.Revit.DB.Document;
using rvtElement = Autodesk.Revit.DB.Element;
using rvtFamilyParameter = Autodesk.Revit.DB.FamilyParameter;
using rvtParameter = Autodesk.Revit.DB.Parameter;
using Surface = Autodesk.DesignScript.Geometry.Surface;
using Vector = Autodesk.DesignScript.Geometry.Vector;

namespace OpenMEP.Helpers
{
Expand Down Expand Up @@ -426,5 +431,38 @@ internal static IEnumerable<Surface> ToDynamoType(this Face item)
IEnumerable<Surface> surfaces = item.ToProtoType();
return surfaces;
}

internal static Autodesk.DesignScript.Geometry.Vector ToDynamoType(this GShark.Geometry.Vector3 vector3)
{
return Autodesk.DesignScript.Geometry.Vector.ByCoordinates(vector3.X, vector3.Y, vector3.Z);
}
internal static GShark.Geometry.Vector3 ToGSharkType(this Autodesk.DesignScript.Geometry.Vector vector)
{
return new Vector3(vector.X, vector.Y, vector.Z);
}
internal static Autodesk.DesignScript.Geometry.Point ToDynamoType(this Point3 point3)
{
return Autodesk.DesignScript.Geometry.Point.ByCoordinates(point3.X, point3.Y, point3.Z);
}
internal static Point3 ToGSharkType(this Autodesk.DesignScript.Geometry.Point point)
{
return new Point3(point.X, point.Y, point.Z);
}
internal static Autodesk.DesignScript.Geometry.Line ToDynamoType(this GShark.Geometry.Line line)
{
return Autodesk.DesignScript.Geometry.Line.ByStartPointEndPoint(ToDynamoType(line.StartPoint), ToDynamoType(line.EndPoint));
}
internal static GShark.Geometry.Line ToGSharkType(this Autodesk.DesignScript.Geometry.Line line)
{
return new GShark.Geometry.Line(ToGSharkType(line.StartPoint), ToGSharkType(line.EndPoint));
}
internal static Autodesk.DesignScript.Geometry.Plane ToDynamoType(this GShark.Geometry.Plane plane)
{
return Autodesk.DesignScript.Geometry.Plane.ByOriginNormal(plane.Origin.ToDynamoType(), plane.ZAxis.ToDynamoType());
}
internal static GShark.Geometry.Plane ToGSharkType(this Autodesk.DesignScript.Geometry.Plane plane)
{
return new GShark.Geometry.Plane(plane.Origin.ToGSharkType(), plane.Normal.ToGSharkType());
}
}
}
35 changes: 19 additions & 16 deletions OpenMEP/OpenMEP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ImplicitUsings>true</ImplicitUsings>
<AssemblyVersion>1.0.0.*</AssemblyVersion>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<LangVersion>latest</LangVersion>
<UseWPF>true</UseWPF>
<RootNamespace>OpenMEP</RootNamespace>
<AssemblyName>OpenMEP</AssemblyName>
<PlatformTarget>x64</PlatformTarget>
<AssemblyVersion>1.0.0.*</AssemblyVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Configurations>Debug R20;Debug R21;Debug R22;Debug R23;Debug R23.1</Configurations>
<Configurations>$(Configurations);Release R20;Release R21;Release R22;Release R23;Release R23.1</Configurations>
<NoWarn>CS1591;CS0168;CS8618;CS1591;CS0419</NoWarn>
<NoWarn>CS1591;CS0168;CS8618;CS1591;CS0419;MSB3277</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('Debug R20'))">
<DynamoVersion>2.3</DynamoVersion>
Expand All @@ -31,15 +31,15 @@
<DefineConstants>$(DefineConstants);R20</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('Debug R21'))">
<DynamoVersion>2.12</DynamoVersion>
<DynamoVersion>2.6</DynamoVersion>
<DynamoOutput>2.6</DynamoOutput>
<RevitVersion>2021</RevitVersion>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineConstants>$(DefineConstants);R21</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('Release R21'))">
<DynamoVersion>2.12</DynamoVersion>
<DynamoVersion>2.6</DynamoVersion>
<DynamoOutput>2.6</DynamoOutput>
<RevitVersion>2021</RevitVersion>
<DefineConstants>$(DefineConstants);R21</DefineConstants>
Expand All @@ -59,29 +59,29 @@
<DefineConstants>$(DefineConstants);R22</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('Debug R23'))">
<DynamoVersion>2.12</DynamoVersion>
<DynamoVersion>2.13</DynamoVersion>
<DynamoOutput>2.13</DynamoOutput>
<RevitVersion>2023</RevitVersion>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineConstants>$(DefineConstants);R23</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('Release R23'))">
<DynamoVersion>2.13</DynamoVersion>
<DynamoOutput>2.13</DynamoOutput>
<RevitVersion>2023</RevitVersion>
<DefineConstants>$(DefineConstants);R23</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('Debug R23.1'))">
<DynamoVersion>2.12</DynamoVersion>
<DynamoVersion>2.16</DynamoVersion>
<DynamoOutput>2.16</DynamoOutput>
<RevitVersion>2023</RevitVersion>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineConstants>$(DefineConstants);R23</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('Release R23'))">
<DynamoVersion>2.12</DynamoVersion>
<DynamoOutput>2.13</DynamoOutput>
<RevitVersion>2023</RevitVersion>
<DefineConstants>$(DefineConstants);R23</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('Release R23.1'))">
<DynamoVersion>2.12</DynamoVersion>
<DynamoVersion>2.16</DynamoVersion>
<DynamoOutput>2.16</DynamoOutput>
<RevitVersion>2023</RevitVersion>
<DefineConstants>$(DefineConstants);R23</DefineConstants>
Expand All @@ -104,14 +104,14 @@
<PackageReference Include="Chuongmep.Revit.Api.RevitAPIUI" Version="$(RevitVersion).*">
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
<PackageReference Include="DynamoVisualProgramming.Core" Version="$(DynamoVersion).*">
<PackageReference Include="DynamoVisualProgramming.Core" Version="$(DynVersion).*">
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
<PackageReference Include="DynamoVisualProgramming.Revit" Version="$(DynamoVersion).*">
<PackageReference Include="DynamoVisualProgramming.Revit" Version="$(DynVersion).*">
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
<Reference Include="System.Net.Http" />
<PackageReference Include="GShark" Version="2.1.0" />
<PackageReference Include="GShark" Version="2.2.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
</ItemGroup>
<ItemGroup>
Expand All @@ -127,6 +127,9 @@
<DependentUpon>OpenMEPImages.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenMEPSandbox\OpenMEPSandbox.csproj" />
</ItemGroup>
<Target Name="CopyFiles" AfterTargets="CoreBuild">
<ItemGroup>
<AssemblyFiles Include="$(TargetDir)*.*" />
Expand Down
Loading

0 comments on commit 024cd75

Please sign in to comment.