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 26, 2023
2 parents 024cd75 + ff6be34 commit 67bd3ae
Show file tree
Hide file tree
Showing 37 changed files with 867 additions and 34 deletions.
1 change: 1 addition & 0 deletions .idea/.idea.OpenMEP/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions OpenMEP.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionIt
CHANGELOG.md = CHANGELOG.md
docs\OpenMEP_DynamoCustomization.xml = docs\OpenMEP_DynamoCustomization.xml
docs\OpenMEPSandbox_DynamoCustomization.xml = docs\OpenMEPSandbox_DynamoCustomization.xml
docs\sandbox\pkg.json = docs\sandbox\pkg.json
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeployInstaller", "DeployInstaller\DeployInstaller.csproj", "{C7835EFE-E1C7-48B2-90D0-E943D43A905D}"
Expand All @@ -28,6 +29,7 @@ Global
Debug R22|Any CPU = Debug R22|Any CPU
Debug R23|Any CPU = Debug R23|Any CPU
Debug R23.1|Any CPU = Debug R23.1|Any CPU
Debug R24|Any CPU = Debug R24|Any CPU
Release R20|Any CPU = Release R20|Any CPU
Release R21|Any CPU = Release R21|Any CPU
Release R22|Any CPU = Release R22|Any CPU
Expand Down Expand Up @@ -56,6 +58,8 @@ Global
{A7FE0286-8CEA-4C63-9603-22D79E98EAB1}.Debug R23.1|Any CPU.Build.0 = Debug R23.1|Any CPU
{A7FE0286-8CEA-4C63-9603-22D79E98EAB1}.Release R23.1|Any CPU.ActiveCfg = Release R23.1|Any CPU
{A7FE0286-8CEA-4C63-9603-22D79E98EAB1}.Release R23.1|Any CPU.Build.0 = Release R23.1|Any CPU
{A7FE0286-8CEA-4C63-9603-22D79E98EAB1}.Debug R24|Any CPU.ActiveCfg = Debug R24|Any CPU
{A7FE0286-8CEA-4C63-9603-22D79E98EAB1}.Debug R24|Any CPU.Build.0 = Debug R24|Any CPU
{C7835EFE-E1C7-48B2-90D0-E943D43A905D}.Debug R21|Any CPU.ActiveCfg = Debug|Any CPU
{C7835EFE-E1C7-48B2-90D0-E943D43A905D}.Debug R22|Any CPU.ActiveCfg = Debug|Any CPU
{C7835EFE-E1C7-48B2-90D0-E943D43A905D}.Debug R23|Any CPU.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -110,5 +114,7 @@ Global
{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
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Debug R24|Any CPU.ActiveCfg = Debug R24|Any CPU
{5FDD66F2-49B5-4896-B6FB-79B1CC457904}.Debug R24|Any CPU.Build.0 = Debug R24|Any CPU
EndGlobalSection
EndGlobal
7 changes: 4 additions & 3 deletions OpenMEP/Element/Family/FamilyParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ public static void MakeType(Autodesk.Revit.DB.Document doc, Autodesk.Revit.DB.Fa
/// <returns name="forgeTypeId">forgeTypeId</returns>
public static dynamic GetUnitTypeId(Autodesk.Revit.DB.FamilyParameter familyParameter)
{
#if R22 || R23
dynamic? displayUnitType = familyParameter.GetUnitTypeId();
#elif R21 || R20
#if R20 || R21
dynamic? displayUnitType = familyParameter.DisplayUnitType;

#else
dynamic? displayUnitType = familyParameter.GetUnitTypeId();
#endif
return displayUnitType;
}
Expand Down
8 changes: 7 additions & 1 deletion OpenMEP/OpenMEP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<AssemblyName>OpenMEP</AssemblyName>
<PlatformTarget>x64</PlatformTarget>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Configurations>Debug R20;Debug R21;Debug R22;Debug R23;Debug R23.1</Configurations>
<Configurations>Debug R20;Debug R21;Debug R22;Debug R23;Debug R23.1;Debug R24</Configurations>
<Configurations>$(Configurations);Release R20;Release R21;Release R22;Release R23;Release R23.1</Configurations>
<NoWarn>CS1591;CS0168;CS8618;CS1591;CS0419;MSB3277</NoWarn>
</PropertyGroup>
Expand Down Expand Up @@ -86,6 +86,12 @@
<RevitVersion>2023</RevitVersion>
<DefineConstants>$(DefineConstants);R23</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('Debug R24'))">
<DynamoVersion>2.16</DynamoVersion>
<DynamoOutput>2.16</DynamoOutput>
<RevitVersion>2024</RevitVersion>
<DefineConstants>$(DefineConstants);R24</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<DynVersion>$(DynamoVersion)</DynVersion>
<BuildOutput>$(DynamoOutput)</BuildOutput>
Expand Down
30 changes: 26 additions & 4 deletions OpenMEPSandbox/Geometry/Point.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ public static bool IsOnPlane(Autodesk.DesignScript.Geometry.Point point, Autodes
};
}


//TODO : Got some bug from G-Shark Library
//
// //TODO : Got some bug from G-Shark Library
// /// <summary>
// /// Tests whether a point is inside, outside, or coincident with a polygon.
// /// </summary>
// /// <returns name="double">Returns -1 if point is outside the polygon, 0 if it is coincident with a polygon edge, or 1 if it is inside the polygon.</returns>
// public static double IsInPolygon(Autodesk.DesignScript.Geometry.Point point,Autodesk.DesignScript.Geometry.Polygon polygon)
// public static double IsInPolygon2(Autodesk.DesignScript.Geometry.Point point,Autodesk.DesignScript.Geometry.Polygon polygon)
// {
// if (point == null) throw new ArgumentNullException(nameof(point));
// if (polygon == null) throw new ArgumentNullException(nameof(polygon));
Expand All @@ -115,7 +115,7 @@ public static bool IsOnPlane(Autodesk.DesignScript.Geometry.Point point, Autodes
/// </summary>
/// <param name="point">the point</param>
/// <param name="polygon">the polygon</param>
/// <returns></returns>
/// <returns name="bool">true if point is in polygon</returns>
/// <exception cref="ArgumentNullException"></exception>
[NodeCategory("Query")]
public static bool IsInPolygon(Autodesk.DesignScript.Geometry.Point point,
Expand All @@ -125,4 +125,26 @@ public static bool IsInPolygon(Autodesk.DesignScript.Geometry.Point point,
if (polygon == null) throw new ArgumentNullException(nameof(polygon));
return polygon.ContainmentTest(point);
}

/// <summary>
/// Gets a point with X,Y,Z = 0
/// </summary>
/// <returns name="point">point</returns>
public static Autodesk.DesignScript.Geometry.Point Origin()
{
return Autodesk.DesignScript.Geometry.Point.ByCoordinates(0,0,0);
}

/// <summary>
/// Offset a point by a distance and a direction
/// </summary>
/// <param name="point">point to offset</param>
/// <param name="distance">distance from start point to end point</param>
/// <param name="direction">direction to direct to</param>
/// <returns name="point">new point</returns>
public static Autodesk.DesignScript.Geometry.Point Offset(Autodesk.DesignScript.Geometry.Point point,double distance, Autodesk.DesignScript.Geometry.Vector direction)
{
return point.Add(direction.ToGSharkType().Amplify(distance).ToDynamoType());
}

}
12 changes: 9 additions & 3 deletions OpenMEPSandbox/OpenMEPSandbox.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<RootNamespace>OpenMEPSandbox</RootNamespace>
<PlatformTarget>x64</PlatformTarget>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Configurations>Debug R20;Debug R21;Debug R22;Debug R23;Debug R23.1</Configurations>
<Configurations>Debug R20;Debug R21;Debug R22;Debug R23;Debug R23.1;Debug R24</Configurations>
<Configurations>$(Configurations);Release R20;Release R21;Release R22;Release R23;Release R23.1</Configurations>
<NoWarn>CS1591;CS0168;CS8618;CS1591;CS0419;NU1701</NoWarn>
<Platforms>AnyCPU</Platforms>
Expand Down Expand Up @@ -85,6 +85,12 @@
<RevitVersion>2023</RevitVersion>
<DefineConstants>$(DefineConstants);R23</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.Contains('Debug R24'))">
<DynamoVersion>2.16</DynamoVersion>
<DynamoOutput>2.18</DynamoOutput>
<RevitVersion>2023</RevitVersion>
<DefineConstants>$(DefineConstants);R23</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<DynVersion>$(DynamoVersion)</DynVersion>
<BuildOutput>$(DynamoOutput)</BuildOutput>
Expand All @@ -93,7 +99,7 @@
<Copyright>MIT</Copyright>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>dynamo</PackageTags>
<FolderPackages>$(Appdata)\Dynamo\Dynamo Core\$(DynVersion)\packages\OpenMEP\</FolderPackages>
<FolderPackages>$(Appdata)\Dynamo\Dynamo Core\$(DynamoOutput)\packages\OpenMEP\</FolderPackages>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
Expand All @@ -105,7 +111,7 @@
<Target Name="CopyFiles" AfterTargets="CoreBuild">
<ItemGroup>
<AssemblyFiles Include="$(TargetDir)*.*" />
<PgkDefinition Include="$(SolutionDir)docs\pkg.json" />
<PgkDefinition Include="$(SolutionDir)docs\sandbox\pkg.json" />
<XmlCustomization Include="$(SolutionDir)docs\*.xml" />
<ExtralFiles Include="$(SolutionDir)docs\extra\*.*" />
<DyfFiles Include="$(SolutionDir)docs\dyf\*.*" />
Expand Down
10 changes: 6 additions & 4 deletions docs/OpenMEPPage/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ options:
numbered: True
parts:
- caption: Getting Started
maxdepth: 2
maxdepth: 3
chapters:
- file: tutorial/installation
- file : tutorial/uninstall
- file: tutorial/upgrade
- caption: Tutorial
maxdepth: 2 # The displayed Table of Contents will only have two levels
maxdepth: 3 # The displayed Table of Contents will only have two levels
chapters:
- file: application/application
sections:
Expand All @@ -40,8 +40,10 @@ parts:
- file: element/family/familysizemanager
- file: element/family/familytype
- file: element/cabletray
- file: element/familyinstance
- file: element/conduit
- file: element/duct
- file: element/insulation
- file: element/fitting
- file: element/mepcurve
- file: element/pipe
Expand All @@ -57,5 +59,5 @@ parts:
- caption: Advanced
maxdepth: 3
chapters:
- file: createcustomnode
- file : python
- file: advanced/createcustomnode
- file : advanced/python
File renamed without changes.
Binary file added docs/OpenMEPPage/advanced/pic/CreatePipe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/OpenMEPPage/advanced/pic/ImportLibrary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions docs/OpenMEPPage/advanced/python.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Python Script use OpenMEP

OpenMEP allow us to use Python to create MEP elements. This is a very powerful feature that allows us to create MEP elements in a very flexible way. In this section, we will learn how to use Python to create MEP elements.
## Getting Started with OpenMEP

To get started with **OpenMEP**, we need to install OpenMEP package. OpenMEP package is available at [Latest Release](https://github.com/chuongmep/OpenMEP/releases/latest), and then let follow the instruction to install OpenMEP package at [How to install OpenMEP package](https://chuongmep.github.io/OpenMEP/tutorial/installation.html).


Now, when we open Dynamo Revit, we can see **OpenMEP** package in the library, let start with the first example. We will try

```py
# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('OpenMEP')
import OpenMEP
from OpenMEP.Element import Duct as d

OUT =dir(d)
```

![](pic/ImportLibrary.png)

Now, let try to create a **Pipe** with Python use **OpenMEP** package.

```py

# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('OpenMEP')
import OpenMEP
from OpenMEP.Element import Pipe as p
systemType = IN[0]
pipeType = IN[1]
level = IN[2]
line = IN[3]
OUT = p.Create(systemType,pipeType,level,line)
```

![Create Pipe](pic/CreatePipe.png)


3 changes: 3 additions & 0 deletions docs/OpenMEPPage/connectormanager/connectormanager.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

![](dyn/pic/ConnectorManager.png)

```{contents}
```

## GetConnectorManager

![](dyn/pic/ConnectorManager.GetConnectorManager.jpg)
Expand Down
7 changes: 7 additions & 0 deletions docs/OpenMEPPage/document/document.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@

```{tableofcontents}
```

```{contents}
```

## Current


7 changes: 6 additions & 1 deletion docs/OpenMEPPage/document/familydocument.md
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
# Family Document
# Family Document

```{contents}
```

## FamilyManager
11 changes: 11 additions & 0 deletions docs/OpenMEPPage/element/cabletray.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
# Cable Tray

```{contents}
```
## Create

### Create By Two Point

### Create By Two Connector

### Create By Line


10 changes: 9 additions & 1 deletion docs/OpenMEPPage/element/conduit.md
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
# Conduit
# Conduit

## Create

### Create By Two Point

### Create By Two Connector

### Create By Line
33 changes: 32 additions & 1 deletion docs/OpenMEPPage/element/duct.md
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
# Duct
# Duct

```{contents}
```

## Create

### Create By Two Point

### Create By Two Connector

### Create By Line

### Create By Connector And End Point

## CreatePlaceholder

## SetDiameter

### Rectangular

### Round

## GetDiameter

## SetSystemType

## Shape

## IsHvacSystemTypeId

## IsDuctTypeId
10 changes: 9 additions & 1 deletion docs/OpenMEPPage/element/element.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# Element

```{tableofcontents}
```
```

```{contents}
```

## LocationCenter

## GetDocument

14 changes: 13 additions & 1 deletion docs/OpenMEPPage/element/family/family.md
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
# Family
# Family

```{tableofcontents}
```

```{contents}
```

## EditFamily

## FamilyCategory

## IsOwnerFamily
20 changes: 19 additions & 1 deletion docs/OpenMEPPage/element/family/familymanager.md
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
# Family Manager
# Family Manager

```{contents}
```

## Set

## CurrentType

## TypeExits

## NewType

## GetParameters

## Types

## GetParameter

Loading

0 comments on commit 67bd3ae

Please sign in to comment.