-
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
8 changed files
with
421 additions
and
350 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,46 @@ | ||
using Autodesk.Revit.DB.Mechanical; | ||
using Autodesk.Revit.DB.Plumbing; | ||
using OpenMEP.Helpers; | ||
using RevitServices.Persistence; | ||
|
||
namespace OpenMEP.Element; | ||
|
||
public class DuctSystem | ||
{ | ||
private DuctSystem() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// flag true to return all ducting systems | ||
/// </summary> | ||
/// <param name="toggle">flag true or false to fresh</param> | ||
/// <returns name="ductSystemTypes">pipePingSystemTypes</returns> | ||
public static IEnumerable<Revit.Elements.Element?> GetAllDuctSystemTypes(bool toggle) | ||
{ | ||
// filter for all piping systems | ||
Autodesk.Revit.DB.FilteredElementCollector collector = new Autodesk.Revit.DB.FilteredElementCollector(DocumentManager.Instance.CurrentDBDocument); | ||
Autodesk.Revit.DB.ElementClassFilter filter = new Autodesk.Revit.DB.ElementClassFilter(typeof(Autodesk.Revit.DB.Mechanical.MechanicalSystemType)); | ||
Autodesk.Revit.DB.FilteredElementIterator iterator = collector.WherePasses(filter).GetElementIterator(); | ||
iterator.Reset(); | ||
while (iterator.MoveNext()) | ||
{ | ||
Autodesk.Revit.DB.Element element = iterator.Current!; | ||
if (element is MechanicalSystemType pipingSystemType) | ||
{ | ||
yield return pipingSystemType.ToDynamoType(); | ||
} | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// return duct system type by name | ||
/// </summary> | ||
/// <param name="typeName">name of pipe system type</param> | ||
/// <returns name="ductSystemType">the element system type</returns> | ||
public static Revit.Elements.Element? GetDuctSystemTypeByName(string typeName) | ||
{ | ||
return GetAllDuctSystemTypes(true).FirstOrDefault(x => x!.Name == typeName); | ||
} | ||
|
||
} |
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,48 @@ | ||
using OpenMEP.Helpers; | ||
using RevitServices.Persistence; | ||
|
||
namespace OpenMEP.Element; | ||
|
||
public class DuctType | ||
{ | ||
private DuctType() | ||
{ | ||
|
||
} | ||
|
||
/// <summary> | ||
/// get pipe type by name | ||
/// </summary> | ||
/// <param name="typeName">type name of duct</param> | ||
/// <returns name="ductType">type of duct</returns> | ||
public static Revit.Elements.Element? GetDuctTypeByName(string typeName) | ||
{ | ||
return GetAllDuctTypes().FirstOrDefault(x => x!.Name == typeName); | ||
} | ||
|
||
/// <summary> | ||
/// return all duct types of the current document | ||
/// </summary> | ||
/// <returns name="ductTypes">All Duct Types</returns> | ||
public static List<Revit.Elements.Element?> GetAllDuctTypes() | ||
{ | ||
// Get all the pipe types in the current document | ||
Autodesk.Revit.DB.Document doc = DocumentManager.Instance.CurrentDBDocument; | ||
Autodesk.Revit.DB.FilteredElementCollector collector = new Autodesk.Revit.DB.FilteredElementCollector(doc); | ||
Autodesk.Revit.DB.ElementClassFilter filter = new Autodesk.Revit.DB.ElementClassFilter(typeof(Autodesk.Revit.DB.Mechanical.DuctType)); | ||
Autodesk.Revit.DB.FilteredElementIterator iterator = collector.WherePasses(filter).GetElementIterator(); | ||
iterator.Reset(); | ||
List<Revit.Elements.Element?> pipeTypes = new List<Revit.Elements.Element?>(); | ||
while (iterator.MoveNext()) | ||
{ | ||
Autodesk.Revit.DB.Element element = iterator.Current!; | ||
if (element is Autodesk.Revit.DB.Mechanical.DuctType ductType) | ||
{ | ||
pipeTypes.Add(ductType.ToDynamoType()); | ||
} | ||
} | ||
return pipeTypes; | ||
} | ||
|
||
|
||
} |
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,136 @@ | ||
using System.Security.Policy; | ||
using OpenMEP.Helpers; | ||
|
||
namespace OpenMEP.Element; | ||
|
||
/// <summary> | ||
/// A class can use for DuctType, PipeType, CableTrayType, ConduitType, WireType, MEPCurveType | ||
/// </summary> | ||
public class MEPCurveType | ||
{ | ||
private MEPCurveType() | ||
{ | ||
|
||
} | ||
|
||
/// <summary>The default cross fitting of the MEP curve type.</summary> | ||
/// <para name="mepcurvetype">type of mep curve</para> | ||
/// <remarks>This property is used to retrieve the default cross fitting of the MEP curve type, | ||
/// and can be <see langword="null" /> if there is no default value. | ||
/// Use <see cref="T:Autodesk.Revit.DB.RoutingPreferenceManager" /> to set this property for PipeType MEPCurves. | ||
/// </remarks> | ||
/// <returns name="familyType">Cross fitting</returns> | ||
public static Revit.Elements.Element? Cross(Revit.Elements.Element mepcurvetype) | ||
{ | ||
if (mepcurvetype == null) throw new ArgumentNullException(nameof(mepcurvetype)); | ||
var mepCurveType = mepcurvetype.InternalElement as Autodesk.Revit.DB.MEPCurveType; | ||
if(mepCurveType!.Cross== null) return null; | ||
return mepCurveType!.Cross.ToDynamoType(); | ||
} | ||
|
||
/// <summary>The default elbow fitting of the MEP curve type.</summary> | ||
/// <para name="mepcurvetype">type of mep curve</para> | ||
/// <remarks>This property is used to retrieve the default elbow fitting of the MEP curve type, | ||
/// and can be <see langword="null" /> if there is no default value. | ||
/// Use <see cref="T:Autodesk.Revit.DB.RoutingPreferenceManager" /> to set this property for PipeType MEPCurves. | ||
/// </remarks> | ||
/// <returns name="familyType">Elbow fitting</returns> | ||
public static Revit.Elements.Element? Elbow(Revit.Elements.Element mepcurvetype) | ||
{ | ||
if (mepcurvetype == null) throw new ArgumentNullException(nameof(mepcurvetype)); | ||
var mepCurveType = mepcurvetype.InternalElement as Autodesk.Revit.DB.MEPCurveType; | ||
if(mepCurveType!.Elbow== null) return null; | ||
return mepCurveType!.Elbow.ToDynamoType(); | ||
} | ||
|
||
/// <summary>The default tap fitting of the MEP curve type.</summary> | ||
/// <para name="mepcurvetype">type of mep curve</para> | ||
/// <remarks>This property is used to retrieve the default tap fitting of the MEP curve type, | ||
/// and can be <see langword="null" /> if there is no default value. | ||
/// Use <see cref="T:Autodesk.Revit.DB.RoutingPreferenceManager" /> to set this property for PipeType MEPCurves. | ||
/// </remarks> | ||
/// <returns name="familyType">Tap fitting</returns> | ||
public static Revit.Elements.Element? Tap(Revit.Elements.Element mepcurvetype) | ||
{ | ||
if (mepcurvetype == null) throw new ArgumentNullException(nameof(mepcurvetype)); | ||
var mepCurveType = mepcurvetype.InternalElement as Autodesk.Revit.DB.MEPCurveType; | ||
if(mepCurveType!.Tap== null) return null; | ||
return mepCurveType!.Tap.ToDynamoType(); | ||
} | ||
|
||
/// <summary>The default union fitting of the MEP curve type.</summary> | ||
/// <para name="mepcurvetype">type of mep curve</para> | ||
/// <remarks>This property is used to retrieve the default union fitting of the MEP curve type, | ||
/// and can be <see langword="null" /> if there is no default value. | ||
/// Use <see cref="T:Autodesk.Revit.DB.RoutingPreferenceManager" /> to set this property for PipeType MEPCurves. | ||
/// </remarks> | ||
/// <returns name="familyType">union fitting</returns> | ||
public static Revit.Elements.Element? Union(Revit.Elements.Element mepcurvetype) | ||
{ | ||
if (mepcurvetype == null) throw new ArgumentNullException(nameof(mepcurvetype)); | ||
var mepCurveType = mepcurvetype.InternalElement as Autodesk.Revit.DB.MEPCurveType; | ||
if(mepCurveType!.Union== null) return null; | ||
return mepCurveType!.Union.ToDynamoType(); | ||
} | ||
|
||
/// <summary>The default transition fitting of the MEP curve type.</summary> | ||
/// <para name="mepcurvetype">type of mep curve</para> | ||
/// <remarks>This property is used to retrieve the default transition fitting of the MEP curve type, | ||
/// and can be <see langword="null" /> if there is no default value. | ||
/// Use <see cref="T:Autodesk.Revit.DB.RoutingPreferenceManager" /> to set this property for PipeType MEPCurves. | ||
/// </remarks> | ||
/// <returns name="familyType">transition fitting</returns> | ||
public static Revit.Elements.Element? Transition(Revit.Elements.Element mepcurvetype) | ||
{ | ||
if (mepcurvetype == null) throw new ArgumentNullException(nameof(mepcurvetype)); | ||
var mepCurveType = mepcurvetype.InternalElement as Autodesk.Revit.DB.MEPCurveType; | ||
if(mepCurveType!.Transition== null) return null; | ||
return mepCurveType!.Transition.ToDynamoType(); | ||
} | ||
|
||
/// <summary>The default multi shape transition fitting of the MEP curve type.</summary> | ||
/// <para name="mepcurvetype">type of mep curve</para> | ||
/// <remarks>This property is used to retrieve the default multi shape transition fitting of the MEP curve type, | ||
/// and can be <see langword="null" /> if there is no default value. | ||
/// Use <see cref="T:Autodesk.Revit.DB.RoutingPreferenceManager" /> to set this property for PipeType MEPCurves. | ||
/// </remarks> | ||
/// <returns name="familyType"> multi shape transition fitting</returns> | ||
public static Revit.Elements.Element? MultiShapeTransition(Revit.Elements.Element mepcurvetype) | ||
{ | ||
if (mepcurvetype == null) throw new ArgumentNullException(nameof(mepcurvetype)); | ||
var mepCurveType = mepcurvetype.InternalElement as Autodesk.Revit.DB.MEPCurveType; | ||
if (mepCurveType!.MultiShapeTransition == null) return null; | ||
return mepCurveType.MultiShapeTransition.ToDynamoType(); | ||
} | ||
|
||
/// <summary>The shape of the profile.</summary> | ||
/// <para name="mepcurvetype">type of mep curve</para> | ||
/// <since>2019</since> | ||
/// <returns name="Autodesk.Revit.DB.ConnectorProfileType">ConnectorProfileType</returns> | ||
public static dynamic Shape(Revit.Elements.Element mepcurvetype) | ||
{ | ||
if (mepcurvetype == null) throw new ArgumentNullException(nameof(mepcurvetype)); | ||
var mepCurveType = mepcurvetype.InternalElement as Autodesk.Revit.DB.MEPCurveType; | ||
return mepCurveType!.Shape; | ||
} | ||
|
||
/// <summary>The roughness of the MEP curve type. For PipeTypes, please use Segment::Roughness</summary> | ||
/// <para name="mepcurvetype">type of mep curve</para> | ||
/// <returns name="double">Roughness</returns> | ||
public static double Roughness(Revit.Elements.Element mepcurvetype) | ||
{ | ||
if (mepcurvetype == null) throw new ArgumentNullException(nameof(mepcurvetype)); | ||
var mepCurveType = mepcurvetype.InternalElement as Autodesk.Revit.DB.MEPCurveType; | ||
return mepCurveType!.Roughness; | ||
} | ||
|
||
/// <summary>The preferred junction type of the MEP curve type.</summary> | ||
/// <para name="mepcurvetype">type of mep curve</para> | ||
/// <remarks>Use <see cref="T:Autodesk.Revit.DB.RoutingPreferenceManager" /> to set this property for PipeType MEPCurves.</remarks> | ||
public static dynamic PreferredJunctionType(Revit.Elements.Element mepcurvetype) | ||
{ | ||
if (mepcurvetype == null) throw new ArgumentNullException(nameof(mepcurvetype)); | ||
var mepCurveType = mepcurvetype.InternalElement as Autodesk.Revit.DB.MEPCurveType; | ||
return mepCurveType!.PreferredJunctionType; | ||
} | ||
} |
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
Oops, something went wrong.