-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
188 changed files
with
13,784 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: deploy-book | ||
|
||
# Only run this when the master branch changes | ||
on: | ||
push: | ||
branches: | ||
- docs | ||
# If your git repository has the Jupyter Book within some-subfolder next to | ||
# unrelated files, you can make this run only if a file within that specific | ||
# folder has been modified. | ||
# | ||
# paths: | ||
# - some-subfolder/** | ||
|
||
# This job installs dependencies, builds the book, and pushes it to `gh-pages` | ||
jobs: | ||
deploy-book: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
# Install dependencies | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install -r ./docs/OpenMEPPage/requirements.txt | ||
# Build the book | ||
- name: Build the book | ||
run: | | ||
jupyter-book build ./docs/OpenMEPPage | ||
# Push the book's HTML to github-pages | ||
- name: GitHub Pages action | ||
uses: peaceiris/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./docs/OpenMEPPage/_build/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ name: Workflow | |
on: | ||
push: | ||
branches: | ||
- '**' | ||
- dev | ||
- master | ||
pull_request: | ||
branches: | ||
- '!master' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -355,3 +355,4 @@ MigrationBackup/ | |
# ignore output msi | ||
output/ | ||
wix/ | ||
_build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System.Reflection; | ||
using Dynamo.Applications; | ||
|
||
namespace OpenMEP.Application; | ||
|
||
public class Dynamo | ||
{ | ||
private Dynamo() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// return current version of dynamo | ||
/// </summary> | ||
/// <returns name="version">version</returns> | ||
public static string Version() | ||
{ | ||
Assembly assembly = Assembly.Load("DynamoCore"); | ||
Version version = assembly.GetName().Version; | ||
return version.ToString(); | ||
} | ||
|
||
#if R20 | ||
#else | ||
/// <summary> | ||
/// return current file name of script opening | ||
/// </summary> | ||
/// <returns></returns> | ||
public static string CurrentFileName() | ||
{ | ||
try | ||
{ | ||
string fileName = DynamoRevit.RevitDynamoModel.CurrentWorkspace.FileName; | ||
if (string.IsNullOrEmpty(fileName)) return "Home"; | ||
return fileName; | ||
} | ||
catch (Exception e) | ||
{ | ||
return string.Empty; | ||
} | ||
} | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using Microsoft.Win32; | ||
|
||
namespace OpenMEP.Application; | ||
|
||
public class OpenMEP | ||
{ | ||
private OpenMEP() | ||
{ | ||
|
||
} | ||
/// <summary> | ||
/// Return Current Version Installed In Computer | ||
/// </summary> | ||
public static string? Version | ||
{ | ||
get | ||
{ | ||
string appName = "OpenMEP"; | ||
string? displayName; | ||
string registryKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"; | ||
RegistryKey key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(registryKey)!; | ||
foreach (RegistryKey subkey in key.GetSubKeyNames().Select(keyName => key.OpenSubKey(keyName))) | ||
{ | ||
displayName = subkey!.GetValue("DisplayName") as string; | ||
if (displayName != null && displayName.Contains(appName)) | ||
{ | ||
return (subkey.GetValue("DisplayVersion") as string)!; | ||
} | ||
} | ||
key.Close(); | ||
|
||
registryKey = @"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"; | ||
key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(registryKey)!; | ||
foreach (RegistryKey subkey in key.GetSubKeyNames().Select(keyName => key.OpenSubKey(keyName))) | ||
{ | ||
displayName = subkey!.GetValue("DisplayName") as string; | ||
if (displayName != null && displayName.Contains(appName)) | ||
{ | ||
return subkey.GetValue("DisplayVersion") as string; | ||
} | ||
} | ||
key.Close(); | ||
return string.Empty; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using RevitServices.Persistence; | ||
|
||
namespace OpenMEP.Application; | ||
|
||
public class Revit | ||
{ | ||
private Revit() | ||
{ | ||
|
||
} | ||
|
||
/// <summary> | ||
/// return version number of revit | ||
/// </summary> | ||
/// <returns name="string">version</returns> | ||
public static string Version() | ||
{ | ||
return DocumentManager.Instance.CurrentUIDocument.Application.Application.VersionNumber; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Autodesk.DesignScript.Runtime; | ||
|
||
namespace OpenMEP.Application; | ||
|
||
public class Windows | ||
{ | ||
private Windows() | ||
{ | ||
|
||
} | ||
|
||
/// <summary> | ||
/// return version number of windows | ||
/// </summary> | ||
/// <returns></returns> | ||
[MultiReturn("build", "major", "minor", "revision", "version")] | ||
public static Dictionary<string, object?> Version() | ||
{ | ||
// Get version System | ||
int build = System.Environment.OSVersion.Version.Build; | ||
int major = System.Environment.OSVersion.Version.Major; | ||
int minor = System.Environment.OSVersion.Version.Minor; | ||
int revision = System.Environment.OSVersion.Version.Revision; | ||
string version = System.Environment.OSVersion.Version.ToString(); | ||
return new Dictionary<string, object?>() | ||
{ | ||
{"build", build}, | ||
{"major", major}, | ||
{"minor", minor}, | ||
{"revision", revision}, | ||
{"version", version} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,50 @@ | ||
namespace OpenMEP.Geometry; | ||
using Autodesk.Revit.DB; | ||
|
||
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 ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using System; | ||
using System.Linq; | ||
using Autodesk.Revit.DB; | ||
using NUnit.Framework; | ||
using RTF.Applications; | ||
using RTF.Framework; | ||
|
||
namespace OpenMEPTest; | ||
|
||
[TestFixture] | ||
public class ConnectorManagerTest | ||
{ | ||
[SetUp] | ||
public void SetUp() | ||
{ | ||
var doc = RevitTestExecutive.CommandData.Application.ActiveUIDocument.Document; | ||
Assert.IsNotNull(doc); | ||
} | ||
|
||
[Test] | ||
[TestModel("Resources/bricks.rfa")] | ||
public void ModelHasTheCorrectNumberOfBricks() | ||
{ | ||
var doc = RevitTestExecutive.CommandData.Application.ActiveUIDocument.Document; | ||
|
||
var fec = new FilteredElementCollector(doc); | ||
fec.OfClass(typeof(FamilyInstance)); | ||
|
||
var bricks = fec.ToElements() | ||
.Cast<FamilyInstance>() | ||
.Where(fi => fi.Symbol.Family.Name == "brick"); | ||
|
||
Assert.AreEqual(bricks.Count(), 4); | ||
} | ||
|
||
/// <summary> | ||
/// This is the Hello World of Revit testing. Here we | ||
/// simply call the Revit API to create a new ReferencePoint | ||
/// in the default empty.rfa file. | ||
/// </summary> | ||
[Test] | ||
public void CanCreateAReferencePoint() | ||
{ | ||
var doc = RevitTestExecutive.CommandData.Application.ActiveUIDocument.Document; | ||
|
||
using (var t = new Transaction(doc)) | ||
{ | ||
if (t.Start("Test one.") == TransactionStatus.Started) | ||
{ | ||
//create a reference point | ||
var pt = doc.FamilyCreate.NewReferencePoint(new XYZ(5, 5, 5)); | ||
|
||
if (t.Commit() != TransactionStatus.Committed) | ||
{ | ||
t.RollBack(); | ||
} | ||
} | ||
else | ||
{ | ||
throw new Exception("Transaction could not be started."); | ||
} | ||
} | ||
//verify that the point was created | ||
var collector = new FilteredElementCollector(doc); | ||
collector.OfClass(typeof (ReferencePoint)); | ||
Assert.AreEqual(1, collector.ToElements().Count); | ||
} | ||
|
||
|
||
} | ||
|
||
|
Oops, something went wrong.