tool used to draw line
示例#1
0
        private void GetChordPoints(LineTool chord, CurveArray curves, Autodesk.Revit.Creation.Application createApp)
        {
            //get coordinates of top chord from lineTool
            for (int i = 0; i < chord.Points.Count - 1; i++)
            {
                Point point  = (Point)chord.Points[i];
                Point point2 = (Point)chord.Points[i + 1];

                Autodesk.Revit.DB.XYZ xyz  = new Autodesk.Revit.DB.XYZ(point.X, point.Y, 0);
                Autodesk.Revit.DB.XYZ xyz2 = new Autodesk.Revit.DB.XYZ(point2.X, point2.Y, 0);

                Vector4 v1 = new Vector4(xyz);
                Vector4 v2 = new Vector4(xyz2);

                v1 = m_restoreMatrix.Transform(v1);
                v2 = m_restoreMatrix.Transform(v2);

                try
                {
                    Line line = Line.CreateBound(
                        new Autodesk.Revit.DB.XYZ(v1.X, v1.Y, v1.Z), new Autodesk.Revit.DB.XYZ(v2.X, v2.Y, v2.Z));
                    curves.Append(line);
                }
                catch (System.ArgumentException)
                {
                    TaskDialog.Show("Revit",
                                    "The start point and the end point of the line are too close, please re-draw it.");
                    ClearChords();
                }
            }
        }
示例#2
0
        Autodesk.Revit.DB.XYZ startLocation = null; //store the start point of truss location

        #endregion Fields

        #region Constructors

        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="truss">new created truss object in Revit</param>
        public TrussGeometry(Autodesk.Revit.DB.Structure.Truss truss, ExternalCommandData commandData)
        {
            m_commandData = commandData;
            m_topChord = new LineTool();
            m_bottomChord = new LineTool();
            m_truss = truss;
            m_graphicsPaths = new ArrayList();
            GetTrussGeometryInfo();
        }
示例#3
0
        Autodesk.Revit.DB.XYZ endLocation = null;   //store the end point of truss location

        #endregion

        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="truss">new created truss object in Revit</param>
        public TrussGeometry(Autodesk.Revit.DB.Structure.Truss truss, ExternalCommandData commandData)
        {
            m_commandData   = commandData;
            m_topChord      = new LineTool();
            m_bottomChord   = new LineTool();
            m_truss         = truss;
            m_graphicsPaths = new ArrayList();
            GetTrussGeometryInfo();
        }
示例#4
0
        private void GetChordPoints(LineTool chord, CurveArray curves, Autodesk.Revit.Creation.Application createApp)
        {
            //get coordinates of top chord from lineTool
            for (int i = 0; i < chord.Points.Count - 1; i++)
            {
                Point point = (Point)chord.Points[i];
                Point point2 = (Point)chord.Points[i + 1];

                Autodesk.Revit.DB.XYZ xyz = new Autodesk.Revit.DB.XYZ (point.X, point.Y, 0);
                Autodesk.Revit.DB.XYZ xyz2 = new Autodesk.Revit.DB.XYZ (point2.X, point2.Y, 0);

                Vector4 v1 = new Vector4(xyz);
                Vector4 v2 = new Vector4(xyz2);

                v1 = m_restoreMatrix.Transform(v1);
                v2 = m_restoreMatrix.Transform(v2);

                try
                {
                    Line line = createApp.NewLineBound(
                        new Autodesk.Revit.DB.XYZ (v1.X, v1.Y, v1.Z), new Autodesk.Revit.DB.XYZ (v2.X, v2.Y, v2.Z));
                    curves.Append(line);
                }
                catch (System.ArgumentException)
                {
                    MessageBox.Show(
                        "The start point and the end point of the line are too close, please re-draw it.");
                    ClearChords();
                }
            }
        }