コード例 #1
0
        public void IsLineLike_Curve_CorrectlyIdentifiesLine()
        {
            var line = Line.ByStartPointEndPoint(
                Point.Origin(),
                Point.ByCoordinates(12, 3, 2));

            var revitCurve = line.ToRevitType(false);

            Assert.True(CurveUtils.IsLineLike(revitCurve));
        }
コード例 #2
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());
        }
コード例 #3
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());
        }
コード例 #4
0
        public void CurvesAreSimilar_Lines()
        {
            var a = Point.ByCoordinates(0, 0);
            var b = Point.ByCoordinates(1, 1);
            var c = Point.ByCoordinates(2, 2);

            var line1 = Line.ByStartPointEndPoint(a, b);
            var line2 = Line.ByStartPointEndPoint(b, a);
            var line3 = Line.ByStartPointEndPoint(a, c);

            var revitLine1 = line1.ToRevitType();
            var revitLine2 = line2.ToRevitType();
            var revitLine3 = line3.ToRevitType();

            Assert.True(CurveUtils.CurvesAreSimilar(revitLine1, revitLine1));
            Assert.False(CurveUtils.CurvesAreSimilar(revitLine1, revitLine2));
            Assert.False(CurveUtils.CurvesAreSimilar(revitLine1, revitLine3));
        }