Exemple #1
0
        /// <summary>
        /// Implement this method as an external command for Revit.
        /// </summary>
        /// <param name="commandData">An object that is passed to the external application
        /// which contains data related to the command,
        /// such as the application object and active view.</param>
        /// <param name="message">A message that can be set by the external application
        /// which will be displayed if a failure or cancellation is returned by
        /// the external command.</param>
        /// <param name="elements">A set of elements to which the external application
        /// can add elements that are to be highlighted in case of failure or cancellation.</param>
        /// <returns>Return the status of the external command.
        /// A result of Succeeded means that the API external method functioned as expected.
        /// Cancelled can be used to signify that the user cancelled the external operation
        /// at some point. Failure should be returned if the application is unable to proceed with
        /// the operation.</returns>
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            Autodesk.Revit.ApplicationServices.Application app = commandData.Application.Application;
            Document doc = commandData.Application.ActiveUIDocument.Document;

            Transaction transaction = new Transaction(doc, "PointsParabola");

            transaction.Start();
            int    pnt_ctr = 0;
            double xctr    = 0;
            XYZ    xyz     = new XYZ();
            ReferencePointArray rparray = new ReferencePointArray();

            while (pnt_ctr < 500)
            {
                xyz = new XYZ(xctr, 0, (Math.Cos(xctr)) * 10);
                ReferencePoint rp = doc.FamilyCreate.NewReferencePoint(xyz);
                rparray.Append(rp);
                xctr = xctr + 0.1;
                pnt_ctr++;
            }
            CurveByPoints curve = doc.FamilyCreate.NewCurveByPoints(rparray);

            transaction.Commit();

            return(Result.Succeeded);
        }
Exemple #2
0
        /// <summary>
        /// Implement this method as an external command for Revit.
        /// </summary>
        /// <param name="commandData">An object that is passed to the external application
        /// which contains data related to the command,
        /// such as the application object and active view.</param>
        /// <param name="message">A message that can be set by the external application
        /// which will be displayed if a failure or cancellation is returned by
        /// the external command.</param>
        /// <param name="elements">A set of elements to which the external application
        /// can add elements that are to be highlighted in case of failure or cancellation.</param>
        /// <returns>Return the status of the external command.
        /// A result of Succeeded means that the API external method functioned as expected.
        /// Cancelled can be used to signify that the user cancelled the external operation
        /// at some point. Failure should be returned if the application is unable to proceed with
        /// the operation.</returns>
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            Autodesk.Revit.ApplicationServices.Application app = commandData.Application.Application;
            Document doc = commandData.Application.ActiveUIDocument.Document;

            Transaction transaction = new Transaction(doc, "CatenaryCurve");

            transaction.Start();
            for (double scalingFactor = 1; scalingFactor <= 2; scalingFactor = scalingFactor + 0.5)
            {
                ReferencePointArray rpArray = new ReferencePointArray();
                for (double x = -5; x <= 5; x = x + 0.5)
                {
                    double y = scalingFactor * Math.Cosh(x / scalingFactor);
                    if (y < 50)
                    {
                        ReferencePoint rp = doc.FamilyCreate.NewReferencePoint(new XYZ(x, y, 0));
                        rpArray.Append(rp);
                    }
                }
                CurveByPoints cbp = doc.FamilyCreate.NewCurveByPoints(rpArray);
            }
            transaction.Commit();

            return(Result.Succeeded);
        }
        public void CurveByPoints()
        {
            var model = dynSettings.Controller.DynamoModel;

            string samplePath = Path.Combine(_testPath, @".\CurveByPoints.dyn");
            string testPath   = Path.GetFullPath(samplePath);

            model.Open(testPath);

            //cerate some points and wire them
            //to the selections
            ReferencePoint p1, p2, p3, p4;

            using (_trans = new Transaction(dynRevitSettings.Doc.Document))
            {
                _trans.Start("Create reference points for testing.");

                p1 = dynRevitSettings.Doc.Document.FamilyCreate.NewReferencePoint(new XYZ(1, 5, 12));
                p2 = dynRevitSettings.Doc.Document.FamilyCreate.NewReferencePoint(new XYZ(5, 1, 12));
                p3 = dynRevitSettings.Doc.Document.FamilyCreate.NewReferencePoint(new XYZ(12, 1, 5));
                p4 = dynRevitSettings.Doc.Document.FamilyCreate.NewReferencePoint(new XYZ(5, 12, 1));

                _trans.Commit();
            }

            var ptSelectNodes = dynSettings.Controller.DynamoModel.Nodes.Where(x => x is dynPointBySelection);

            if (!ptSelectNodes.Any())
            {
                Assert.Fail("Could not find point selection nodes in dynamo graph.");
            }

            ((dynPointBySelection)ptSelectNodes.ElementAt(0)).SelectedElement = p1;
            ((dynPointBySelection)ptSelectNodes.ElementAt(1)).SelectedElement = p2;
            ((dynPointBySelection)ptSelectNodes.ElementAt(2)).SelectedElement = p3;
            ((dynPointBySelection)ptSelectNodes.ElementAt(3)).SelectedElement = p4;

            dynSettings.Controller.RunExpression(true);

            FilteredElementCollector fec = new FilteredElementCollector(dynRevitSettings.Doc.Document);

            fec.OfClass(typeof(CurveElement));

            Assert.AreEqual(fec.ToElements().Count(), 1);

            CurveByPoints mc = (CurveByPoints)fec.ToElements().ElementAt(0);

            Assert.IsTrue(mc.IsReferenceLine);

            //now flip the switch for creating a reference curve
            var boolNode = dynSettings.Controller.DynamoModel.Nodes.Where(x => x is dynBoolSelector).First();

            ((dynBasicInteractive <bool>)boolNode).Value = false;

            dynSettings.Controller.RunExpression(true);
            Assert.AreEqual(fec.ToElements().Count(), 1);

            mc = (CurveByPoints)fec.ToElements().ElementAt(0);
            Assert.IsFalse(mc.IsReferenceLine);
        }
Exemple #4
0
        public void ByReferencePoints_Mutation()
        {
            ElementBinder.IsEnabled = false;

            var p1 = ReferencePoint.ByCoordinates(0, 0, 0);
            var p2 = ReferencePoint.ByCoordinates(1, 1, 1);
            var p3 = ReferencePoint.ByCoordinates(2, 2, 2);

            Assert.NotNull(p1);
            Assert.NotNull(p2);
            Assert.NotNull(p3);

            ElementBinder.IsEnabled = true;

            var curveByPoints = CurveByPoints.ByReferencePoints(new List <ReferencePoint> {
                p1, p2, p3
            }.ToArray());

            Assert.NotNull(curveByPoints);

            var curveRef = curveByPoints.ElementCurveReference;

            Assert.NotNull(curveRef);

            var p4 = ReferencePoint.ByCoordinates(3, 3, 3);

            curveByPoints = CurveByPoints.ByReferencePoints(new List <ReferencePoint> {
                p1, p2, p4
            }.ToArray());
            Assert.NotNull(curveByPoints);
        }
Exemple #5
0
        /// <summary>
        /// Implement this method as an external command for Revit.
        /// </summary>
        /// <param name="commandData">An object that is passed to the external application
        /// which contains data related to the command,
        /// such as the application object and active view.</param>
        /// <param name="message">A message that can be set by the external application
        /// which will be displayed if a failure or cancellation is returned by
        /// the external command.</param>
        /// <param name="elements">A set of elements to which the external application
        /// can add elements that are to be highlighted in case of failure or cancellation.</param>
        /// <returns>Return the status of the external command.
        /// A result of Succeeded means that the API external method functioned as expected.
        /// Cancelled can be used to signify that the user cancelled the external operation
        /// at some point. Failure should be returned if the application is unable to proceed with
        /// the operation.</returns>
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            ExternalCommandData cdata = commandData;

            Autodesk.Revit.ApplicationServices.Application app = commandData.Application.Application;
            Document            doc     = commandData.Application.ActiveUIDocument.Document;
            XYZ                 xyz     = new XYZ();
            ReferenceArrayArray refArAr = new ReferenceArrayArray();
            int                 x       = 0;
            double              z       = 0;

            while (x < 800)
            {
                ReferencePointArray rpAr = new ReferencePointArray();
                int y = 0;
                while (y < 800)
                {
                    z   = 50 * (Math.Cos((Math.PI / 180) * x) + Math.Cos((Math.PI / 180) * y));
                    xyz = app.Create.NewXYZ(x, y, z);
                    ReferencePoint rp = doc.FamilyCreate.NewReferencePoint(xyz);
                    rpAr.Append(rp);
                    y = y + 40;
                }
                CurveByPoints  curve = doc.FamilyCreate.NewCurveByPoints(rpAr);
                ReferenceArray refAr = new ReferenceArray();
                refAr.Append(curve.GeometryCurve.Reference);
                refArAr.Append(refAr);
                x = x + 40;
            }
            Form form = doc.FamilyCreate.NewLoftForm(true, refArAr);

            return(Result.Succeeded);
        }
Exemple #6
0
        /// <summary>
        /// Creates a Reference Curve based on two Points
        /// </summary>
        /// <param name="doc">Active Document</param>
        /// <param name="point1">Point 1</param>
        /// <param name="point2">Point 2</param>
        /// <returns>Reference Line</returns>
        public static Reference CurveFromXYZ(Document doc, XYZ point1, XYZ point2)
        {
            ReferencePoint referencePoint1 = doc.FamilyCreate.NewReferencePoint(point1);
            ReferencePoint referencePoint2 = doc.FamilyCreate.NewReferencePoint(point2);

            ReferencePointArray referencePoints = new ReferencePointArray();

            referencePoints.Append(referencePoint1);
            referencePoints.Append(referencePoint2);

            CurveByPoints curve = doc.FamilyCreate.NewCurveByPoints(referencePoints);

            return(curve.GeometryCurve.Reference);
        }
Exemple #7
0
        public void CurvebyPointsEllipse()
        {
            string samplePath = Path.Combine(workingDirectory, @".\Curve\CurvebyPointsEllipse.dyn");
            string testPath   = Path.GetFullPath(samplePath);

            ViewModel.OpenCommand.Execute(testPath);

            RunCurrentModel();

            FilteredElementCollector fec = new FilteredElementCollector(DocumentManager.Instance.CurrentUIDocument.Document);

            fec.OfClass(typeof(CurveElement));

            Assert.AreEqual(fec.ToElements().Count(), 1);

            CurveByPoints mc = (CurveByPoints)fec.ToElements().ElementAt(0);
        }
Exemple #8
0
        public void ByReferencePoints_DuplicatePoints()
        {
            ElementBinder.IsEnabled = false;

            var p1 = ReferencePoint.ByCoordinates(0, 0, 0);
            var p2 = ReferencePoint.ByCoordinates(1, 1, 1);

            Assert.NotNull(p1);
            Assert.NotNull(p2);

            //ensure that the call to create a curve by points with
            //duplicate points is handled and a system exception is thrown
            Assert.Throws <Autodesk.Revit.Exceptions.ArgumentException>(
                () => CurveByPoints.ByReferencePoints(new List <ReferencePoint> {
                p1, p2, p2
            }.ToArray()));
        }
Exemple #9
0
        public void CurveByPoints()
        {
            var model = ViewModel.Model;

            string samplePath = Path.Combine(workingDirectory, @".\Curve\CurveByPoints.dyn");
            string testPath   = Path.GetFullPath(samplePath);

            ViewModel.OpenCommand.Execute(testPath);

            RunCurrentModel();

            //cerate some points and wire them
            //to the selections
            ReferencePoint p1, p2, p3, p4;

            using (var trans = new Transaction(DocumentManager.Instance.CurrentUIDocument.Document))
            {
                trans.Start("Create reference points for testing.");

                p1 = DocumentManager.Instance.CurrentUIDocument.Document.FamilyCreate.NewReferencePoint(new XYZ(1, 5, 12));
                p2 = DocumentManager.Instance.CurrentUIDocument.Document.FamilyCreate.NewReferencePoint(new XYZ(5, 1, 12));
                p3 = DocumentManager.Instance.CurrentUIDocument.Document.FamilyCreate.NewReferencePoint(new XYZ(12, 1, 5));
                p4 = DocumentManager.Instance.CurrentUIDocument.Document.FamilyCreate.NewReferencePoint(new XYZ(5, 12, 1));

                trans.Commit();
            }

            var ptSelectNodes = ViewModel.Model.CurrentWorkspace.Nodes.Where(x => x is DSModelElementSelection);

            if (!ptSelectNodes.Any())
            {
                Assert.Fail("Could not find point selection nodes in dynamo graph.");
            }

            ((DSModelElementSelection)ptSelectNodes.ElementAt(0)).UpdateSelection(new [] { p1 });;
            ((DSModelElementSelection)ptSelectNodes.ElementAt(1)).UpdateSelection(new [] { p2 });
            ((DSModelElementSelection)ptSelectNodes.ElementAt(2)).UpdateSelection(new [] { p3 });
            ((DSModelElementSelection)ptSelectNodes.ElementAt(3)).UpdateSelection(new [] { p4 });

            RunCurrentModel();

            FilteredElementCollector fec = new FilteredElementCollector(DocumentManager.Instance.CurrentUIDocument.Document);

            fec.OfClass(typeof(CurveElement));

            Assert.AreEqual(fec.ToElements().Count(), 1);

            CurveByPoints mc = (CurveByPoints)fec.ToElements().ElementAt(0);

            Assert.IsTrue(mc.IsReferenceLine);

            //now flip the switch for creating a reference curve
            var boolNode = ViewModel.Model.CurrentWorkspace.Nodes.Where(x => x is DSCoreNodesUI.BoolSelector).First();

            ((DSCoreNodesUI.BasicInteractive <bool>)boolNode).Value = false;

            RunCurrentModel();

            Assert.AreEqual(fec.ToElements().Count(), 1);

            mc = (CurveByPoints)fec.ToElements().ElementAt(0);
            Assert.IsFalse(mc.IsReferenceLine);
        }
Exemple #10
0
        public Result Execute(
            ExternalCommandData commandData,
            ref string message,
            ElementSet elements)
        {
            UIApplication app = commandData.Application;
            Document      doc = app.ActiveUIDocument.Document;

            if (!doc.IsFamilyDocument ||
                !doc.OwnerFamily.FamilyCategory.Name.Equals("Mass"))
            {
                message = "Please run this comand in a conceptual massing family document.";
                return(Result.Failed);
            }

            using (Transaction tx = new Transaction(doc))
            {
                tx.Start("Create Loft Form");

                FamilyItemFactory creator = doc.FamilyCreate;

                // Create profiles array
                ReferenceArrayArray ref_ar_ar = new ReferenceArrayArray();

                // Create first profile
                ReferenceArray ref_ar = new ReferenceArray();

                int           y     = 100;
                int           x     = 50;
                XYZ           pa    = new XYZ(-x, y, 0);
                XYZ           pb    = new XYZ(x, y, 0);
                XYZ           pc    = new XYZ(0, y + 10, 10);
                CurveByPoints curve = FormUtils.MakeCurve(creator, pa, pb, pc);
                ref_ar.Append(curve.GeometryCurve.Reference);
                ref_ar_ar.Append(ref_ar);

                // Create second profile
                ref_ar = new ReferenceArray();

                y     = 40;
                pa    = new XYZ(-x, y, 5);
                pb    = new XYZ(x, y, 5);
                pc    = new XYZ(0, y, 25);
                curve = FormUtils.MakeCurve(creator, pa, pb, pc);
                ref_ar.Append(curve.GeometryCurve.Reference);
                ref_ar_ar.Append(ref_ar);

                // Create third profile
                ref_ar = new ReferenceArray();

                y     = -20;
                pa    = new XYZ(-x, y, 0);
                pb    = new XYZ(x, y, 0);
                pc    = new XYZ(0, y, 15);
                curve = FormUtils.MakeCurve(creator, pa, pb, pc);
                ref_ar.Append(curve.GeometryCurve.Reference);
                ref_ar_ar.Append(ref_ar);

                // Create fourth profile
                ref_ar = new ReferenceArray();

                y     = -60;
                pa    = new XYZ(-x, y, 0);
                pb    = new XYZ(x, y, 0);
                pc    = new XYZ(0, y + 10, 20);
                curve = FormUtils.MakeCurve(creator, pa, pb, pc);
                ref_ar.Append(curve.GeometryCurve.Reference);
                ref_ar_ar.Append(ref_ar);

                Form form = creator.NewLoftForm(true, ref_ar_ar);
                tx.Commit();
            }
            return(Result.Succeeded);
        }
        private void Stream( ArrayList data, CurveByPoints curPts )
        {
            data.Add( new Snoop.Data.ClassSeparator( typeof( CurveByPoints ) ) );

              data.Add( new Snoop.Data.Bool( "Is reference line", curPts.IsReferenceLine ) );
              data.Add( new Snoop.Data.Enumerable( "Points", curPts.GetPoints() ) );
              data.Add( new Snoop.Data.String( "Reference type", curPts.ReferenceType.ToString() ) );
              data.Add( new Snoop.Data.Object( "Subcategory", curPts.Subcategory ) );
              data.Add( new Snoop.Data.Object( "Visibility", curPts.GetVisibility() ) );
              data.Add( new Snoop.Data.Bool( "Visible", curPts.Visible ) );
        }
Exemple #12
0
        //绘制模型线
        private void CreateCurve(XYZ startPoint, XYZ endPoint, XYZ normal1, XYZ normal2)
        {
            XYZ StartToEnd = new XYZ((endPoint - startPoint).X, (endPoint - startPoint).Y, 0);
            XYZ p_normal1  = new XYZ(normal1.X, normal1.Y, 0);
            XYZ p_normal2  = new XYZ(normal2.X, normal2.Y, 0);

            p_normal1 = p_normal1 / (Math.Sqrt(p_normal1.X * p_normal1.X + p_normal1.Y * p_normal1.Y));
            p_normal2 = p_normal2 / (Math.Sqrt(p_normal2.X * p_normal2.X + p_normal2.Y * p_normal2.Y));


            XYZ XoYprj_start = new XYZ(startPoint.X, startPoint.Y, 0);
            XYZ XoYprj_end   = new XYZ(endPoint.X, endPoint.Y, 0);

            //在起点、终点间插值,并在z=0平面上绘制NurbSpline曲线
            double[]    doubleArray    = { 1, 1, 1, 1, 1, 1 };
            IList <XYZ> controlPoints2 = new List <XYZ>();

            controlPoints2.Add(XoYprj_start);
            controlPoints2.Add(XoYprj_start + p_normal1 * mmToFeet(2000));
            controlPoints2.Add(XoYprj_start + p_normal1 * mmToFeet(4000));
            controlPoints2.Add(XoYprj_end + p_normal2 * mmToFeet(4000));
            controlPoints2.Add(XoYprj_end + p_normal2 * mmToFeet(2000));
            controlPoints2.Add(XoYprj_end);

            Curve nbLine = NurbSpline.Create(controlPoints2, doubleArray);


            //提取曲线上的拟合点,并在z轴方向插值拟合原曲线
            IList <XYZ> ptsOnCurve = nbLine.Tessellate();

            int ptCount = ptsOnCurve.Count;
            ReferencePointArray ptArr = new ReferencePointArray();

            for (int i = 0; i < ptCount; i++)
            {
                XYZ pt = ptsOnCurve[i];
                if (i < (ptCount - 1) / 8)
                {
                    ptArr.Append(m_familyCreator.NewReferencePoint(new XYZ(pt.X, pt.Y, startPoint.Z)));
                }
                else if (i > 7 * (ptCount - 1) / 8)
                {
                    ptArr.Append(m_familyCreator.NewReferencePoint(new XYZ(pt.X, pt.Y, endPoint.Z)));
                }
                else
                {
                    ptArr.Append(m_familyCreator.NewReferencePoint(new XYZ(pt.X, pt.Y, startPoint.Z + (i - (ptCount - 1) / 8) * (endPoint.Z - startPoint.Z) / (0.75 * (ptCount - 1)))));
                }
                //ReferencePoint p = m_familyCreator.NewReferencePoint(new XYZ(pt.X, pt.Y, startPoint.Z + i*(endPoint.Z - startPoint.Z)/ (ptCount - 1)));
                //ptArr.Append(p);
            }

            CurveByPoints curve = m_familyCreator.NewCurveByPoints(ptArr);

            curve.Visible = false;

            //创建放样平面并加入参照数组中
            int step = 8;//取step个点进行拟合
            ReferenceArrayArray refArr = new ReferenceArrayArray();

            for (int i = 0; i <= step; i++)
            {
                int position = i * (ptCount - 1) / step;

                //取起点截面及第二个截面作为参照平面
                if (i == 0)
                {
                    refArr.Append(CreatePlaneByPoint(ptArr.get_Item(position), ptArr.get_Item((i + 1) * (ptCount - 1) / step), (curve.GeometryCurve as HermiteSpline).Tangents[position], (curve.GeometryCurve as HermiteSpline).Tangents[((i + 1) * (ptCount - 1) / step)]));
                }
                //取终点截面及倒数第二个截面作为参照平面
                else if (i == step)
                {
                    refArr.Append(CreatePlaneByPoint(ptArr.get_Item(position), ptArr.get_Item((i - 1) * (ptCount - 1) / step), (curve.GeometryCurve as HermiteSpline).Tangents[position], (curve.GeometryCurve as HermiteSpline).Tangents[((i - 1) * (ptCount - 1) / step)]));
                }
                else
                {
                    refArr.Append(CreatePlaneByPoint(ptArr.get_Item(position), (curve.GeometryCurve as HermiteSpline).Tangents[position]));
                }
            }

            //创建放样实体
            m_familyCreator.NewLoftForm(true, refArr);
        }
Exemple #13
0
        private void CreateCurve(XYZ startPoint, XYZ endPoint, XYZ normal1, XYZ normal2)
        {
            XYZ StartToEnd = new XYZ((endPoint - startPoint).X, (endPoint - startPoint).Y, 0);
            XYZ p_normal1  = new XYZ(normal1.X, normal1.Y, 0);
            XYZ p_normal2  = new XYZ(normal2.X, normal2.Y, 0);

            /**
             * double sita1 = StartToEnd.AngleTo(p_normal1);
             * double sita2 = StartToEnd.AngleTo(p_normal2);
             * XYZ e1 = Math.Abs(((0.25 * StartToEnd).GetLength() * Math.Cos(sita1) / p_normal1.GetLength())) * p_normal1;
             * XYZ e2 = Math.Abs(((0.25 * StartToEnd).GetLength() * Math.Cos(sita2) / p_normal2.GetLength())) * p_normal2;
             *
             *
             * XYZ prePt1 = new XYZ(startPoint.X + e1.X, startPoint.Y + e1.Y, 0);
             * XYZ prePt2 = new XYZ(endPoint.X + e2.X, endPoint.Y + e2.Y, 0);
             */
            p_normal1 = p_normal1 / (Math.Sqrt(p_normal1.X * p_normal1.X + p_normal1.Y * p_normal1.Y));
            p_normal2 = p_normal2 / (Math.Sqrt(p_normal2.X * p_normal2.X + p_normal2.Y * p_normal2.Y));


            //在起点、终点间插值,绘制NurbSpline曲线
            double[]    doubleArray    = { 1, 1, 1, 1, 1, 1 };
            IList <XYZ> controlPoints2 = new List <XYZ>();

            /**
             * controlPoints2.Insert(0, new XYZ(startPoint.X, startPoint.Y, 0));
             * controlPoints2.Insert(1, prePt1);
             * //controlPoints2.Insert(2, new XYZ((startPoint.X + endPoint.X) / 2, (startPoint.Y + endPoint.Y) / 2, 0));
             * controlPoints2.Insert(2, prePt2);
             * controlPoints2.Insert(3, new XYZ(endPoint.X, endPoint.Y, 0));
             */

            controlPoints2.Add(startPoint);
            controlPoints2.Add(startPoint + p_normal1 * mmToFeet(2000));
            controlPoints2.Add(startPoint + p_normal1 * mmToFeet(4000));
            controlPoints2.Add(endPoint + p_normal2 * mmToFeet(4000));
            controlPoints2.Add(endPoint + p_normal2 * mmToFeet(2000));
            controlPoints2.Add(endPoint);

            Curve nbLine = NurbSpline.Create(controlPoints2, doubleArray);



            //提取曲线上的拟合点
            IList <XYZ> ptsOnCurve = nbLine.Tessellate();

            int ptCount = ptsOnCurve.Count;
            ReferencePointArray ptArr = new ReferencePointArray();

            for (int i = 0; i < ptCount; i++)
            {
                XYZ            pt = ptsOnCurve[i];
                ReferencePoint p  = m_familyCreator.NewReferencePoint(new XYZ(pt.X, pt.Y, startPoint.Z + i / (ptCount - 1) * (endPoint.Z - startPoint.Z)));
                ptArr.Append(p);
            }

            CurveByPoints curve = m_familyCreator.NewCurveByPoints(ptArr);

            curve.Visible = false;

            //创建放样平面并加入参照数组中
            int step = 16;//取4分点进行拟合
            ReferenceArrayArray refArr = new ReferenceArrayArray();

            for (int i = 0; i <= step; i++)
            {
                int position = i * (ptCount - 1) / step;
                if (i == 0)
                {
                    refArr.Append(CreatePlaneByPoint(ptArr.get_Item(position), normal1));
                }
                else if (i == ptArr.Size - 1)
                {
                    /**
                     * {
                     *  Plane plane = new Plane(normal2, ptArr.get_Item(position).Position);
                     *  Plane planeEx = new Plane(plane.XVec.CrossProduct(normal2),plane.YVec.CrossProduct(normal2),plane.Origin);
                     * }
                     */
                    refArr.Append(CreatePlaneByPoint(ptArr.get_Item(position), -normal2));
                }
                else
                {
                    refArr.Append(CreatePlaneByPoint(ptArr.get_Item(position), (curve.GeometryCurve as HermiteSpline).Tangents[position]));
                }
            }
            //创建放样实体
            m_familyCreator.NewLoftForm(true, refArr);
        }