/// <summary> /// Create a column. /// </summary> /// <param name="curve">The curve which defines the center line of the column.</param> /// <param name="level">The level with which you'd like the column to be associated.</param> /// <param name="structuralColumnType">The structural column type representing the column.</param> /// <returns></returns> public static StructuralFraming ColumnByCurve( Autodesk.DesignScript.Geometry.Curve curve, Revit.Elements.Level level, Revit.Elements.FamilyType structuralColumnType) { if (curve == null) { throw new System.ArgumentNullException("curve"); } if (level == null) { throw new System.ArgumentNullException("level"); } if (structuralColumnType == null) { throw new System.ArgumentNullException("structuralColumnType"); } var start = curve.PointAtParameter(0); var end = curve.PointAtParameter(1); // Revit will throw an exception if you attempt to create a column whose // base is above its top. if (end.Z <= start.Z) { throw new Exception(Properties.Resources.InvalidColumnBaseLocation); } return(new StructuralFraming(curve.ToRevitType(), level.InternalLevel, Autodesk.Revit.DB.Structure.StructuralType.Column, structuralColumnType.InternalFamilySymbol)); }
public void ByLevelOffsetAndName_NullArgument() { var elevation = 100; var offset = 100; var name = "Ham"; var level = Level.ByElevation(elevation); Assert.Throws(typeof(ArgumentNullException), () => Level.ByLevelOffsetAndName(null, offset, name)); Assert.Throws(typeof(ArgumentNullException), () => Level.ByLevelOffsetAndName(level, offset, null)); }
public void ByElevation_ShouldProduceLevelAtCorrectElevation() { var elevation = 100.0; var level = Level.ByElevation(elevation); Assert.NotNull(level); level.Elevation.ShouldBeApproximately(elevation); level.ProjectElevation.ShouldBeApproximately(elevation); // without unit conversion InternalElevation(level) .ShouldBeApproximately(elevation * UnitConverter.DynamoToHostFactor(UnitType.UT_Length)); }
public void ByLevelAndOffset_ValidArgs() { var elevation = 100.0; var offset = 100.0; var level = Level.ByElevation(elevation); var level2 = Level.ByLevelAndOffset(level, offset); Assert.NotNull(level2); level2.Elevation.ShouldBeApproximately(elevation + offset); level2.ProjectElevation.ShouldBeApproximately(elevation + offset); // without unit conversion InternalElevation(level2) .ShouldBeApproximately((elevation + offset) * UnitConverter.DynamoToHostFactor(UnitType.UT_Length)); }
public void ByElevationAndName_ShouldProduceLevelAtCorrectElevation() { // construct the extrusion var elevation = 100.0; var name = "Ham"; var level = Level.ByElevationAndName(elevation, name); Assert.NotNull(level); level.Elevation.ShouldBeApproximately(elevation); level.ProjectElevation.ShouldBeApproximately(elevation); Assert.AreEqual(name, level.Name); // without unit conversion InternalElevation(level) .ShouldBeApproximately(elevation * UnitConverter.DynamoToHostFactor(UnitType.UT_Length)); }
public void ByLevelOffsetAndName_ShouldProduceLevelAtCorrectElevation() { var elevation = 100; var offset = 100; var name = "TortoiseTime"; var level = Level.ByElevation(elevation); var level2 = Level.ByLevelOffsetAndName(level, offset, name); Assert.NotNull(level2); level2.Elevation.ShouldBeApproximately(elevation + offset); level2.ProjectElevation.ShouldBeApproximately(elevation + offset); // without unit conversion InternalElevation(level2) .ShouldBeApproximately((elevation + offset) * UnitConverter.DynamoToHostFactor(UnitType.UT_Length)); }
public void ByElevationAndName_DuplicatedNames() { //Create a new level with the name of "Ham" and the //elevation of 100 var elevation = 100.0; var name = "Old Level"; var level = Level.ByElevationAndName(elevation, name); Assert.NotNull(level); level.Elevation.ShouldBeApproximately(elevation); Assert.AreEqual(name, level.Name); //Create a new level with the same name and elevation level = Level.ByElevationAndName(elevation, name); level.Elevation.ShouldBeApproximately(elevation); Assert.AreEqual(name + "(1)", level.Name); //Once again create a new level with the same name and elevation level = Level.ByElevationAndName(elevation, name); level.Elevation.ShouldBeApproximately(elevation); Assert.AreEqual(name + "(2)", level.Name); //Create a new level with a name of lowercase letters //and the same elevation var name3 = "old level"; var level3 = Level.ByElevationAndName(elevation, name3); Assert.IsNotNull(level3); level3.Elevation.ShouldBeApproximately(elevation); Assert.AreEqual(name3, level3.Name); //Create a new level with a totally different name var name4 = "New level"; var level4 = Level.ByElevationAndName(elevation, name4); Assert.NotNull(level4); level4.Elevation.ShouldBeApproximately(elevation); Assert.AreEqual(name4, level4.Name); }
/// <summary> /// Creates a pipe by curve. /// </summary> /// <param name="pipeType">Type of the pipe.</param> /// <param name="pipingSystemType">Type of the piping system.</param> /// <param name="curve">The curve.</param> /// <param name="level">The level.</param> /// <returns></returns> public static Pipe ByCurve(Revit.Elements.Element pipeType, Revit.Elements.Element pipingSystemType, Autodesk.DesignScript.Geometry.Curve curve, Revit.Elements.Level level) { Utils.Log(string.Format("Pipe.ByCurve started...", "")); if (!SessionVariables.ParametersCreated) { UtilsObjectsLocation.CheckParameters(DocumentManager.Instance.CurrentDBDocument); } var oType = pipeType.InternalElement as Autodesk.Revit.DB.Plumbing.PipeType; var oSystemType = pipingSystemType.InternalElement as Autodesk.Revit.DB.Plumbing.PipingSystemType; var totalTransform = RevitUtils.DocumentTotalTransform(); var start = curve.StartPoint.Transform(totalTransform) as Autodesk.DesignScript.Geometry.Point; var s = start.ToXyz(); var end = curve.EndPoint.Transform(totalTransform) as Autodesk.DesignScript.Geometry.Point; var e = end.ToXyz(); var l = level.InternalElement as Autodesk.Revit.DB.Level; if (start != null) { start.Dispose(); } if (end != null) { end.Dispose(); } Utils.Log(string.Format("Pipe.ByCurve completed.", "")); return(new Pipe(oType, oSystemType, s, e, l)); }
public void ByElevationAndName_NullArgument() { var elevation = 100; Assert.Throws(typeof(ArgumentNullException), () => Level.ByElevationAndName(elevation, null)); }
/// <summary> /// Creates a pipe by curve. /// </summary> /// <param name="ductType">Type of the duct.</param> /// <param name="mechanicalSystemType">Type of the mechanical system.</param> /// <param name="curve">The curve.</param> /// <param name="level">The level.</param> /// <returns></returns> public static Duct ByCurve(Revit.Elements.Element ductType, Revit.Elements.Element mechanicalSystemType, Autodesk.DesignScript.Geometry.Curve curve, Revit.Elements.Level level) { Utils.Log(string.Format("Duct.ByCurve started...", "")); var totalTransform = RevitUtils.DocumentTotalTransform(); if (!SessionVariables.ParametersCreated) { UtilsObjectsLocation.CheckParameters(DocumentManager.Instance.CurrentDBDocument); } var oType = ductType.InternalElement as Autodesk.Revit.DB.Mechanical.DuctType; var oSystemType = mechanicalSystemType.InternalElement as Autodesk.Revit.DB.Mechanical.MechanicalSystemType; var start = curve.StartPoint.Transform(totalTransform) as Autodesk.DesignScript.Geometry.Point; var s = start.ToXyz(); var end = curve.EndPoint.Transform(totalTransform) as Autodesk.DesignScript.Geometry.Point; var e = end.ToXyz(); var l = level.InternalElement as Autodesk.Revit.DB.Level; totalTransform.Dispose(); Utils.Log(string.Format("Duct.ByCurve completed.", "")); return(new Duct(oType, oSystemType, s, e, l)); }
/// <summary> /// Create a Revit Floor given it's curve outline and Level /// </summary> /// <param name="outline">The outline.</param> /// <param name="floorType">Type of the floor.</param> /// <param name="level">The level.</param> /// <param name="structural">if set to <c>true</c> [structural].</param> /// <returns> /// The floor /// </returns> public static SlopedFloor ByOutlineTypeAndLevel(Autodesk.DesignScript.Geometry.PolyCurve outline, Revit.Elements.FloorType floorType, Revit.Elements.Level level, bool structural) { Utils.Log(string.Format("SlopedFloor.ByOutlineTypeAndLevel started...", "")); try { var profile = new CurveArray(); Autodesk.DesignScript.Geometry.Plane plane = Autodesk.DesignScript.Geometry.Plane.ByBestFitThroughPoints( outline.Curves().Cast <Autodesk.DesignScript.Geometry.Curve>().Select(x => x.StartPoint)); Vector normal = plane.Normal; if (normal.Dot(Vector.ZAxis()) <= 0) { normal = normal.Reverse(); } Autodesk.DesignScript.Geometry.Point origin = plane.Origin; Autodesk.DesignScript.Geometry.Point end = origin.Add(normal); Autodesk.DesignScript.Geometry.Point projection = Autodesk.DesignScript.Geometry.Point.ByCoordinates(end.X, end.Y, -1000); end = Autodesk.DesignScript.Geometry.Point.ByCoordinates(end.X, end.Y, end.Z + 1000); Autodesk.DesignScript.Geometry.Point intersection = null; var result = plane.Intersect(Autodesk.DesignScript.Geometry .Line.ByStartPointEndPoint(end, projection)); if (result.Length > 0) { intersection = result[0] as Autodesk.DesignScript.Geometry.Point; } else { var message = "Couldn't find intersection"; Utils.Log(string.Format("ERROR: SlopedFloor.ByOutlineTypeAndLevel {0}", message)); throw new Exception(message); } Autodesk.DesignScript.Geometry.Curve temp = Autodesk.DesignScript.Geometry.Line.ByBestFitThroughPoints(new Autodesk.DesignScript.Geometry.Point[] { origin, intersection }); PolyCurve flat = PolyCurve.ByJoinedCurves(outline.PullOntoPlane(Autodesk.DesignScript.Geometry.Plane.XY() .Offset(temp.StartPoint.Z)).Explode().Cast <Autodesk.DesignScript.Geometry.Curve>().ToList()); Autodesk.DesignScript.Geometry.Curve flatLine = temp.PullOntoPlane(Autodesk.DesignScript.Geometry.Plane.XY().Offset(temp.StartPoint.Z)); if (Math.Abs(Math.Abs(plane.Normal.Dot(Vector.ZAxis())) - 1) < 0.00001) { var f = Revit.Elements.Floor.ByOutlineTypeAndLevel(flat, floorType, level); f.InternalElement.Parameters.Cast <Autodesk.Revit.DB.Parameter>() .First(x => x.Id.IntegerValue.Equals(Autodesk.Revit.DB.BuiltInParameter.FLOOR_PARAM_IS_STRUCTURAL)) .Set(structural ? 1 : 0); plane.Dispose(); flatLine.Dispose(); flat.Dispose(); origin.Dispose(); end.Dispose(); projection.Dispose(); intersection.Dispose(); temp.Dispose(); return(new SlopedFloor(f.InternalElement as Autodesk.Revit.DB.Floor)); } double slope = (temp.EndPoint.Z - temp.StartPoint.Z) / flatLine.Length; foreach (Autodesk.DesignScript.Geometry.Curve c in flat.Curves()) { profile.Append(c.ToRevitType()); } Autodesk.Revit.DB.Line slopeArrow = flatLine.ToRevitType() as Autodesk.Revit.DB.Line; var ft = floorType.InternalElement as Autodesk.Revit.DB.FloorType; var lvl = level.InternalElement as Autodesk.Revit.DB.Level; var floor = new SlopedFloor(profile, slopeArrow, slope, ft, lvl, structural); floor.Level = level; floor.Floortype = floorType; floor.Structural = structural; //DocumentManager.Regenerate(); plane.Dispose(); flatLine.Dispose(); flat.Dispose(); origin.Dispose(); end.Dispose(); projection.Dispose(); intersection.Dispose(); temp.Dispose(); Utils.Log(string.Format("SlopedFloor.ByOutlineTypeAndLevel completed.", "")); return(floor); } catch (Exception ex) { Utils.Log(string.Format("ERROR: SlopedFloor.ByOutlineTypeAndLevel {0}", ex.Message)); throw ex; } }
/// <summary> /// Create a brace. /// </summary> /// <param name="curve">The cruve which defines the center line of the brace.</param> /// <param name="level">The level with which you'd like the brace to be associated.</param> /// <param name="structuralFramingType">The structural framing type representing the brace.</param> /// <returns></returns> public static StructuralFraming BraceByCurve(Autodesk.DesignScript.Geometry.Curve curve, Revit.Elements.Level level, Revit.Elements.FamilyType structuralFramingType) { if (curve == null) { throw new System.ArgumentNullException("curve"); } if (level == null) { throw new System.ArgumentNullException("level"); } if (structuralFramingType == null) { throw new System.ArgumentNullException("structuralFramingType"); } return(new StructuralFraming(curve.ToRevitType(), level.InternalLevel, Autodesk.Revit.DB.Structure.StructuralType.Brace, structuralFramingType.InternalFamilySymbol)); }
/// <summary> /// Creates a PipePlaceholder by two points. /// </summary> /// <param name="pipeType">Type of the pipe.</param> /// <param name="systemType">Type of the system.</param> /// <param name="start">The start.</param> /// <param name="end">The end.</param> /// <param name="level">The level.</param> /// <returns></returns> public static PipePlaceHolder ByPoints(Revit.Elements.Element pipeType, Revit.Elements.Element systemType, Autodesk.DesignScript.Geometry.Point start, Autodesk.DesignScript.Geometry.Point end, Revit.Elements.Level level) { Utils.Log(string.Format("PipePlaceHolder.ByPoints started...", "")); var oType = pipeType.InternalElement as Autodesk.Revit.DB.Plumbing.PipeType; var oSystemType = systemType.InternalElement as Autodesk.Revit.DB.Plumbing.PipingSystemType; var totalTransform = RevitUtils.DocumentTotalTransform(); start = start.Transform(totalTransform) as Autodesk.DesignScript.Geometry.Point; var s = start.ToXyz(); end = end.Transform(totalTransform) as Autodesk.DesignScript.Geometry.Point; var e = end.ToXyz(); var l = level.InternalElement as Autodesk.Revit.DB.Level; totalTransform.Dispose(); Utils.Log(string.Format("PipePlaceHolder.ByPoints completed.", "")); return(new PipePlaceHolder(oType, oSystemType, s, e, l)); }
/// <summary> /// Creates a pipe by curve. /// </summary> /// <param name="pipeType">Type of the pipe.</param> /// <param name="pipingSystemType">Type of the piping system.</param> /// <param name="level">The level.</param> /// <param name="curve">The curve.</param> /// <param name="featureline">The featureline.</param> /// <returns></returns> public static Pipe ByCurveFeatureline(Revit.Elements.Element pipeType, Revit.Elements.Element pipingSystemType, Revit.Elements.Level level, Autodesk.DesignScript.Geometry.Curve curve, Featureline featureline) { Utils.Log(string.Format("Pipe.ByCurveFeatureline started...", "")); if (!SessionVariables.ParametersCreated) { UtilsObjectsLocation.CheckParameters(DocumentManager.Instance.CurrentDBDocument); } Autodesk.DesignScript.Geometry.Point start = null; Autodesk.DesignScript.Geometry.Point end = null; var oType = pipeType.InternalElement as Autodesk.Revit.DB.Plumbing.PipeType; var oSystemType = pipingSystemType.InternalElement as Autodesk.Revit.DB.Plumbing.PipingSystemType; var totalTransform = RevitUtils.DocumentTotalTransform(); start = curve.StartPoint.Transform(totalTransform) as Autodesk.DesignScript.Geometry.Point; var s = start.ToXyz(); end = curve.EndPoint.Transform(totalTransform) as Autodesk.DesignScript.Geometry.Point; var e = end.ToXyz(); var l = level.InternalElement as Autodesk.Revit.DB.Level; var pipe = new Pipe(oType, oSystemType, s, e, l); var startSOE = featureline.GetStationOffsetElevationByPoint(curve.StartPoint); var endSOE = featureline.GetStationOffsetElevationByPoint(curve.EndPoint); double startStation = (double)startSOE["Station"]; double startOffset = (double)startSOE["Offset"]; double startElevation = (double)startSOE["Elevation"]; double endStation = (double)endSOE["Station"]; double endOffset = (double)endSOE["Offset"]; double endElevation = (double)endSOE["Elevation"]; pipe.SetParameterByName(ADSK_Parameters.Instance.Corridor.Name, featureline.Baseline.CorridorName); pipe.SetParameterByName(ADSK_Parameters.Instance.BaselineIndex.Name, featureline.Baseline.Index); pipe.SetParameterByName(ADSK_Parameters.Instance.RegionIndex.Name, featureline.BaselineRegionIndex); // 1.1.0 pipe.SetParameterByName(ADSK_Parameters.Instance.RegionRelative.Name, startStation - featureline.Start); // 1.1.0 pipe.SetParameterByName(ADSK_Parameters.Instance.RegionNormalized.Name, (startStation - featureline.Start) / (featureline.End - featureline.Start)); // 1.1.0 pipe.SetParameterByName(ADSK_Parameters.Instance.Code.Name, featureline.Code); pipe.SetParameterByName(ADSK_Parameters.Instance.Side.Name, featureline.Side.ToString()); pipe.SetParameterByName(ADSK_Parameters.Instance.X.Name, Math.Round(curve.StartPoint.X, 3)); pipe.SetParameterByName(ADSK_Parameters.Instance.Y.Name, Math.Round(curve.StartPoint.Y, 3)); pipe.SetParameterByName(ADSK_Parameters.Instance.Z.Name, Math.Round(curve.StartPoint.Z, 3)); pipe.SetParameterByName(ADSK_Parameters.Instance.Station.Name, Math.Round(startStation, 3)); pipe.SetParameterByName(ADSK_Parameters.Instance.Offset.Name, Math.Round(startOffset, 3)); pipe.SetParameterByName(ADSK_Parameters.Instance.Elevation.Name, Math.Round(startElevation, 3)); pipe.SetParameterByName(ADSK_Parameters.Instance.Update.Name, 1); pipe.SetParameterByName(ADSK_Parameters.Instance.Delete.Name, 0); pipe.SetParameterByName(ADSK_Parameters.Instance.EndStation.Name, Math.Round(endStation, 3)); pipe.SetParameterByName(ADSK_Parameters.Instance.EndOffset.Name, Math.Round(endOffset, 3)); pipe.SetParameterByName(ADSK_Parameters.Instance.EndElevation.Name, Math.Round(endElevation, 3)); pipe.SetParameterByName(ADSK_Parameters.Instance.EndRegionRelative.Name, endStation - featureline.Start); // 1.1.0 pipe.SetParameterByName(ADSK_Parameters.Instance.EndRegionNormalized.Name, (endStation - featureline.Start) / (featureline.End - featureline.Start)); // 1.1.0 if (start != null) { start.Dispose(); } if (end != null) { end.Dispose(); } Utils.Log(string.Format("Pipe.ByCurveFeatureline completed.", "")); return(pipe); }
public void ByLevelAndOffset_NullArgument() { var offset = 100; Assert.Throws(typeof(ArgumentNullException), () => Level.ByLevelAndOffset(null, offset)); }
public static Dictionary <string, object> ByPolyCurve(Revit.Elements.Element pipeType, Revit.Elements.Element pipingSystemType, PolyCurve polyCurve, Revit.Elements.Level level, double maxLength, Featureline featureline) { Utils.Log(string.Format("Pipe.ByPolyCurve started...", "")); var totalTransform = RevitUtils.DocumentTotalTransform(); var totalTransformInverse = totalTransform.Inverse(); if (!SessionVariables.ParametersCreated) { UtilsObjectsLocation.CheckParameters(DocumentManager.Instance.CurrentDBDocument); } var oType = pipeType.InternalElement as Autodesk.Revit.DB.Plumbing.PipeType; var oSystemType = pipingSystemType.InternalElement as Autodesk.Revit.DB.Plumbing.PipingSystemType; var l = level.InternalElement as Autodesk.Revit.DB.Level; double length = polyCurve.Length; int subdivisions = Convert.ToInt32(Math.Ceiling(length / maxLength)); IList <Autodesk.DesignScript.Geometry.Point> points = new List <Autodesk.DesignScript.Geometry.Point>(); points.Add(polyCurve.StartPoint); foreach (Autodesk.DesignScript.Geometry.Point p in polyCurve.PointsAtEqualChordLength(subdivisions)) { points.Add(p); } points.Add(polyCurve.EndPoint); points = Autodesk.DesignScript.Geometry.Point.PruneDuplicates(points); IList <ElementId> ids = new List <ElementId>(); TransactionManager.Instance.EnsureInTransaction(DocumentManager.Instance.CurrentDBDocument); Autodesk.DesignScript.Geometry.Point start = null; Autodesk.DesignScript.Geometry.Point end = null; Autodesk.DesignScript.Geometry.Point sp = null; Autodesk.DesignScript.Geometry.Point ep = null; Autodesk.DesignScript.Geometry.Curve curve = null; for (int i = 0; i < points.Count - 1; ++i) { start = points[i].Transform(totalTransform) as Autodesk.DesignScript.Geometry.Point; var s = start.ToXyz(); end = points[i + 1].Transform(totalTransform) as Autodesk.DesignScript.Geometry.Point; var e = end.ToXyz(); Autodesk.Revit.DB.Plumbing.Pipe p = Autodesk.Revit.DB.Plumbing.Pipe.CreatePlaceholder(DocumentManager.Instance.CurrentDBDocument, oSystemType.Id, oType.Id, l.Id, s, e); ids.Add(p.Id); } var pipeIds = Autodesk.Revit.DB.Plumbing.PlumbingUtils.ConvertPipePlaceholders(DocumentManager.Instance.CurrentDBDocument, ids); TransactionManager.Instance.TransactionTaskDone(); DocumentManager.Instance.CurrentDBDocument.Regenerate(); Pipe[] pipes = GetPipesByIds(pipeIds); foreach (Pipe pipe in pipes) { curve = pipe.Location.Transform(totalTransformInverse) as Autodesk.DesignScript.Geometry.Curve; sp = curve.StartPoint; ep = curve.EndPoint; pipe.SetParameterByName(ADSK_Parameters.Instance.Corridor.Name, featureline.Baseline.CorridorName); pipe.SetParameterByName(ADSK_Parameters.Instance.BaselineIndex.Name, featureline.Baseline.Index); pipe.SetParameterByName(ADSK_Parameters.Instance.Code.Name, featureline.Code); pipe.SetParameterByName(ADSK_Parameters.Instance.Side.Name, featureline.Side.ToString()); pipe.SetParameterByName(ADSK_Parameters.Instance.X.Name, Math.Round(sp.X, 3)); pipe.SetParameterByName(ADSK_Parameters.Instance.Y.Name, Math.Round(sp.Y, 3)); pipe.SetParameterByName(ADSK_Parameters.Instance.Z.Name, Math.Round(sp.Z, 3)); var soe = featureline.GetStationOffsetElevationByPoint(sp); pipe.SetParameterByName(ADSK_Parameters.Instance.Station.Name, Math.Round((double)soe["Station"], 3)); pipe.SetParameterByName(ADSK_Parameters.Instance.Offset.Name, Math.Round((double)soe["Offset"], 3)); pipe.SetParameterByName(ADSK_Parameters.Instance.Elevation.Name, Math.Round((double)soe["Elevation"], 3)); pipe.SetParameterByName(ADSK_Parameters.Instance.Update.Name, 1); pipe.SetParameterByName(ADSK_Parameters.Instance.Delete.Name, 0); soe = featureline.GetStationOffsetElevationByPoint(ep); pipe.SetParameterByName(ADSK_Parameters.Instance.EndStation.Name, Math.Round((double)soe["Station"], 3)); pipe.SetParameterByName(ADSK_Parameters.Instance.EndOffset.Name, Math.Round((double)soe["Offset"], 3)); pipe.SetParameterByName(ADSK_Parameters.Instance.EndElevation.Name, Math.Round((double)soe["Elevation"], 3)); } IList <Fitting> fittings = new List <Fitting>(); for (int i = 0; i < pipes.Length - 1; ++i) { Fitting fitting = null; try { fitting = Fitting.Elbow(pipes[i], pipes[i + 1]); } catch { } fittings.Add(fitting); } if (start != null) { start.Dispose(); } if (end != null) { end.Dispose(); } if (sp != null) { sp.Dispose(); } if (ep != null) { ep.Dispose(); } if (curve != null) { curve.Dispose(); } foreach (var item in points) { if (item != null) { item.Dispose(); } } points.Clear(); Utils.Log(string.Format("Pipe.ByPolyCurve completed.", "")); return(new Dictionary <string, object>() { { "Pipes", pipes }, { "Fittings", fittings } }); }
/// <summary> /// Creates a pipe by two points. /// </summary> /// <param name="pipeType">Type of the pipe.</param> /// <param name="pipingSystemType">Type of the piping system.</param> /// <param name="start">The start point.</param> /// <param name="end">The end point.</param> /// <param name="level">The level.</param> /// <returns></returns> public static Pipe ByPoints(Revit.Elements.Element pipeType, Revit.Elements.Element pipingSystemType, Autodesk.DesignScript.Geometry.Point start, Autodesk.DesignScript.Geometry.Point end, Revit.Elements.Level level) { Utils.Log(string.Format("Pipe.ByPoints started...", "")); UtilsObjectsLocation.CheckParameters(DocumentManager.Instance.CurrentDBDocument); var oType = pipeType.InternalElement as Autodesk.Revit.DB.Plumbing.PipeType; var oSystemType = pipingSystemType.InternalElement as Autodesk.Revit.DB.Plumbing.PipingSystemType; var totalTransform = RevitUtils.DocumentTotalTransform(); start = start.Transform(totalTransform) as Autodesk.DesignScript.Geometry.Point; var s = start.ToXyz(); end = end.Transform(totalTransform) as Autodesk.DesignScript.Geometry.Point; var e = end.ToXyz(); var l = level.InternalElement as Autodesk.Revit.DB.Level; totalTransform.Dispose(); Utils.Log(string.Format("Pipe.ByPoints completed.", "")); return(new Pipe(oType, oSystemType, s, e, l)); }