Example #1
0
        public void ByPointVectorDistance_NullInput1()
        {
            var v = Vector.ByCoordinates(1, 0, 0);

            Assert.Throws(typeof(System.ArgumentNullException), () => ReferencePoint.ByPointVectorDistance(null, v, 0));
            var p = Point.ByCoordinates(0, -10, 23.1);

            Assert.Throws(typeof(System.ArgumentNullException), () => ReferencePoint.ByPointVectorDistance(p, null, 0.5));
        }
Example #2
0
        public void ByPoint_ShouldPlaceReferencePointCorrectly()
        {
            var p  = Point.ByCoordinates(0, -10, 23.1);
            var rp = ReferencePoint.ByPoint(p);

            rp.Point.ShouldBeApproximately(p);

            InternalPosition(rp).ShouldBeApproximately(p.InHostUnits());
        }
Example #3
0
        public void ByParameterOnCurveReference_ShouldPlaceReferencePointCorrectly()
        {
            var l          = Line.ByStartPointEndPoint(Point.ByCoordinates(0, 0, 0), Point.ByCoordinates(1, 0, 0));
            var modelCurve = ModelCurve.ByCurve(l);
            var rp         = ReferencePoint.ByParameterOnCurveReference(modelCurve.ElementCurveReference, 0.5);

            var pt = Point.ByCoordinates(0.5, 0, 0);

            rp.Point.ShouldBeApproximately(pt);
            InternalPosition(rp).ShouldBeApproximately(pt.InHostUnits());
        }
Example #4
0
        public void ByPointVectorDistance_ShouldPlaceReferencePointCorrectly()
        {
            var p  = Point.ByCoordinates(0, -10, 23.1);
            var v  = Vector.ByCoordinates(1, 0, 0);
            var d  = 5;
            var rp = ReferencePoint.ByPointVectorDistance(p, v, d);

            var pt = p.Add(v.Scale(5));

            rp.Point.ShouldBeApproximately(pt);
            InternalPosition(rp).ShouldBeApproximately(pt.InHostUnits());
        }
Example #5
0
        public void ByLengthOnCurveReference_ShouldPlaceReferencePointCorrectly()
        {
            var l          = Line.ByStartPointEndPoint(Point.ByCoordinates(0, 0, 0), Point.ByCoordinates(1, 0, 0));
            var modelCurve = ModelCurve.ByCurve(l);
            var rp         = ReferencePoint.ByLengthOnCurveReference(modelCurve.ElementCurveReference, 0.5);

            DocumentManager.Instance.CurrentDBDocument.Regenerate();

            var pt = Point.ByCoordinates(0.5, 0, 0);

            rp.Point.ShouldBeApproximately(pt);
            InternalPosition(rp).ShouldBeApproximately(pt.InHostUnits());
        }
Example #6
0
        public void ByParametersOnFaceReference_ShouldPlaceReferencePointCorrectly()
        {
            var ele = ElementSelector.ByType <Autodesk.Revit.DB.Form>(true).FirstOrDefault();

            Assert.NotNull(ele);

            var form    = ele as Form;
            var faceRef = form.ElementFaceReferences.First();

            var pt = ReferencePoint.ByParametersOnFaceReference(faceRef, 0.5, 0.5);

            Assert.NotNull(pt);
            pt.X.ShouldBeApproximately(-18.19622727891606);
        }
Example #7
0
 public void ByLengthOnCurveReference_NullInput()
 {
     Assert.Throws(typeof(System.ArgumentNullException), () => ReferencePoint.ByLengthOnCurveReference(null, 0.5));
 }
Example #8
0
 public void ByParametersOnFaceReference_NullInput()
 {
     Assert.Throws(typeof(System.ArgumentNullException), () => ReferencePoint.ByParametersOnFaceReference(null, 0.5, 0.5));
 }
Example #9
0
 public static ReferencePoint Wrap(Autodesk.Revit.DB.ReferencePoint ele, bool isRevitOwned)
 {
     return(ReferencePoint.FromExisting(ele, isRevitOwned));
 }
Example #10
0
        /// <summary>
        /// Construct a Revit CurveByPoints Element (a CurveElement) from a collection of ReferencePoint's
        /// </summary>
        /// <param name="curve"></param>
        /// <returns></returns>
        public static CurveByPoints ByReferencePoints(ReferencePoint[] points, bool isReferenceLine = false)
        {
            if (points.Count() < 2)
            {
                throw new Exception("Cannot create Curve By Points with less than two points.");
            }

            return new CurveByPoints(points.Select(x=>x.InternalReferencePoint), isReferenceLine);
        }