-
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.
Merge pull request #19 from chuongmep/dev
Add Support Visualize Connector, Geometry Support
- Loading branch information
Showing
37 changed files
with
2,961 additions
and
99 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 |
---|---|---|
|
@@ -356,3 +356,5 @@ MigrationBackup/ | |
output/ | ||
wix/ | ||
_build | ||
|
||
*.0001.rvt |
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
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
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,54 @@ | ||
using Autodesk.DesignScript.Runtime; | ||
|
||
namespace OpenMEPSandbox.Geometry; | ||
|
||
public class CoordinateSystem | ||
{ | ||
private CoordinateSystem() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Shows scalable lines representing the CoordinateSystem axes and rectangles for the planes | ||
/// </summary> | ||
/// <param name="coordinateSystem">Autodesk.DesignScript.Geometry.CoordinateSystem</param> | ||
/// <param name="length">double</param> | ||
/// <returns name="Display">GeometryColor</returns> | ||
/// <returns name="Origin">Point</returns> | ||
/// <returns name="XAxis">Vector</returns> | ||
/// <returns name="YAxis">Vector</returns> | ||
/// <returns name="ZAxis">Vector</returns> | ||
/// <returns name="XYPlane">Plane</returns> | ||
/// <returns name="YZPlane">Plane</returns> | ||
/// <returns name="ZXPlane">Plane</returns> | ||
[MultiReturn(new[] {"Display", "Origin", "XAxis", "YAxis", "ZAxis", "XYPlane", "YZPlane", "ZXPlane"})] | ||
public static Dictionary<string, object?> Display(Autodesk.DesignScript.Geometry.CoordinateSystem coordinateSystem, | ||
double length = 1000) | ||
{ | ||
if (length <= 0) | ||
{ | ||
length = 1; | ||
} | ||
var pt = coordinateSystem.Origin; | ||
var lineX = Autodesk.DesignScript.Geometry.Line.ByStartPointDirectionLength(pt, coordinateSystem.XAxis, length); | ||
var colorX = DSCore.Color.ByARGB(255, 255, 0, 0); | ||
var lineY = Autodesk.DesignScript.Geometry.Line.ByStartPointDirectionLength(pt, coordinateSystem.YAxis, length); | ||
var colorY = DSCore.Color.ByARGB(255, 0, 255, 0); | ||
var lineZ = Autodesk.DesignScript.Geometry.Line.ByStartPointDirectionLength(pt, coordinateSystem.ZAxis, length); | ||
var colorZ = DSCore.Color.ByARGB(255, 0, 0, 255); | ||
List<Modifiers.GeometryColor> display = new List<Modifiers.GeometryColor>(); | ||
display.Add(Modifiers.GeometryColor.ByGeometryColor(lineX, colorX)); | ||
display.Add(Modifiers.GeometryColor.ByGeometryColor(lineY, colorY)); | ||
display.Add(Modifiers.GeometryColor.ByGeometryColor(lineZ, colorZ)); | ||
var d = new Dictionary<string, object?>(); | ||
d.Add("Display", display); | ||
d.Add("Origin", pt); | ||
d.Add("XAxis", coordinateSystem.XAxis); | ||
d.Add("YAxis", coordinateSystem.YAxis); | ||
d.Add("ZAxis", coordinateSystem.ZAxis); | ||
d.Add("XYPlane", coordinateSystem.XYPlane); | ||
d.Add("YZPlane", coordinateSystem.YZPlane); | ||
d.Add("ZXPlane", coordinateSystem.ZXPlane); | ||
return d; | ||
} | ||
} |
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,52 @@ | ||
namespace OpenMEPSandbox.Geometry; | ||
using Autodesk.DesignScript.Geometry; | ||
using Autodesk.DesignScript.Runtime; | ||
|
||
namespace OpenMEPSandbox.Geometry; | ||
|
||
public class Plane | ||
{ | ||
private Plane() | ||
{ | ||
|
||
} | ||
|
||
/// <summary> | ||
/// Shows scalable lines representing the axes and a rectangle for the Plane | ||
/// </summary> | ||
/// <param name="plane">Autodesk.DesignScript.Geometry.Plane</param> | ||
/// <param name="length">double</param> | ||
/// <returns name="Display">GeometryColor</returns> | ||
/// <returns name="Origin">Point</returns> | ||
/// <returns name="XAxis">Vector</returns> | ||
/// <returns name="YAxis">Vector</returns> | ||
/// <returns name="Normal">Vector</returns> | ||
[MultiReturn(new[] {"Display", "Origin", "XAxis", "YAxis", "Normal"})] | ||
public static Dictionary<string, object?> Display(Autodesk.DesignScript.Geometry.Plane? plane, double length = 1000) | ||
{ | ||
if (length <= 0) | ||
{ | ||
length = 1; | ||
} | ||
if (plane == null) return new Dictionary<string, object?>(); | ||
var pt = plane.Origin; | ||
var lineX = Autodesk.DesignScript.Geometry.Line.ByStartPointDirectionLength(pt, plane.XAxis, length); | ||
var colorX = DSCore.Color.ByARGB(255, 255, 0, 0); | ||
var lineY = Autodesk.DesignScript.Geometry.Line.ByStartPointDirectionLength(pt, plane.YAxis, length); | ||
var colorY = DSCore.Color.ByARGB(255, 0, 255, 0); | ||
var lineN = Autodesk.DesignScript.Geometry.Line.ByStartPointDirectionLength(pt, plane.Normal, length); | ||
var colorN = DSCore.Color.ByARGB(255, 0, 0, 255); | ||
var rect = Rectangle.ByWidthLength(plane, length, length); | ||
var colorR = DSCore.Color.ByARGB(50, 50, 50, 50); | ||
List<Modifiers.GeometryColor> display = new List<Modifiers.GeometryColor>(); | ||
display.Add(Modifiers.GeometryColor.ByGeometryColor(lineX, colorX)); | ||
display.Add(Modifiers.GeometryColor.ByGeometryColor(lineY, colorY)); | ||
display.Add(Modifiers.GeometryColor.ByGeometryColor(lineN, colorN)); | ||
display.Add(Modifiers.GeometryColor.ByGeometryColor(rect, colorR)); | ||
var d = new Dictionary<string, object?>(); | ||
d.Add("Display", display); | ||
d.Add("Origin", pt); | ||
d.Add("XAxis", plane.XAxis); | ||
d.Add("YAxis", plane.YAxis); | ||
d.Add("Normal", plane.Normal); | ||
return d; | ||
} | ||
} |
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
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,24 @@ | ||
using NUnit.Framework; | ||
using RevitServices.Persistence; | ||
|
||
namespace OpenMEPTest.Application; | ||
|
||
[TestFixture] | ||
public class DynamoTest | ||
{ | ||
[SetUp] | ||
public void SetUp() | ||
{ | ||
DocumentManager.Instance.CurrentUIApplication = | ||
RTF.Applications.RevitTestExecutive.CommandData.Application; | ||
DocumentManager.Instance.CurrentUIDocument = | ||
RTF.Applications.RevitTestExecutive.CommandData.Application.ActiveUIDocument; | ||
} | ||
|
||
[Test] | ||
public void CanGetDynamoVersion() | ||
{ | ||
string version = OpenMEP.Application.Dynamo.Version(); | ||
Assert.IsTrue(version.Length > 0); | ||
} | ||
} |
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,24 @@ | ||
using NUnit.Framework; | ||
using RevitServices.Persistence; | ||
|
||
namespace OpenMEPTest.Application; | ||
|
||
[TestFixture] | ||
public class OpenMEPTest | ||
{ | ||
[SetUp] | ||
public void SetUp() | ||
{ | ||
DocumentManager.Instance.CurrentUIApplication = | ||
RTF.Applications.RevitTestExecutive.CommandData.Application; | ||
DocumentManager.Instance.CurrentUIDocument = | ||
RTF.Applications.RevitTestExecutive.CommandData.Application.ActiveUIDocument; | ||
} | ||
|
||
[Test] | ||
public void CanGetOpenMEPVersion() | ||
{ | ||
string version = OpenMEP.Application.Dynamo.Version(); | ||
Assert.IsTrue(version.Length > 0); | ||
} | ||
} |
Oops, something went wrong.