|
@@ -10,6 +10,7 @@ using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
+using Autodesk.Revit.DB;
|
|
|
using Autodesk.Revit.DB.Plumbing;
|
|
|
using JBIM;
|
|
|
using JBIM.Definition;
|
|
@@ -19,7 +20,8 @@ using RevitToJBim.Common;
|
|
|
using RevitToJBim.ParseData;
|
|
|
using SAGA.RevitUtils.Extends;
|
|
|
using SAGA.RevitUtils.MEP;
|
|
|
-using JPipe=JBIM.Component.Pipe;
|
|
|
+using JPipe = JBIM.Component.Pipe;
|
|
|
+using XYZ = JBIM.Definition.XYZ;
|
|
|
|
|
|
namespace RevitToJBim.ComponentParse
|
|
|
{
|
|
@@ -28,11 +30,11 @@ namespace RevitToJBim.ComponentParse
|
|
|
{
|
|
|
public override List<string> FastIndex()
|
|
|
{
|
|
|
- return new List<string>() { typeof(Pipe).FullName };
|
|
|
+ return new List<string>() { typeof(Pipe).FullName, typeof(FlexPipe).FullName };
|
|
|
}
|
|
|
public override bool Match(ElementWrapper wrapper)
|
|
|
{
|
|
|
- return wrapper.RefElement is Pipe;
|
|
|
+ return wrapper.RefElement is Pipe || wrapper.RefElement is FlexPipe;
|
|
|
}
|
|
|
|
|
|
protected override List<BimId> ParseInner(ElementWrapper wrapper, JBimParseContext context)
|
|
@@ -42,19 +44,28 @@ namespace RevitToJBim.ComponentParse
|
|
|
* 2、维护一些构件的关联管理关系,可以放在这个方法中,也可以放在ArrangeRefElements中
|
|
|
*
|
|
|
*/
|
|
|
- if (!(wrapper.RefElement is Pipe pipe))
|
|
|
+ if (!(wrapper.RefElement is MEPCurve pipe))
|
|
|
{
|
|
|
return null;
|
|
|
}
|
|
|
JPipe jPipe = new JPipe();
|
|
|
+ if (pipe is FlexPipe)
|
|
|
+ jPipe = new JBIM.Component.FlexPipe();
|
|
|
ParseCore.AttachObject(jPipe, wrapper);
|
|
|
- jPipe.Diameter =pipe.Diameter.FtToUse();
|
|
|
- var locations = new List<XYZ>();
|
|
|
- locations.Add(BimConvert.ConvertToXYZ(pipe.GetCurve().StartPoint()));
|
|
|
- locations.Add(BimConvert.ConvertToXYZ(pipe.GetCurve().EndPoint()));
|
|
|
- jPipe.Location = GeometryLocation.CreateLineLocation(locations);
|
|
|
- Polygon outLine = new Polygon(locations);
|
|
|
- jPipe.OutLine.Add(outLine);
|
|
|
+ jPipe.Diameter = pipe.Diameter.FtToUse();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var locations = new List<XYZ>();
|
|
|
+ locations.Add(BimConvert.ConvertToXYZ(pipe.GetCurve().StartPoint()));
|
|
|
+ locations.Add(BimConvert.ConvertToXYZ(pipe.GetCurve().EndPoint()));
|
|
|
+ jPipe.Location = GeometryLocation.CreateLineLocation(locations);
|
|
|
+ Polygon outLine = new Polygon(locations);
|
|
|
+ jPipe.OutLine.Add(outLine);
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ Console.WriteLine(e);
|
|
|
+ }
|
|
|
context.AddBimObject(jPipe);
|
|
|
//Parameters
|
|
|
jPipe.Parameters = RevitUtil.GetMEPCurveParameters(pipe);
|
|
@@ -73,10 +84,10 @@ namespace RevitToJBim.ComponentParse
|
|
|
{
|
|
|
Console.WriteLine(e.Message + e.StackTrace);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
#endregion
|
|
|
#region Connector连接关系
|
|
|
- var connectors = pipe.GetConnectors();
|
|
|
+ var connectors = (pipe).GetConnectors(Domain.DomainPiping);
|
|
|
ElementOneToManyRel relMany = new ElementOneToManyRel(pipeId) { RelatedObjects = new List<string>() };
|
|
|
relMany.SetElementType(TypeDefinition.Property_ConnectedIds);
|
|
|
foreach (var refConnector in connectors)
|
|
@@ -90,23 +101,23 @@ namespace RevitToJBim.ComponentParse
|
|
|
}
|
|
|
#endregion
|
|
|
#endregion
|
|
|
- return new List<BimId>(){ jPipe.Id };
|
|
|
+ return new List<BimId>() { jPipe.Id };
|
|
|
}
|
|
|
|
|
|
public override List<ElementWrapper> ArrangeRefElements(ElementWrapper wrapper, JBimParseContext context)
|
|
|
{
|
|
|
- if (!(wrapper.RefElement is Pipe pipe))
|
|
|
+ if (!(wrapper.RefElement is MEPCurve pipe))
|
|
|
{
|
|
|
return null;
|
|
|
}
|
|
|
//创建MepSystem
|
|
|
- // var mepSystemElementWrapper = new ElementWrapper(pipe.MEPSystem);
|
|
|
- var wrappers=new List<ElementWrapper>() { };
|
|
|
- var connectors = pipe.GetConnectors();
|
|
|
+ // var mepSystemElementWrapper = new ElementWrapper(pipe.MEPSystem);
|
|
|
+ var wrappers = new List<ElementWrapper>() { };
|
|
|
+ var connectors = pipe.GetConnectors(Domain.DomainPiping);
|
|
|
foreach (var connector in connectors)
|
|
|
{
|
|
|
wrappers.Add(ParseCore.GetConnectorWrapper(connector));
|
|
|
- }
|
|
|
+ }
|
|
|
return wrappers;
|
|
|
}
|
|
|
}
|