public bool Draw(DatabaseToAcad block, ref List<PaperLayout> papers, bool atOrgLoc = false)
 {
     if (atOrgLoc)
     {
         for (int i = 0; i < blocks.Count; i++)
         {
             //Draw block at origin loc
         }
     }
     else
     {
         for (int i = 0; i < blocks.Count; i++)
         {
             //Draw block
         }
     }
     return true;
 }
        /// <summary>
        /// 通图标注:板宽和湿接缝的宽度标注
        /// </summary>
        internal void DimGeneralBuban(DatabaseToAcad block, TxLine endLine1, TxLine endLine2, List<TxLine> kxbLine, TxLine m_startLine2)
        {
            if (isDimItalia == false)
            {
                #region 正向标注板梁宽度
                //最好再偏移一个斜交角度造成的影响
                TxLine startLine2 = AcadAssist.OffsetLineToBoarder(m_startLine2, 0, endLine1, endLine2);
                Point3d pt1 = AcadAssist.ExtendLine(startLine2.EndPoint, startLine2.StartPoint, (m_glWidth2 * this.m_drawScale) + dimSideOffset * block.style.BlockScale + block.style.DimFirstLayer);
                Point3d pt2 = AcadAssist.ExtendLine(startLine2.StartPoint, startLine2.EndPoint, (m_glWidth1 * this.m_drawScale) + dimSideOffset * block.style.BlockScale + block.style.DimFirstLayer);
                startLine2 = new TxLine(pt1, pt2);

                Vector3d vectLine = startLine2.StartPoint.GetVectorTo(startLine2.EndPoint);
                Vector3d vectPer = vectLine.RotateBy(Math.PI * 0.5, Vector3d.ZAxis).GetNormal();
                //平移板宽尺寸后点(即标注点)
                List<Point3d> points1 = new List<Point3d>();//划板线左侧点
                List<Point3d> points2 = new List<Point3d>();//划板线右侧点
                //包括边线的线集合
                List<TxLine> tempLines = new List<TxLine>();
                tempLines.AddRange(kxbLine);
                tempLines.Add(new TxLine(endLine1.StartPoint, endLine2.StartPoint));
                tempLines.Add(new TxLine(endLine1.EndPoint, endLine2.EndPoint));
                for (int i = 0; i < tempLines.Count; i++)
                {
                    Point3d tempPoint1 = startLine2.GetClosestPointTo(tempLines[i].StartPoint, true);//求出垂足
                    double dist1 = tempPoint1.DistanceTo(tempLines[i].StartPoint);
                    Vector3d vect1 = tempPoint1.GetVectorTo(tempLines[i].StartPoint).GetNormal();
                    int flag1 = vectPer.IsEqualTo(vect1, new Tolerance(0.01, 0.01)) ? 1 : -1;

                    Point3d tempPoint2 = startLine2.GetClosestPointTo(tempLines[i].EndPoint, true);
                    double dist2 = tempPoint2.DistanceTo(tempLines[i].EndPoint);
                    Vector3d vect2 = tempPoint2.GetVectorTo(tempLines[i].EndPoint).GetNormal();
                    int flag2 = vectPer.IsEqualTo(vect2, new Tolerance(0.01, 0.01)) ? 1 : -1;

                    points1.Add(startLine2.StartPoint + flag1 * dist1 * vectPer);
                    points2.Add(startLine2.EndPoint + flag2 * dist2 * vectPer);
                }
                CompairPoint3dY compairY = new CompairPoint3dY();
                points1.Sort(compairY);
                points2.Sort(compairY);

                List<Point3d> breakPoint = new List<Point3d>();
                for (int i = 0; i < points1.Count - 1; i++)
                {
                    block.AddDimRotated(points1[i], points1[i + 1], +block.style.DimFirstLayer, 0, "BL");
                    block.AddDimRotated(points2[i], points2[i + 1], -block.style.DimFirstLayer, 0, "BR");
                }

                //block.AddDimToPointsAlignedCombine(points1, +block.style.DimFirstLayer, breakPoint, 1000 / m_drawScale);
                //block.AddDimToPointsAlignedCombine(points2, -block.style.DimFirstLayer, breakPoint, 1000 / m_drawScale);
                //左右侧竖向标注 -- 总尺寸标注
                //block.AddDimRotated(points1[0], points1[points1.Count - 1], +2.5 * block.style.DimFirstLayer, 0, CommonSimbel.ConvertToDimStr(points1[0].DistanceTo(points1[points1.Count - 1]) * 1000 / m_drawScale));
                //block.AddDimRotated(points2[0], points2[points2.Count - 1], -2.5 * block.style.DimFirstLayer, 0, CommonSimbel.ConvertToDimStr(points2[0].DistanceTo(points2[points2.Count - 1]) * 1000 / m_drawScale));
                //block.AddDimAligned(points1[0], points1[points1.Count - 1], +block.style.DimSecondLayer);
                //block.AddDimAligned(points2[0], points2[points2.Count - 1], -block.style.DimSecondLayer);

                #endregion
            }
            else
            {
                #region 斜向标注板梁宽度
                TxLine dimLineLeft = AcadAssist.GetOffsetLineToLeft(endLine1, +(IsDrawSupport ? 2.0 : 0.5) * block.style.DimFirstLayer);
                TxLine dimLineRight = AcadAssist.GetOffsetLineToLeft(endLine2, -(IsDrawSupport ? 2.0 : 0.5) * block.style.DimFirstLayer);

                //平移板宽尺寸后点(即标注点)
                List<Point3d> points1 = new List<Point3d>();//划板线左侧点
                List<Point3d> points2 = new List<Point3d>();//划板线右侧点
                //包括边线的线集合
                List<TxLine> tempLines = new List<TxLine>();
                tempLines.AddRange(kxbLine);
                tempLines.Add(new TxLine(endLine1.StartPoint, endLine2.StartPoint));
                tempLines.Add(new TxLine(endLine1.EndPoint, endLine2.EndPoint));
                for (int i = 0; i < tempLines.Count; i++)
                {
                    Point3d tempPoint1 = dimLineLeft.GetClosestPointTo(tempLines[i].StartPoint, true);//求出垂足
                    Point3d tempPoint2 = dimLineRight.GetClosestPointTo(tempLines[i].EndPoint, true);

                    points1.Add(tempPoint1);
                    points2.Add(tempPoint2);
                }
                CompairPoint3dY compairY = new CompairPoint3dY();
                points1.Sort(compairY);
                points2.Sort(compairY);

                List<Point3d> breakPoint = new List<Point3d>();
                for (int i = 0; i < points1.Count - 1; i++)
                {
                    block.AddDimRotated(points1[i], points1[i + 1], +block.style.DimFirstLayer, 0, "BL");
                    block.AddDimRotated(points2[i], points2[i + 1], -block.style.DimFirstLayer, 0, "BR");
                }
                //block.AddDimToPointsAlignedCombine(points1, +block.style.DimFirstLayer, breakPoint, 1000 / m_drawScale);
                //block.AddDimToPointsAlignedCombine(points2, -block.style.DimFirstLayer, breakPoint, 1000 / m_drawScale);
                //左右侧竖向标注 -- 总尺寸标注
                //block.AddDimRotated(points1[0], points1[points1.Count - 1], +block.style.DimSecondLayer, 0, CommonSimbel.ConvertToDimStr(points1[0].DistanceTo(points1[points1.Count - 1]) * 1000 / m_drawScale));
                //block.AddDimRotated(points2[0], points2[points2.Count - 1], -block.style.DimSecondLayer, 0, CommonSimbel.ConvertToDimStr(points2[0].DistanceTo(points2[points2.Count - 1]) * 1000 / m_drawScale));
                //block.AddDimAligned(points1[0], points1[points1.Count - 1], +block.style.DimSecondLayer);
                //block.AddDimAligned(points2[0], points2[points2.Count - 1], -block.style.DimSecondLayer);

                #endregion
            }
        }
        /// <summary>
        /// 1.布板线的长度标注和角度标注,2.板宽和湿接缝的宽度标注
        /// </summary>
        internal void DimBuban(DatabaseToAcad block, TxLine endLine1, TxLine endLine2, List<TxLine> kxbLine, TxLine m_startLine2)
        {
            for (int i = 0; i < kxbLine.Count; i++)
            {
                double dist = kxbLine[i].StartPoint.DistanceTo(kxbLine[i].EndPoint);
                double rotate = AcadAssist.AngleOnPlan(kxbLine[i].StartPoint.GetVectorTo(kxbLine[i].EndPoint), kxbLine[i]);
                //double rotate = kxbLine[i].StartPoint.GetVectorTo(kxbLine[i].EndPoint).AngleOnPlane(kxbLine[i].GetPlane());
                //空心板边线长度
                //string preString = (m_drawScale == 1) ? "3" : "0";
                //string text2String = String.Format("L={0:F" + preString + "}", dist * 1000 / m_drawScale);判断保留几位小数
                string text2String = String.Format("L={0}", CommonSimbel.ConvertToDimStr(dist * 1000 / m_drawScale));
                Point3d text2Point = kxbLine[i].GetPointAtDist(dist * 0.5);
                if (i % 2 == 0)
                {
                    block.AddText(text2Point, text2String, block.style.RealTextHeigth, rotate, CommonLayer.dimlayer, TxTextHorizontalMode.TextCenter, TxTextVerticalMode.TextTop);
                    //DBText dbText = (DBText)block.GetLastEntity();
                    //dbText.VerticalMode = TxTextVerticalMode.TextTop;
                    //dbText.AlignmentPoint = dbText.Position;
                }
                else
                {
                    block.AddText(text2Point, text2String, block.style.RealTextHeigth, rotate, CommonLayer.dimlayer, TxTextHorizontalMode.TextCenter, TxTextVerticalMode.TextBottom);
                }
            }

            if (isDimItalia == false)
            {
                #region 正向标注板梁宽度
                //最好再偏移一个斜交角度造成的影响
                TxLine startLine2 = AcadAssist.OffsetLineToBoarder(m_startLine2, 0, endLine1, endLine2);
                Point3d pt1 = AcadAssist.ExtendLine(startLine2.EndPoint, startLine2.StartPoint, (m_glWidth2 * this.m_drawScale) + dimSideOffset * block.style.BlockScale + block.style.DimFirstLayer);
                Point3d pt2 = AcadAssist.ExtendLine(startLine2.StartPoint, startLine2.EndPoint, (m_glWidth1 * this.m_drawScale) + dimSideOffset * block.style.BlockScale + block.style.DimFirstLayer);
                startLine2 = new TxLine(pt1, pt2);

                Vector3d vectLine = startLine2.StartPoint.GetVectorTo(startLine2.EndPoint);
                Vector3d vectPer = vectLine.RotateBy(Math.PI * 0.5, Vector3d.ZAxis).GetNormal();
                //平移板宽尺寸后点(即标注点)
                List<Point3d> points1 = new List<Point3d>();//划板线左侧点
                List<Point3d> points2 = new List<Point3d>();//划板线右侧点
                //包括边线的线集合
                List<TxLine> tempLines = new List<TxLine>();
                tempLines.AddRange(kxbLine);
                tempLines.Add(new TxLine(endLine1.StartPoint, endLine2.StartPoint));
                tempLines.Add(new TxLine(endLine1.EndPoint, endLine2.EndPoint));
                for (int i = 0; i < tempLines.Count; i++)
                {
                    Point3d tempPoint1 = startLine2.GetClosestPointTo(tempLines[i].StartPoint, true);//求出垂足
                    double dist1 = tempPoint1.DistanceTo(tempLines[i].StartPoint);
                    Vector3d vect1 = tempPoint1.GetVectorTo(tempLines[i].StartPoint).GetNormal();
                    int flag1 = vectPer.IsEqualTo(vect1, new Tolerance(0.01, 0.01)) ? 1 : -1;

                    Point3d tempPoint2 = startLine2.GetClosestPointTo(tempLines[i].EndPoint, true);
                    double dist2 = tempPoint2.DistanceTo(tempLines[i].EndPoint);
                    Vector3d vect2 = tempPoint2.GetVectorTo(tempLines[i].EndPoint).GetNormal();
                    int flag2 = vectPer.IsEqualTo(vect2, new Tolerance(0.01, 0.01)) ? 1 : -1;

                    points1.Add(startLine2.StartPoint + flag1 * dist1 * vectPer);
                    points2.Add(startLine2.EndPoint + flag2 * dist2 * vectPer);
                }
                CompairPoint3dY compairY = new CompairPoint3dY();
                points1.Sort(compairY);
                points2.Sort(compairY);

                List<Point3d> breakPoint = new List<Point3d>();
                block.AddDimToPointsAlignedCombine(points1, +block.style.DimFirstLayer, breakPoint, 1000 / m_drawScale);
                block.AddDimToPointsAlignedCombine(points2, -block.style.DimFirstLayer, breakPoint, 1000 / m_drawScale);
                //左右侧竖向标注 -- 总尺寸标注
                block.AddDimRotated(points1[0], points1[points1.Count - 1], +2.5 * block.style.DimFirstLayer, 0, CommonSimbel.ConvertToDimStr(points1[0].DistanceTo(points1[points1.Count - 1]) * 1000 / m_drawScale));
                block.AddDimRotated(points2[0], points2[points2.Count - 1], -2.5 * block.style.DimFirstLayer, 0, CommonSimbel.ConvertToDimStr(points2[0].DistanceTo(points2[points2.Count - 1]) * 1000 / m_drawScale));
                //block.AddDimAligned(points1[0], points1[points1.Count - 1], +block.style.DimSecondLayer);
                //block.AddDimAligned(points2[0], points2[points2.Count - 1], -block.style.DimSecondLayer);

                #endregion
            }
            else
            {
                #region 斜向标注板梁宽度
                TxLine dimLineLeft = AcadAssist.GetOffsetLineToLeft(endLine1, +(IsDrawSupport ? 2.0 : 0.5) * block.style.DimFirstLayer);
                TxLine dimLineRight = AcadAssist.GetOffsetLineToLeft(endLine2, -(IsDrawSupport ? 2.0 : 0.5) * block.style.DimFirstLayer);

                //平移板宽尺寸后点(即标注点)
                List<Point3d> points1 = new List<Point3d>();//划板线左侧点
                List<Point3d> points2 = new List<Point3d>();//划板线右侧点
                //包括边线的线集合
                List<TxLine> tempLines = new List<TxLine>();
                tempLines.AddRange(kxbLine);
                tempLines.Add(new TxLine(endLine1.StartPoint, endLine2.StartPoint));
                tempLines.Add(new TxLine(endLine1.EndPoint, endLine2.EndPoint));
                for (int i = 0; i < tempLines.Count; i++)
                {
                    Point3d tempPoint1 = dimLineLeft.GetClosestPointTo(tempLines[i].StartPoint, true);//求出垂足
                    Point3d tempPoint2 = dimLineRight.GetClosestPointTo(tempLines[i].EndPoint, true);

                    points1.Add(tempPoint1);
                    points2.Add(tempPoint2);
                }
                CompairPoint3dY compairY = new CompairPoint3dY();
                points1.Sort(compairY);
                points2.Sort(compairY);

                List<Point3d> breakPoint = new List<Point3d>();
                block.AddDimToPointsAlignedCombine(points1, +block.style.DimFirstLayer, breakPoint, 1000 / m_drawScale);
                block.AddDimToPointsAlignedCombine(points2, -block.style.DimFirstLayer, breakPoint, 1000 / m_drawScale);
                //左右侧竖向标注 -- 总尺寸标注
                block.AddDimRotated(points1[0], points1[points1.Count - 1], +block.style.DimSecondLayer, 0, CommonSimbel.ConvertToDimStr(points1[0].DistanceTo(points1[points1.Count - 1]) * 1000 / m_drawScale));
                block.AddDimRotated(points2[0], points2[points2.Count - 1], -block.style.DimSecondLayer, 0, CommonSimbel.ConvertToDimStr(points2[0].DistanceTo(points2[points2.Count - 1]) * 1000 / m_drawScale));
                //block.AddDimAligned(points1[0], points1[points1.Count - 1], +block.style.DimSecondLayer);
                //block.AddDimAligned(points2[0], points2[points2.Count - 1], -block.style.DimSecondLayer);

                #endregion
            }
        }
        /// <summary>
        /// 标注通图
        /// </summary>
        /// <param name="dbBlock"></param>
        public void DrawGeneral(DatabaseToAcad dbBlock)
        {
            List<Point3d> supportPointsL = new List<Point3d>();
            List<Point3d> supportPointsR = new List<Point3d>();
            this.block = dbBlock;

            this.DrawBeamSlab();

            if (IsDrawSupport)
                this.DrawSupportPoints();
            this.DimBeamSlabGeneral();

            //先选择在平移否则位置不对
            if (IsDrawHorizon)
            {
                block.TransformBy(Matrix3d.Rotation(-startLineAngle, Vector3d.ZAxis, milePoint1));
            }
            else
            {
                block.TransformBy(Matrix3d.Rotation(rotate1Angle, Vector3d.ZAxis, xPoint1));
            }
            Vector3d vectMove = -milePoint1.GetAsVector();
            block.MoveBlock(vectMove);
        }
        /// <summary>
        /// 无标注原位绘制,不转不移
        /// </summary>
        /// <param name="dbBlock"></param>
        public void DrawAtOrgLoc(DatabaseToAcad dbBlock)
        {
            List<Point3d> supportPointsL = new List<Point3d>();
            List<Point3d> supportPointsR = new List<Point3d>();
            this.block = dbBlock;
            this.DrawBeamSlab();

            block.TransformBy(Matrix3d.Rotation(rotate1Angle, Vector3d.ZAxis, xPoint1));
        }
        /// <summary>
        /// 基本绘图
        /// </summary>
        /// <param name="dbBlock"></param>
        public override void Draw(DatabaseToAcad dbBlock)
        {
            List<Point3d> supportPointsL = new List<Point3d>();
            List<Point3d> supportPointsR = new List<Point3d>();
            this.block = dbBlock;

            this.DrawBeamSlab();
            if (IsDrawSupport)
                this.DrawSupportPoints();
            if (IsDrawDimension)
                this.DimBeamSlab();

            //先选择在平移否则位置不对
            if (IsDrawHorizon)
            {
                //Vector3d vectRotate = m_startLine.StartPoint.GetVectorTo(m_startLine.EndPoint);
                //double angle = vectRotate.AngleOnPlane(m_startLine.GetPlane());
                block.TransformBy(Matrix3d.Rotation(-startLineAngle, Vector3d.ZAxis, milePoint1));
            }
            else
            {
                block.TransformBy(Matrix3d.Rotation(rotate1Angle, Vector3d.ZAxis, xPoint1));
            }
            Vector3d vectMove = -milePoint1.GetAsVector();
            block.MoveBlock(vectMove);
        }
        /// <summary>
        /// 绘制梁图
        /// </summary>
        private void DrawBeamSlab()
        {
            supportPointsL = new List<Point3d>();
            supportPointsR = new List<Point3d>();
            //---如果是调试位置,可以打开图块的外边框 IsDrawBlockBorder = true;

            if (user_curveZX == null || user_cvBoardUp == null || user_cvBoardDn == null || user_pierline1 == null || user_pierline2 == null)
            {
                System.Windows.Forms.MessageBox.Show("未选择线。");
                return;
            }

            xPoint1 = AcadAssist.GetIntersectionPoint(user_curveZX, user_pierline1);
            xPoint2 = AcadAssist.GetIntersectionPoint(user_curveZX, user_pierline2);
            Vector3d vectRotate1 = xPoint1.GetVectorTo(xPoint2);
            //double rotate1Angle = vectRotate1.AngleOnPlane(user_curveZX.GetPlane());
            rotate1Angle = AcadAssist.AngleOnPlan(vectRotate1, user_curveZX);

            curveZX2 = AcadAssist.ConvertToTxPolyline(user_curveZX);
            cvBoardUp2 = AcadAssist.ConvertToTxPolyline(user_cvBoardUp);
            cvBoardDn2 = AcadAssist.ConvertToTxPolyline(user_cvBoardDn);
            pierline12 = (TxLine)user_pierline1.Clone();
            pierline22 = (TxLine)user_pierline2.Clone();
            curveZX2.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1);
            cvBoardUp2.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1);
            cvBoardDn2.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1);
            pierline12.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1);
            pierline22.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1);

            m_storeCLines2 = new List<TxLine>();
            for (int i = 0; i < user_storedCLines.Count; i++)
            {
                m_storeCLines2.Add((TxLine)user_storedCLines[i].Clone());
                m_storeCLines2[i].TransformBy(Matrix3d.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1));
            }

            m_hgbLines2 = new List<TxLine>();
            for (int i = 0; i < user_hgbLines.Count; i++)
            {
                m_hgbLines2.Add((TxLine)user_hgbLines[i].Clone());
                m_hgbLines2[i].TransformBy(Matrix3d.Rotation(-rotate1Angle, Vector3d.ZAxis, xPoint1));
            }

            if (curveZX2.StartPoint.X > curveZX2.EndPoint.X)
                curveZX2 = AcadAssist.ReverseTxPolyline(curveZX2);

            if (cvBoardUp2.StartPoint.X > cvBoardUp2.EndPoint.X)
                cvBoardUp2 = AcadAssist.ReverseTxPolyline(cvBoardUp2);

            if (cvBoardDn2.StartPoint.X > cvBoardDn2.EndPoint.X)
                cvBoardDn2 = AcadAssist.ReverseTxPolyline(cvBoardDn2);

            if (pierline12.StartPoint.Y > pierline12.EndPoint.Y)
                pierline12 = AcadAssist.ReverseTxLine(pierline12);

            if (pierline22.StartPoint.Y > pierline22.EndPoint.Y)
                pierline22 = AcadAssist.ReverseTxLine(pierline22);

            try
            {
                #region 绘制总体构造信息  [道路设计线,伸缩缝中心线,桩号,墩号,墩位,板梁端部线]
                //-------------前面还有个中心线的相交-------不相交有没有处理过,是不是已经延长过了,不记得了;这个是新加上的----------
                List<Point3d> milePoints1 = AcadAssist.GetIntersectionPoints(curveZX2, pierline12);
                List<Point3d> milePoints2 = AcadAssist.GetIntersectionPoints(curveZX2, pierline22);
                if (milePoints1.Count == 0 || milePoints2.Count == 0) System.Windows.Forms.MessageBox.Show("分控线和桥梁边线没有交点");

                milePoint1 = AcadAssist.GetIntersectionPoint(curveZX2, pierline12);
                milePoint2 = AcadAssist.GetIntersectionPoint(curveZX2, pierline22);

                //伸缩缝中心线线转化为线段
                pierline1x = AcadAssist.LineToBorder(pierline12, cvBoardUp2, cvBoardDn2);
                pierline2x = AcadAssist.LineToBorder(pierline22, cvBoardUp2, cvBoardDn2);

                //道路设计线
                block.AddLine(pierline1x, CommonLayer.cenlayer);
                block.AddLine(pierline2x, CommonLayer.cenlayer);
                TxCurve centerLine = AcadAssist.CurveToBorder(curveZX2, pierline12, pierline22);
                Point3d centerLineMidPoint = centerLine.GetPointAtDist(centerLine.GetDistAtPoint(centerLine.EndPoint) * 0.7);
                Vector3d centerLineMidVect = AcadAssist.GetFirstDerivative(centerLine, centerLineMidPoint);
                centerLine = AcadAssist.ExtendCurve(centerLine, 8 * block.style.BlockScale);
                block.AddCurve(centerLine, CommonLayer.cenlayer);

                //板梁端部线   [伸缩缝附近横桥向端线]
                endLine1 = AcadAssist.OffsetLineToBoarder(pierline12, -m_glWidth1 * m_drawScale, cvBoardUp2, cvBoardDn2);
                endLine2 = AcadAssist.OffsetLineToBoarder(pierline22, +m_glWidth2 * m_drawScale, cvBoardUp2, cvBoardDn2);
                if (endLine1.StartPoint.Y > endLine1.EndPoint.Y) endLine1 = AcadAssist.ReverseTxLine(endLine1);
                if (endLine2.StartPoint.Y > endLine2.EndPoint.Y) endLine2 = AcadAssist.ReverseTxLine(endLine2);

                //空心板横桥向端线
                block.AddLine(endLine1, CommonLayer.gz1layer);
                block.AddLine(endLine2, CommonLayer.gz1layer);

                //转角---以后对齐,标注等都要用
                TxLine alignLine = new TxLine(AcadAssist.Mid(endLine1.StartPoint, endLine1.EndPoint), AcadAssist.Mid(endLine2.StartPoint, endLine2.EndPoint));
                Vector3d vectRotate = alignLine.StartPoint.GetVectorTo(alignLine.EndPoint);
                startLineAngle = AcadAssist.AngleOnPlan(vectRotate, alignLine);
                #endregion

                //最外侧板梁边线--------边板悬臂外边线
                cvBoardUpx = AcadAssist.CurveToBorder(cvBoardUp2, endLine1, endLine2);
                cvBoardDnx = AcadAssist.CurveToBorder(cvBoardDn2, endLine1, endLine2);
                block.AddCurve(cvBoardUpx, CommonLayer.gz1layer);
                block.AddCurve(cvBoardDnx, CommonLayer.gz1layer);

                //计算辅助点(去掉悬臂后的空心板边板外侧线的点)
                //  kxb_bb1_point1             kxb_bb1_point2
                //     -------------------------
                //     |                       |
                //     |                       |
                //     |                       |
                //     -------------------------
                //  kxb_bb2_point1             kxb_bb2_point2

                #region 初始板梁块数
                TxLine borderLineS = new TxLine(cvBoardUpx.StartPoint, cvBoardUpx.EndPoint);
                TxLine offsetBordS1 = AcadAssist.OffsetLineToBoarder(borderLineS, -m_initWsideLS * m_drawScale, endLine1, endLine2);
                TxLine offsetBordS2 = AcadAssist.OffsetLineToBoarder(borderLineS, -m_initWsideRS * m_drawScale, endLine1, endLine2);
                TxLine centerLineS1 = new TxLine(offsetBordS1.StartPoint, offsetBordS2.EndPoint);

                TxLine borderLineX = new TxLine(cvBoardDnx.StartPoint, cvBoardDnx.EndPoint);
                TxLine offsetBordX1 = AcadAssist.OffsetLineToBoarder(borderLineX, m_initWsideLX * m_drawScale, endLine1, endLine2);
                TxLine offsetBordX2 = AcadAssist.OffsetLineToBoarder(borderLineX, m_initWsideRX * m_drawScale, endLine1, endLine2);
                TxLine centerLineX1 = new TxLine(offsetBordX1.StartPoint, offsetBordX2.EndPoint);

                double distBorderL = centerLineS1.StartPoint.DistanceTo(centerLineX1.StartPoint);
                double distBorderR = centerLineS1.EndPoint.DistanceTo(centerLineX1.EndPoint);
                double Wone = m_initWone * m_drawScale;
                double Wsum = Math.Min(distBorderL, distBorderR) + Wone;
                double initWsjf2 = m_initWsjf * m_drawScale;
                boxCount = AcadAssist.CalBeamCountCombineSjf(Wsum, Wone, initWsjf2, Wone * 0.5);
                #endregion

                sideLines = new List<TxLine>();
                cenLines = new List<TxLine>();

                #region 定义梁中心线
                if (drawingMode == DrawingMode.AUTO)
                {
                    //箱梁划板[按照boxCount*(Wone+sjfW1/2)+Wone的原则]
                    sideLines.Clear();
                    cenLines.Clear();

                    List<Point3d> divPointL = AcadAssist.SplitLineByCount(centerLineX1.StartPoint, centerLineS1.StartPoint, boxCount - 1);
                    List<Point3d> divPointR = AcadAssist.SplitLineByCount(centerLineX1.EndPoint, centerLineS1.EndPoint, boxCount - 1);
                    for (int i = 0; i < divPointL.Count; i++)
                    {
                        cenLines.Add(new TxLine(divPointL[i], divPointR[i]));
                    }

                    for (int i = 0; i < cenLines.Count; i++)
                    {
                        sideLines.Add(AcadAssist.OffsetLineToBoarder(cenLines[i], -Wone * 0.5, endLine1, endLine2));
                        sideLines.Add(AcadAssist.OffsetLineToBoarder(cenLines[i], +Wone * 0.5, endLine1, endLine2));
                    }

                    //加上两个边梁d的中心线和内边线
                    cenLines.Add(centerLineX1);
                    cenLines.Add(centerLineS1);
                    sideLines.Add(AcadAssist.OffsetLineToBoarder(centerLineX1, +Wone * 0.5, endLine1, endLine2));
                    sideLines.Add(AcadAssist.OffsetLineToBoarder(centerLineS1, -Wone * 0.5, endLine1, endLine2));

                    if (isAdjustSJFW)
                    {
                        ///--------求出各湿接缝长度------------------
                        CompairTxLineStartY compairY1 = new CompairTxLineStartY();
                        sideLines.Sort(compairY1);
                        cenLines.Sort(compairY1);
                        List<double> sjfWidthBefore1 = new List<double>();//调整前湿接缝左宽度表
                        List<double> sjfWidthBefore2 = new List<double>();//调整前湿接缝右宽度表
                        int sjfCount = sideLines.Count / 2;//sidLine是梁边线(除边梁外边线)--数量是(中板数+1)*2==湿接缝数*2
                        for (int i = 0; i < sjfCount; i++)
                        {
                            double sjfWWW1 = sideLines[i * 2].StartPoint.DistanceTo(sideLines[i * 2 + 1].StartPoint);
                            double sjfWWW2 = sideLines[i * 2].EndPoint.DistanceTo(sideLines[i * 2 + 1].EndPoint);
                            sjfWidthBefore1.Add(sjfWWW1);
                            sjfWidthBefore2.Add(sjfWWW2);
                        }

                        double sjfWidth1Ave = MTL_Math.Math2.sum(sjfWidthBefore1) / sjfWidthBefore1.Count;
                        double sjfWidth2Ave = MTL_Math.Math2.sum(sjfWidthBefore2) / sjfWidthBefore2.Count;
                        List<double> adjustSjfW1 = new List<double>();//湿接缝左宽度调整量表
                        List<double> adjustSjfW2 = new List<double>();//湿接缝右宽度调整量表
                        for (int i = 0; i < sjfWidthBefore1.Count - 1; i++)
                        {
                            adjustSjfW1.Add(-(sjfWidthBefore1[i] - sjfWidth1Ave));
                            adjustSjfW2.Add(-(sjfWidthBefore1[i] - sjfWidth1Ave));
                        }
                        sideLines.Clear();
                        cenLines.Clear();

                        //-----自动均匀调整湿接缝的宽度-----------------
                        List<Point3d> divPointLx = this.AdjustSjfW(centerLineX1.StartPoint, centerLineS1.StartPoint, boxCount - 1, adjustSjfW1);
                        List<Point3d> divPointRx = this.AdjustSjfW(centerLineX1.EndPoint, centerLineS1.EndPoint, boxCount - 1, adjustSjfW2);
                        for (int i = 0; i < divPointL.Count; i++)
                        {
                            cenLines.Add(new TxLine(divPointLx[i], divPointRx[i]));
                        }

                        for (int i = 0; i < cenLines.Count; i++)
                        {
                            sideLines.Add(AcadAssist.OffsetLineToBoarder(cenLines[i], -Wone * 0.5, endLine1, endLine2));
                            sideLines.Add(AcadAssist.OffsetLineToBoarder(cenLines[i], +Wone * 0.5, endLine1, endLine2));
                        }
                        //加上两个边梁d的中心线和内边线
                        cenLines.Add(centerLineX1);
                        cenLines.Add(centerLineS1);
                        sideLines.Add(AcadAssist.OffsetLineToBoarder(centerLineX1, +Wone * 0.5, endLine1, endLine2));
                        sideLines.Add(AcadAssist.OffsetLineToBoarder(centerLineS1, -Wone * 0.5, endLine1, endLine2));
                    }
                }
                else if (drawingMode == DrawingMode.USER_CENTER)
                {
                    sideLines.Clear();
                    cenLines.Clear();
                    for (int i = 0; i < m_storeCLines2.Count; i++)
                    {
                        TxLine tempLine = AcadAssist.LineToBorder(m_storeCLines2[i], endLine1, endLine2);
                        cenLines.Add(tempLine);
                    }
                    CompairTxLineStartY compairY1 = new CompairTxLineStartY();
                    cenLines.Sort(compairY1);

                    //-----与前面自动确定中心线后形成的梁边线的代码相同--------------
                    for (int i = 0; i < cenLines.Count; i++)
                    {
                        if (i != 0)
                        {
                            sideLines.Add(AcadAssist.OffsetLineToBoarder(cenLines[i], -Wone * 0.5, endLine1, endLine2));
                        }
                        if (i != cenLines.Count - 1)
                        {
                            sideLines.Add(AcadAssist.OffsetLineToBoarder(cenLines[i], +Wone * 0.5, endLine1, endLine2));
                        }
                    }
                    //加上两个边梁d的中心线和内边线
                    //cenLines.Add(centerLineX1);
                    //cenLines.Add(centerLineS1);
                    //sideLines.Add(AcadAssist.OffsetLineToBoarder(centerLineX1, +Wone * 0.5, endLine1, endLine2));
                    //sideLines.Add(AcadAssist.OffsetLineToBoarder(centerLineS1, -Wone * 0.5, endLine1, endLine2));
                    //-----与前面自动确定中心线后形成的梁边线的代码相同--------------
                }
                else
                {
                    //箱梁划板[按照文字定义的梁宽和湿接缝宽]
                    sideLines.Clear();
                    //double offsetX1 = -distX1;
                    //double offsetX2 = -distX2;
                    //List<double> XwidthOffsetL = MTL_Math.ParseString.ParaseToDouble(widthOffsetL);
                    //List<double> XwidthOffsetR = MTL_Math.ParseString.ParaseToDouble(widthOffsetR);
                    //List<double> XwidthOffsetJfL = MTL_Math.ParseString.ParaseToDouble(widthOffsetSjfL);
                    //List<double> XwidthOffsetJfR = MTL_Math.ParseString.ParaseToDouble(widthOffsetSjfR);
                    //if ((XwidthOffsetL.Count != XwidthOffsetR.Count) || (XwidthOffsetL.Count != XwidthOffsetJfL.Count + 1)
                    //    || (XwidthOffsetR.Count != XwidthOffsetJfR.Count + 1))
                    //{
                    //    System.Windows.Forms.MessageBox.Show("板梁个数与湿接缝个数不一致,请修改数据");
                    //    return;
                    //}
                    //for (int i = 0; i < XwidthOffsetL.Count; i++)
                    //{
                    //    double beamWSumLeft = XwidthOffsetL[i];
                    //    double beamWSumRigt = XwidthOffsetR[i];

                    //    //偏移半块板的宽度---求出梁中心线
                    //    double beamWDnLeft = (i == 0) ? (beamWSumLeft - initWsideI2) : ((i == boxCount - 1) ? initWsideI2 : (beamWSumLeft * 0.5));
                    //    double beamWDnRigt = (i == 0) ? (beamWSumRigt - initWsideI2) : ((i == boxCount - 1) ? initWsideI2 : (beamWSumRigt * 0.5));
                    //    TxLine offsetLine1 = AcadAssist.OffsetLineToBoarder(startLine2, (offsetX1 + beamWDnLeft) , endLine1, endLine2);
                    //    TxLine offsetLine2 = AcadAssist.OffsetLineToBoarder(startLine2, (offsetX2 + beamWDnRigt) , endLine1, endLine2);
                    //    TxLine center1 = new TxLine(offsetLine1.StartPoint, offsetLine2.EndPoint);
                    //    if (i != boxCount - 1)
                    //        cenLines.Add(center1);

                    //    //再偏移半块板的宽度---求出梁上缘边线
                    //    double beamWUpLeft = beamWSumLeft - beamWDnLeft;
                    //    double beamWUpRigt = beamWSumRigt - beamWDnRigt;
                    //    TxLine offsetLine3 = AcadAssist.OffsetLineToBoarder(startLine2,( offsetX1 + beamWSumLeft ), endLine1, endLine2);
                    //    TxLine offsetLine4 = AcadAssist.OffsetLineToBoarder(startLine2, (offsetX2 + beamWSumRigt), endLine1, endLine2);
                    //    TxLine border1 = new TxLine(offsetLine3.StartPoint, offsetLine4.EndPoint);
                    //    if (i != boxCount - 1)
                    //        kxbLines.Add(border1);

                    //    offsetX1 += XwidthOffsetL[i];
                    //    offsetX2 += XwidthOffsetR[i];
                    //}
                }
                #endregion

                //中心线与边线排序
                CompairTxLineStartY compareY2 = new CompairTxLineStartY();
                sideLines.Sort(compareY2);
                cenLines.Sort(compareY2);

                //输出板边线
                for (int i = 0; i < sideLines.Count; i++)
                {
                    block.AddLine(sideLines[i], CommonLayer.gz1layer);
                }
                //定义横梁线
                List<TxLine> hlLines = new List<TxLine>();//横梁线
                if (this.isUserhgbCount == false)
                {
                    hlLines.AddRange(m_hgbLines2);
                }
                else
                {
                    //-----目前只在跨中加一道横隔板----
                    TxLine beamSideUpLine1 = new TxLine(cvBoardDnx.StartPoint, cvBoardDnx.EndPoint);
                    TxLine beamSideUpLine2 = new TxLine(cvBoardUpx.StartPoint, cvBoardUpx.EndPoint);
                    Point3d hlPoint1 = AcadAssist.Mid(beamSideUpLine1.StartPoint, beamSideUpLine1.EndPoint);
                    Point3d hlPoint2 = AcadAssist.Mid(beamSideUpLine2.StartPoint, beamSideUpLine2.EndPoint);
                    hlLines.Add(new TxLine(hlPoint1, hlPoint2));
                }

                #region 绘制板梁平面构造图
                //绘制小箱梁T梁构造平面[kxbLines不包含上下构造边线--因此要用加上边线的kxbLinesWithBorder]
                List<BeamBox> BeamBoxs = new List<BeamBox>();   //横向布置箱梁
                List<BeamT> beamTs = new List<BeamT>();         //横向布置箱梁
                List<TxCurve> kxbLinesWithBorder = new List<TxCurve>();
                kxbLinesWithBorder.Insert(0, cvBoardDnx);
                for (int i = 0; i < sideLines.Count; i++) kxbLinesWithBorder.Add(sideLines[i]);
                kxbLinesWithBorder.Add(cvBoardUpx);
                boxCountX = Convert.ToInt32(sideLines.Count / 2);
                for (int i = 0; i <= boxCountX; i++)
                {
                    TxLine curBeamCenterLine = cenLines[i];
                    TxCurve curBeamSideLineDn = kxbLinesWithBorder[i * 2];
                    TxCurve curBeamSideLineUp = kxbLinesWithBorder[i * 2 + 1];
                    Point3d beamStartPoint = curBeamCenterLine.StartPoint;

                    if (structType == BeamType.BEAMBOX)
                    {
                        BeamBox BeamBox = new BeamBox();
                        if (i == 0) BeamBox.type = BeamBase.BeamLocate.Right;
                        if (i == boxCountX) BeamBox.type = BeamBase.BeamLocate.Left;
                        BeamBox.SetLinePM(curBeamCenterLine, curBeamSideLineDn, curBeamSideLineUp, hlLines, m_drawScale);
                        if (isDrawBeam)
                        {
                            DatabaseToAcad blockBeamBox = new DatabaseToAcad(block.style.BlockScale / m_drawScale);
                            BeamBox.DrawPM(blockBeamBox);
                            blockBeamBox.TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamStartPoint));
                            //-----------原来是这句DimensionScale,现在换成了ResetDimensionScale
                            blockBeamBox.ResetDimensionScale(block.style.BlockScale);
                            //blockBeamBox.DimensionScale(m_drawScale);
                            block.Append(blockBeamBox);
                        }
                        else
                        {

                            DatabaseToAcad blockBeamBox = new DatabaseToAcad(block.style.BlockScale / m_drawScale);
                            //BeamBox.DrawCenterLine(blockBeamBox);
                            blockBeamBox.TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamStartPoint));
                            //-----------原来是这句DimensionScale,现在换成了ResetDimensionScale
                            blockBeamBox.ResetDimensionScale(block.style.BlockScale);
                            //blockBeamBox.DimensionScale(m_drawScale);
                            block.Append(blockBeamBox);
                        }
                        BeamBoxs.Add(BeamBox);
                    }
                    else if (structType == BeamType.BEAMT)
                    {
                        BeamT beamT = new BeamT();
                        if (i == 0) beamT.type = BeamBase.BeamLocate.Right;
                        if (i == boxCountX) beamT.type = BeamBase.BeamLocate.Left;
                        beamT.SetLinePM(curBeamCenterLine, curBeamSideLineDn, curBeamSideLineUp, hlLines, m_drawScale);
                        if (isDrawBeam)
                        {
                            DatabaseToAcad blockBeamT = new DatabaseToAcad(block.style.BlockScale / m_drawScale);
                            beamT.DrawPM(blockBeamT);
                            blockBeamT.TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamStartPoint));
                            //-----------原来是这句DimensionScale,现在换成了ResetDimensionScale
                            blockBeamT.ResetDimensionScale(block.style.BlockScale);
                            //blockBeamT.DimensionScale(m_drawScale);
                            block.Append(blockBeamT);
                        }
                        else
                        {
                            DatabaseToAcad blockBeamT = new DatabaseToAcad(block.style.BlockScale / m_drawScale);
                            //beamT.DrawCenterLine(blockBeamT);
                            beamT.TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamStartPoint));
                            //-----------原来是这句DimensionScale,现在换成了ResetDimensionScale
                            blockBeamT.ResetDimensionScale(block.style.BlockScale);
                            //blockBeamBox.DimensionScale(m_drawScale);
                            block.Append(blockBeamT);
                        }
                        beamTs.Add(beamT);
                    }
                    else
                    {
                        throw new System.Exception("未知上部结构类型。");
                    }
                }
                #endregion

                #region 湿接缝填充
                //桥面板湿接缝填充[kxbLines不包含上下构造边线]
                int kxbLineCount2 = sideLines.Count / 2;
                for (int i = 0; i < kxbLineCount2; i++)
                {
                    TxLine border1 = sideLines[i * 2 + 0];
                    TxLine border2 = sideLines[i * 2 + 1];

                    TxPolyline loopPolyline = new TxPolyline();
                    loopPolyline.AddVertexAt(0, new Point2d(border1.StartPoint.X, border1.StartPoint.Y), 0, 0, 0);
                    loopPolyline.AddVertexAt(0, new Point2d(border1.EndPoint.X, border1.EndPoint.Y), 0, 0, 0);
                    loopPolyline.AddVertexAt(0, new Point2d(border2.EndPoint.X, border2.EndPoint.Y), 0, 0, 0);
                    loopPolyline.AddVertexAt(0, new Point2d(border2.StartPoint.X, border2.StartPoint.Y), 0, 0, 0);
                    loopPolyline.AddVertexAt(0, new Point2d(border1.StartPoint.X, border1.StartPoint.Y), 0, 0, 0);

                    block.AddHatch(loopPolyline, 3 * block.style.BlockScale, CommonLayer.gz3layer);
                }
                //桥面板湿接缝填充
                #endregion

                #region 绘制湿接缝范围的横隔板
                //湿接缝横梁[START]
                if (isDrawBeam)
                {
                    DatabaseToAcad blockSjf = new DatabaseToAcad(block.style.BlockScale);
                    for (int j = 1; j < BeamBoxs.Count; j++)
                    {
                        List<TxLine> hlCenters1 = new List<TxLine>();
                        List<TxLine> hlLines1L = new List<TxLine>();
                        List<TxLine> hlLines1R = new List<TxLine>();
                        BeamBoxs[j - 1].GetHLLine(out hlCenters1, out hlLines1L, out hlLines1R);
                        for (int k = 0; k < hlCenters1.Count; k++)
                        {
                            hlCenters1[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, BeamBoxs[j - 1].StartPointX));
                            hlLines1L[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, BeamBoxs[j - 1].StartPointX));
                            hlLines1R[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, BeamBoxs[j - 1].StartPointX));
                        }

                        List<TxLine> hlCenters2 = new List<TxLine>();
                        List<TxLine> hlLines2L = new List<TxLine>();
                        List<TxLine> hlLines2R = new List<TxLine>();
                        BeamBoxs[j].GetHLLine(out hlCenters2, out hlLines2L, out hlLines2R);
                        for (int k = 0; k < hlCenters1.Count; k++)
                        {
                            hlCenters2[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, BeamBoxs[j].StartPointX));
                            hlLines2L[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, BeamBoxs[j].StartPointX));
                            hlLines2R[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, BeamBoxs[j].StartPointX));
                        }

                        for (int k = 0; k < hlCenters1.Count; k++)
                        {
                            blockSjf.AddLine(new TxLine(hlCenters1[k].EndPoint, hlCenters2[k].StartPoint), CommonLayer.cenlayer);
                        }
                        for (int k = 0; k < hlLines1L.Count; k++)
                        {
                            blockSjf.AddLine(new TxLine(hlLines1L[k].EndPoint, hlLines2L[k].StartPoint), CommonLayer.gz2layer);
                            blockSjf.AddLine(new TxLine(hlLines1R[k].EndPoint, hlLines2R[k].StartPoint), CommonLayer.gz2layer);
                        }
                    }
                    //T梁湿接缝
                    for (int j = 1; j < beamTs.Count; j++)
                    {
                        List<TxLine> hlCenters1 = new List<TxLine>();
                        List<TxLine> hlLines1L = new List<TxLine>();
                        List<TxLine> hlLines1R = new List<TxLine>();
                        beamTs[j - 1].GetHLLine(out hlCenters1, out hlLines1L, out hlLines1R);
                        for (int k = 0; k < hlCenters1.Count; k++)
                        {
                            hlCenters1[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamTs[j - 1].StartPointX));
                            hlLines1L[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamTs[j - 1].StartPointX));
                            hlLines1R[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamTs[j - 1].StartPointX));
                        }

                        List<TxLine> hlCenters2 = new List<TxLine>();
                        List<TxLine> hlLines2L = new List<TxLine>();
                        List<TxLine> hlLines2R = new List<TxLine>();
                        beamTs[j].GetHLLine(out hlCenters2, out hlLines2L, out hlLines2R);
                        for (int k = 0; k < hlCenters1.Count; k++)
                        {
                            hlCenters2[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamTs[j].StartPointX));
                            hlLines2L[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamTs[j].StartPointX));
                            hlLines2R[k].TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamTs[j].StartPointX));
                        }

                        for (int k = 0; k < hlCenters1.Count; k++)
                        {
                            blockSjf.AddLine(new TxLine(hlCenters1[k].EndPoint, hlCenters2[k].StartPoint), CommonLayer.cenlayer);
                        }
                        for (int k = 0; k < hlLines1L.Count; k++)
                        {
                            blockSjf.AddLine(new TxLine(hlLines1L[k].EndPoint, hlLines2L[k].StartPoint), CommonLayer.gz2layer);
                            blockSjf.AddLine(new TxLine(hlLines1R[k].EndPoint, hlLines2R[k].StartPoint), CommonLayer.gz2layer);
                        }
                    }
                    block.Append(blockSjf);
                }
                //湿接缝横梁[END]
                #endregion

                this.isDrawn = true;
            }
            catch
            {
                System.Windows.Forms.MessageBox.Show("绘图出错,请修改结构定义。" + "可能是结构边线是否合理。");
            }
        }
        /// <summary>
        /// 通图标注,需先绘制梁图
        /// </summary>
        private void DimBeamSlabGeneral()
        {
            if (!isDrawn)
                throw new Exception("尚未绘图");
            try
            {
                //绘制桩号
                block.AddMileStonePlan(milePoint1, curveZX2.GetFirstDerivative(milePoint1));
                block.AddMileStonePlan(milePoint2, curveZX2.GetFirstDerivative(milePoint2));

                //标注伸缩缝宽度--伸缩缝中心线到空心板边缘顺桥向距离
                Point3d dimPoint1 = pierline1x.GetPointAtDist(0);
                Vector3d dimPillarVect1 = pierline1x.StartPoint.GetVectorTo(pierline1x.EndPoint).GetNormal();
                Vector3d dimVect1 = dimPillarVect1.RotateBy(+Math.PI * 0.5, Vector3d.ZAxis);
                block.AddDimAligned(dimPoint1, dimPoint1 + dimVect1 * m_glWidth1 * m_drawScale, +0.5 * block.style.DimFirstLayer, 0, "s");
                Point3d dimPoint2 = pierline2x.GetPointAtDist(0);
                Vector3d dimPillarVect2 = pierline2x.StartPoint.GetVectorTo(pierline2x.EndPoint).GetNormal();
                Vector3d dimVect2 = dimPillarVect2.RotateBy(-Math.PI * 0.5, Vector3d.ZAxis);
                block.AddDimAligned(dimPoint2, dimPoint2 + dimVect2 * m_glWidth2 * m_drawScale, -0.5 * block.style.DimFirstLayer, 0, "s");

                //---墩号标注---[同济院才需要]
                if (true || CommonSimbel.CompanyLabel.Contains("同济"))
                {
                    block.AddMileStoneLM_EllipseText(dimPoint1, dimPoint1 - dimPillarVect1.MultiplyBy(2.5 * block.style.DimFirstLayer), "PL", "", "");
                    block.AddMileStoneLM_EllipseText(dimPoint2, dimPoint2 - dimPillarVect2.MultiplyBy(2.5 * block.style.DimFirstLayer), "PR", "", "");
                }

                //道路设计线
                TxCurve centerLine = AcadAssist.CurveToBorder(curveZX2, pierline12, pierline22);
                Point3d centerLineMidPoint = centerLine.GetPointAtDist(centerLine.GetDistAtPoint(centerLine.EndPoint) * 0.7);
                Vector3d centerLineMidVect = AcadAssist.GetFirstDerivative(centerLine, centerLineMidPoint);
                centerLine = AcadAssist.ExtendCurve(centerLine, 8 * block.style.BlockScale);
                block.AddCurve(centerLine, CommonLayer.cenlayer);
                block.AddTextDimAngle(centerLineMidPoint, "道路设计中心线", AcadAssist.AngleOnPlan(centerLineMidVect) * 180 / Math.PI + 45, block.style.DimFirstLayer, AcadAssist.AngleOnPlan(centerLineMidVect) * 180 / Math.PI);

                //转角---以后对齐,标注等都要用
                TxLine alignLine = new TxLine(AcadAssist.Mid(endLine1.StartPoint, endLine1.EndPoint), AcadAssist.Mid(endLine2.StartPoint, endLine2.EndPoint));
                Vector3d vectRotate = alignLine.StartPoint.GetVectorTo(alignLine.EndPoint);
                double startLineAngle = AcadAssist.AngleOnPlan(vectRotate, alignLine);
                //桩号
                double startLineAngle360 = startLineAngle * 180 / Math.PI;
                block.AddTextDimAngle(milePoint1, "分孔线桩号", startLineAngle360 - 135, 2 * block.style.DimFirstLayer, startLineAngle360 + 180);
                block.AddTextDimAngle(milePoint2, "分孔线桩号", startLineAngle360 - 045, 2 * block.style.DimFirstLayer, startLineAngle360);
                //前进方向箭头表示
                Point3d arrowTextPoint = milePoint2 + Vector3d.XAxis.MultiplyBy(20 * block.style.BlockScale) + Vector3d.XAxis.MultiplyBy(3 * block.style.BlockScale);
                block.AddDirectText(arrowTextPoint, alignLine.StartPoint.GetVectorTo(alignLine.EndPoint), "桩号前进方向", false);

                //计算辅助点(去掉悬臂后的空心板边板外侧线的点)
                //  kxb_bb1_point1             kxb_bb1_point2
                //     -------------------------
                //     |                       |
                //     |                       |
                //     |                       |
                //     -------------------------
                //  kxb_bb2_point1             kxb_bb2_point2

                ////转角---以后对齐,标注等都要用
                //Vector3d vectRotate = m_startLine2.StartPoint.GetVectorTo(m_startLine2.EndPoint);
                //double startLineAngle = vectRotate.AngleOnPlane(m_startLine2.GetPlane());

                //定义横梁线
                List<TxLine> hlLines = new List<TxLine>();//横梁线
                if (this.isUserhgbCount == false)
                {
                    hlLines.AddRange(m_hgbLines2);
                }
                else
                {
                    //-----目前只在跨中加一道横隔板----
                    TxLine beamSideUpLine1 = new TxLine(cvBoardDnx.StartPoint, cvBoardDnx.EndPoint);
                    TxLine beamSideUpLine2 = new TxLine(cvBoardUpx.StartPoint, cvBoardUpx.EndPoint);
                    Point3d hlPoint1 = AcadAssist.Mid(beamSideUpLine1.StartPoint, beamSideUpLine1.EndPoint);
                    Point3d hlPoint2 = AcadAssist.Mid(beamSideUpLine2.StartPoint, beamSideUpLine2.EndPoint);
                    hlLines.Add(new TxLine(hlPoint1, hlPoint2));
                }

                #region 绘制板梁平面构造图
                //绘制小箱梁T梁构造平面[kxbLines不包含上下构造边线--因此要用加上边线的kxbLinesWithBorder]
                List<BeamBox> BeamBoxs = new List<BeamBox>();   //横向布置箱梁
                List<BeamT> beamTs = new List<BeamT>();         //横向布置箱梁
                List<TxCurve> kxbLinesWithBorder = new List<TxCurve>();
                kxbLinesWithBorder.Insert(0, cvBoardDnx);
                for (int i = 0; i < sideLines.Count; i++) kxbLinesWithBorder.Add(sideLines[i]);
                kxbLinesWithBorder.Add(cvBoardUpx);
                int boxCountX = Convert.ToInt32(sideLines.Count / 2);
                for (int i = 0; i <= boxCountX; i++)
                {
                    TxLine curBeamCenterLine = cenLines[i];
                    TxCurve curBeamSideLineDn = kxbLinesWithBorder[i * 2];
                    TxCurve curBeamSideLineUp = kxbLinesWithBorder[i * 2 + 1];
                    Point3d beamStartPoint = curBeamCenterLine.StartPoint;

                    if (structType == BeamType.BEAMBOX)
                    {
                        BeamBox BeamBox = new BeamBox();
                        if (i == 0) BeamBox.type = BeamBase.BeamLocate.Right;
                        if (i == boxCountX) BeamBox.type = BeamBase.BeamLocate.Left;
                        BeamBox.SetLinePM(curBeamCenterLine, curBeamSideLineDn, curBeamSideLineUp, hlLines, m_drawScale);
                        if (isDrawBeam)
                        {
                            DatabaseToAcad blockBeamBox = new DatabaseToAcad(block.style.BlockScale / m_drawScale);
                            BeamBox.DrawPM(blockBeamBox);
                            blockBeamBox.TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamStartPoint));
                            //-----------原来是这句DimensionScale,现在换成了ResetDimensionScale
                            blockBeamBox.ResetDimensionScale(block.style.BlockScale);
                            //blockBeamBox.DimensionScale(m_drawScale);
                            block.Append(blockBeamBox);
                        }
                        else
                        {
                            DatabaseToAcad blockBeamBox = new DatabaseToAcad(block.style.BlockScale / m_drawScale);
                            BeamBox.DrawCenterLine(blockBeamBox);
                            blockBeamBox.TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamStartPoint));
                            //-----------原来是这句DimensionScale,现在换成了ResetDimensionScale
                            blockBeamBox.ResetDimensionScale(block.style.BlockScale);
                            //blockBeamBox.DimensionScale(m_drawScale);
                            block.Append(blockBeamBox);
                        }
                        BeamBoxs.Add(BeamBox);
                    }
                    else if (structType == BeamType.BEAMT)
                    {
                        BeamT beamT = new BeamT();
                        if (i == 0) beamT.type = BeamBase.BeamLocate.Right;
                        if (i == boxCountX) beamT.type = BeamBase.BeamLocate.Left;
                        beamT.SetLinePM(curBeamCenterLine, curBeamSideLineDn, curBeamSideLineUp, hlLines, m_drawScale);
                        if (isDrawBeam)
                        {
                            DatabaseToAcad blockBeamT = new DatabaseToAcad(block.style.BlockScale / m_drawScale);
                            beamT.DrawPM(blockBeamT);
                            blockBeamT.TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamStartPoint));
                            //-----------原来是这句DimensionScale,现在换成了ResetDimensionScale
                            blockBeamT.ResetDimensionScale(block.style.BlockScale);
                            //blockBeamT.DimensionScale(m_drawScale);
                            block.Append(blockBeamT);
                        }
                        else
                        {
                            DatabaseToAcad blockBeamT = new DatabaseToAcad(block.style.BlockScale / m_drawScale);
                            beamT.DrawCenterLine(blockBeamT);
                            beamT.TransformBy(Matrix3d.Scaling(0.001 * m_drawScale, beamStartPoint));
                            //-----------原来是这句DimensionScale,现在换成了ResetDimensionScale
                            blockBeamT.ResetDimensionScale(block.style.BlockScale);
                            //blockBeamBox.DimensionScale(m_drawScale);
                            block.Append(blockBeamT);
                        }
                        beamTs.Add(beamT);
                    }
                    else
                    {
                        throw new System.Exception("未知上部结构类型。");
                    }
                }
                //绘制小箱梁T梁构造平面
                #endregion

                #region 标注板梁宽度
                ///布板线的长度标注和角度标注, m_glWidth1, m_glWidth2
                alignLine2 = new TxLine(AcadAssist.Mid(endLine1.StartPoint, endLine1.EndPoint), AcadAssist.Mid(endLine2.StartPoint, endLine2.EndPoint));
                this.DimGeneralBuban(block, endLine1, endLine2, sideLines, alignLine2);
                #endregion

                #region 标注悬臂宽度
                //cvBoard1 -- 边板悬臂外边线(上侧)
                //sideBeamXbInside1 -- 边板悬臂根部(上侧)
                TxLine sideBeamXbInside1 = sideLines[sideLines.Count - 1];

                //cvBoard2 -- 边板悬臂外边线(下侧)
                //sideBeamXbInside2 -- 边板悬臂根部(下侧)
                TxLine sideBeamXbInside2 = sideLines[0];

                //如果桥梁外侧边线是圆弧或多义线则标注悬臂宽度
                if (AcadAssist.IsCurveLine(cvBoardUpx) == false && IsDrawDimension == true)
                {
                    //上边悬臂
                    //获得下边悬臂线
                    List<TxCurve> temp_Curve = new List<TxCurve>();
                    if (structType == BeamType.BEAMBOX)
                    {
                        temp_Curve.AddRange(BeamBoxs[BeamBoxs.Count - 1].GetXuanBiLine(true, true));
                        //转换为米单位
                        temp_Curve[0].TransformBy(Matrix3d.Scaling(0.001, BeamBoxs[BeamBoxs.Count - 1].StartPointX));//转换为米单位
                        temp_Curve[1].TransformBy(Matrix3d.Scaling(0.001, BeamBoxs[BeamBoxs.Count - 1].StartPointX));//转换为米单位
                    }
                    else if (structType == BeamType.BEAMT)
                    {
                        temp_Curve.AddRange(beamTs[beamTs.Count - 1].GetXuanBiLine(true));
                        //转换为米单位
                        temp_Curve[0].TransformBy(Matrix3d.Scaling(0.001, beamTs[beamTs.Count - 1].StartPointX));//转换为米单位
                        temp_Curve[1].TransformBy(Matrix3d.Scaling(0.001, beamTs[beamTs.Count - 1].StartPointX));//转换为米单位
                    }

                    TxPolyline temp_cvBoard_outer = AcadAssist.ConvertToTxPolyline(temp_Curve[0]);      //(TxCurve)cvBoardUpx.Clone();
                    TxLine temp_cvBoard_inner = new TxLine(temp_cvBoard_outer.StartPoint, temp_cvBoard_outer.EndPoint);
                    if (IsDimXb_ByBeamCenter) { temp_cvBoard_inner = new TxLine(temp_Curve[1].StartPoint, temp_Curve[1].EndPoint); }
                    ////偏移后标注
                    TxLine temp_innerLine_forMovePer = AcadAssist.CloneTxLine((TxLine)temp_Curve[1]);     //(TxLine)sideBeamXbInside1.Clone();
                    Vector3d moveVect2 = temp_innerLine_forMovePer.StartPoint.GetVectorTo(temp_innerLine_forMovePer.EndPoint).RotateBy(Math.PI * 0.5, Vector3d.ZAxis).GetNormal();
                    temp_cvBoard_outer.Displacement(moveVect2.MultiplyBy(dimUpOffset * block.style.DimFirstLayer));
                    temp_cvBoard_inner.Displacement(moveVect2.MultiplyBy(dimUpOffset * block.style.DimFirstLayer));
                    temp_innerLine_forMovePer.Displacement(moveVect2.MultiplyBy(dimUpOffset * block.style.DimFirstLayer));
                    ////标注

                    this.XuanBiWidth(block, temp_cvBoard_outer, temp_cvBoard_inner);
                    block.AddCurve(temp_cvBoard_outer, CommonLayer.gz1layer);
                    block.AddCurve(temp_cvBoard_inner, CommonLayer.gz1layer);
                    block.AddLine(temp_cvBoard_outer.StartPoint, temp_cvBoard_inner.StartPoint, CommonLayer.dimlayer);
                    block.AddLine(temp_cvBoard_outer.EndPoint, temp_cvBoard_inner.EndPoint, CommonLayer.dimlayer);

                }
                if (AcadAssist.IsCurveLine(cvBoardDnx) == false && IsDrawDimension == true)
                {
                    //下边悬臂
                    //获得下边悬臂线
                    List<TxCurve> temp_Curve = new List<TxCurve>();
                    if (structType == BeamType.BEAMBOX)
                    {
                        temp_Curve.AddRange(BeamBoxs[0].GetXuanBiLine(false, true));
                        temp_Curve[0].TransformBy(Matrix3d.Scaling(0.001, BeamBoxs[0].StartPointX));//转换为米单位
                        temp_Curve[1].TransformBy(Matrix3d.Scaling(0.001, BeamBoxs[0].StartPointX));//转换为米单位
                    }
                    else if (structType == BeamType.BEAMT)
                    {
                        temp_Curve.AddRange(beamTs[0].GetXuanBiLine(false));
                        temp_Curve[0].TransformBy(Matrix3d.Scaling(0.001, beamTs[0].StartPointX));//转换为米单位
                        temp_Curve[1].TransformBy(Matrix3d.Scaling(0.001, beamTs[0].StartPointX));//转换为米单位
                    }

                    TxCurve temp_cvBoard_outer = AcadAssist.CloneTxCurve(temp_Curve[0]);      //(TxCurve)cvBoardDnx.Clone();
                    TxLine temp_cvBoard_inner = new TxLine(temp_cvBoard_outer.StartPoint, temp_cvBoard_outer.EndPoint);
                    if (IsDimXb_ByBeamCenter) { temp_cvBoard_inner = new TxLine(temp_Curve[1].StartPoint, temp_Curve[1].EndPoint); }
                    //偏移后标注
                    TxLine temp_innerLine_forMovePer = AcadAssist.CloneTxLine((TxLine)temp_Curve[1]);     //(TxLine)sideBeamXbInside2.Clone();
                    Vector3d moveVect = temp_innerLine_forMovePer.StartPoint.GetVectorTo(temp_innerLine_forMovePer.EndPoint).RotateBy(Math.PI * 0.5, Vector3d.ZAxis).GetNormal();
                    temp_cvBoard_outer.TransformBy(Matrix3d.Displacement(moveVect.MultiplyBy(-dimDownOffset * block.style.DimFirstLayer)));
                    temp_cvBoard_inner.TransformBy(Matrix3d.Displacement(moveVect.MultiplyBy(-dimDownOffset * block.style.DimFirstLayer)));
                    temp_innerLine_forMovePer.TransformBy(Matrix3d.Displacement(moveVect.MultiplyBy(-dimDownOffset * block.style.DimFirstLayer)));
                    //标注
                    this.XuanBiWidth(block, temp_cvBoard_outer, temp_cvBoard_inner);//this.XuanBiWidth(block, temp_cvBoardExt, temp_insideLine);
                    block.AddCurve(temp_cvBoard_outer, CommonLayer.gz1layer);
                    block.AddCurve(temp_cvBoard_inner, CommonLayer.gz1layer);
                    block.AddLine(temp_cvBoard_outer.StartPoint, temp_cvBoard_inner.StartPoint, CommonLayer.dimlayer);
                    block.AddLine(temp_cvBoard_outer.EndPoint, temp_cvBoard_inner.EndPoint, CommonLayer.dimlayer);
                }
                #endregion

                #region 标注支座
                if (IsDrawSupport)
                {
                    if (isDimItalia == false)
                    {
                        #region 正向标注板梁宽度
                        //最好再偏移一个斜交角度造成的影响
                        TxLine startLine2 = AcadAssist.OffsetLineToBoarder(alignLine2, 0, endLine1, endLine2);
                        Point3d pt1 = AcadAssist.ExtendLine(startLine2.EndPoint, startLine2.StartPoint, (m_glWidth2 * this.m_drawScale) + dimSideOffset * block.style.BlockScale - 1 * block.style.DimFirstLayer);
                        Point3d pt2 = AcadAssist.ExtendLine(startLine2.StartPoint, startLine2.EndPoint, (m_glWidth1 * this.m_drawScale) + dimSideOffset * block.style.BlockScale - 1 * block.style.DimFirstLayer);
                        startLine2 = new TxLine(pt1, pt2);

                        Vector3d vectLine = startLine2.StartPoint.GetVectorTo(startLine2.EndPoint);
                        Vector3d vectPer = vectLine.RotateBy(Math.PI * 0.5, Vector3d.ZAxis).GetNormal();

                        ///----------------支座点加上边界点-----
                        List<Point3d> supportPointsL_Ext = new List<Point3d>();//划板线左侧点
                        List<Point3d> supportPointsR_Ext = new List<Point3d>();//划板线右侧点
                        supportPointsL_Ext.AddRange(supportPointsL);
                        supportPointsL_Ext.Add(supportLineL.StartPoint);
                        supportPointsL_Ext.Add(supportLineL.EndPoint);
                        supportPointsR_Ext.AddRange(supportPointsR);
                        supportPointsR_Ext.Add(supportLineR.StartPoint);
                        supportPointsR_Ext.Add(supportLineR.EndPoint);

                        //平移板宽尺寸后点(即标注点)
                        List<Point3d> dim_support_points1 = new List<Point3d>();//划板线左侧点
                        List<Point3d> dim_support_points2 = new List<Point3d>();//划板线右侧点

                        for (int i = 0; i < supportPointsL_Ext.Count; i++)
                        {
                            ///----------------计算结构线到中心线的投影垂直距离---再反算出标注点----------
                            Point3d tempPoint1 = startLine2.GetClosestPointTo(supportPointsL_Ext[i], true);//求出垂足
                            double dist1 = tempPoint1.DistanceTo(supportPointsL_Ext[i]);
                            Vector3d vect1 = tempPoint1.GetVectorTo(supportPointsL_Ext[i]).GetNormal();
                            int flag1 = vectPer.IsEqualTo(vect1, new Tolerance(0.01, 0.01)) ? 1 : -1;

                            dim_support_points1.Add(startLine2.StartPoint + flag1 * dist1 * vectPer);
                        }
                        for (int i = 0; i < supportPointsR_Ext.Count; i++)
                        {
                            ///----------------计算结构线到中心线的投影垂直距离---再反算出标注点----------
                            Point3d tempPoint2 = startLine2.GetClosestPointTo(supportPointsR_Ext[i], true);
                            double dist2 = tempPoint2.DistanceTo(supportPointsR_Ext[i]);
                            Vector3d vect2 = tempPoint2.GetVectorTo(supportPointsR_Ext[i]).GetNormal();
                            int flag2 = vectPer.IsEqualTo(vect2, new Tolerance(0.01, 0.01)) ? 1 : -1;

                            dim_support_points2.Add(startLine2.EndPoint + flag2 * dist2 * vectPer);
                        }
                        CompairPoint3dY compairY = new CompairPoint3dY();
                        dim_support_points1.Sort(compairY);
                        dim_support_points2.Sort(compairY);

                        List<Point3d> breakPoint = new List<Point3d>();
                        block.AddDimToPointsAlignedCombine(dim_support_points1, +block.style.DimFirstLayer, breakPoint, 1000 / m_drawScale);
                        block.AddDimToPointsAlignedCombine(dim_support_points2, -block.style.DimFirstLayer, breakPoint, 1000 / m_drawScale);
                        #endregion
                    }
                    else
                    {
                        #region 斜向标注板梁宽度
                        //平移板宽尺寸后点(即标注点)
                        List<Point3d> dim_support_points1 = new List<Point3d>();//划板线左侧点
                        List<Point3d> dim_support_points2 = new List<Point3d>();//划板线右侧点

                        dim_support_points1.AddRange(supportPointsL);
                        dim_support_points1.Add(supportLineL.StartPoint);
                        dim_support_points1.Add(supportLineL.EndPoint);
                        dim_support_points1.Sort(new CompairPoint3dY());

                        dim_support_points2.AddRange(supportPointsR);
                        dim_support_points2.Add(supportLineR.StartPoint);
                        dim_support_points2.Add(supportLineR.EndPoint);
                        dim_support_points2.Sort(new CompairPoint3dY());

                        double dim_support_offset1 = supportOffsetL * 0.001 / m_drawScale;
                        double dim_support_offset2 = supportOffsetR * 0.001 / m_drawScale;
                        List<Point3d> breakPoint = new List<Point3d>();
                        block.AddDimToPointsAlignedCombine(dim_support_points1, +dim_support_offset1 + block.style.DimFirstLayer, breakPoint, 1000 / m_drawScale, true);
                        block.AddDimToPointsAlignedCombine(dim_support_points2, -dim_support_offset2 - block.style.DimFirstLayer, breakPoint, 1000 / m_drawScale, true);
                        ////左右侧竖向标注 -- 总尺寸标注
                        //block.AddDimRotated(dim_support_points1[0], dim_support_points1[dim_support_points1.Count - 1], +dim_support_offset1 + block.style.DimSecondLayer, 0, CommonSimbel.ConvertToDimStr(dim_support_points1[0].DistanceTo(dim_support_points1[dim_support_points1.Count - 1]) * 1000 / m_drawScale));
                        //block.AddDimRotated(dim_support_points2[0], dim_support_points2[dim_support_points2.Count - 1], -dim_support_offset2 - block.style.DimSecondLayer, 0, CommonSimbel.ConvertToDimStr(dim_support_points2[0].DistanceTo(dim_support_points2[dim_support_points2.Count - 1]) * 1000 / m_drawScale));
                        #endregion
                    }
                }
                #endregion
            }
            catch
            {
                System.Windows.Forms.MessageBox.Show("绘图出错,请修改结构定义。" + "可能是结构边线是否合理。");
            }
        }
        public void DrawCenterLine(DatabaseToAcad block, string cenlineString)
        {
            List<TxCurve> cenlines = this.GetReal_CenterAndBorderCurve();
            TxCurve center2 = cenlines[0];
            TxCurve borderDn2 = cenlines[1];
            TxCurve borderUp2 = cenlines[2];

            TxLine borderLeft = new TxLine(borderDn2.StartPoint, borderUp2.StartPoint);
            TxLine borderRight = new TxLine(borderDn2.EndPoint, borderUp2.EndPoint);

            //腹板中心线
            //Curve centerLine = AcadAssist.TrimCurveGetFront(center2, AcadAssist.GetIntersectionPoint(center2, borderRight));
            TxCurve centerLine = AcadAssist.CloneTxCurve(center2);
            //if (CommonSimbel.lineTypeCENT != Autodesk.AutoCAD.DatabaseServices.ObjectId.Null) centerLine.LinetypeId = CommonSimbel.lineTypeCENT;
            block.AddCurve(centerLine, CommonSimbel.centLineType, CommonLayer.gz1layer);
            //中心线长度
            double Length = center2.GetDistAtPoint(center2.EndPoint);
            Point3d textPoint = center2.GetPointAtDist(Length * 0.5);
            Vector3d textVect = center2.GetFirstDerivative(textPoint);
            double textAngle = AcadAssist.AngleOnPlan(textVect, center2);
            if (cenlineString == "")
            {
                block.AddText(textPoint, String.Format("梁中心线 L={0}", CommonSimbel.ConvertToDimStr(Length)), block.style.RealTextHeigth * 1000, textAngle, CommonLayer.dimlayer, TxTextHorizontalMode.TextCenter, TxTextVerticalMode.TextBottom);
            }
            else
            {
                block.AddText(textPoint, String.Format(cenlineString, block.style.RealTextHeigth * 1000, textAngle, CommonLayer.dimlayer, TxTextHorizontalMode.TextCenter, TxTextVerticalMode.TextBottom);
            }

            ///中心线起点处角度标注
            Point3d anglePoint1 = center2.StartPoint;
            Vector3d curVectx1 = center2.GetFirstDerivative(anglePoint1).GetNormal();
            Vector3d vectHL = borderLeft.EndPoint.GetVectorTo(borderLeft.StartPoint).GetNormal();
            block.AddDimAngularFix(anglePoint1, anglePoint1 + curVectx1 * block.style.DimFirstLayer * 1000, anglePoint1 + vectHL * block.style.DimFirstLayer * 1000, block.style.DimFirstLayer * 1000);

            ///中心线终点处角度标注
            Point3d anglePoint2 = center2.EndPoint;
            Vector3d curVectx2 = center2.GetFirstDerivative(anglePoint2).GetNormal();
            Vector3d vectHR = borderRight.EndPoint.GetVectorTo(borderRight.StartPoint).GetNormal();
            block.AddDimAngularFix(anglePoint2, anglePoint2 - curVectx2 * block.style.DimFirstLayer * 1000, anglePoint2 + vectHR * block.style.DimFirstLayer * 1000, block.style.DimFirstLayer * 1000);
        }
        /// <summary>
        /// 标注悬臂宽度
        /// </summary>
        /// <param name="cv1"></param>
        /// <param name="line"></param>
        /// <returns></returns>
        internal void XuanBiWidth(DatabaseToAcad block, TxCurve cv1, TxLine line)
        {
            double lnLength = line.StartPoint.DistanceTo(line.EndPoint);
            int count = Convert.ToInt32(lnLength / shortLineDist);
            Vector3d vect = line.EndPoint.GetAsVector() - line.StartPoint.GetAsVector();
            vect = vect.GetNormal();
            Vector3d vectPer = vect.RotateBy(Math.PI * 0.5, Vector3d.ZAxis);

            double[] step = KXBMath.BJ4(lnLength, shortLineDist * m_drawScale, 0.5 * m_drawScale);
            double sumStep = 0;
            for (int i = 0; i < step.Length - 1; i++)
            {
                sumStep += step[i];
                Point3d lnPoint = line.GetPointAtDist(sumStep);
                TxXline xline = new TxXline();
                xline.BasePoint = lnPoint;
                xline.UnitDir = vectPer;

                List<Point3d> points = AcadAssist.GetIntersectionPoints(cv1, xline);
                if (points.Count == 0) continue;

                //Point3dCollection points = new Point3dCollection();
                //cv1.IntersectWith(xline, Intersect.OnBothOperands, points, 0, 0);
                //if (points.Count == 0) continue;

                TxLine shortline = new TxLine(lnPoint, points[0]);
                block.AddCurve(shortline, CommonLayer.dimlayer);

                Vector3d vectNorm = shortline.EndPoint.GetAsVector() - shortline.StartPoint.GetAsVector();
                double shortLineLength = shortline.StartPoint.DistanceTo(shortline.EndPoint);
                string textString = String.Format("{0}", CommonSimbel.ConvertToDimStr1(shortLineLength * 1000 / m_drawScale));
                double rotation = AcadAssist.AngleOnPlan(vectNorm, line);
                block.AddText(shortline.EndPoint, textString, block.style.RealTextHeigth, rotation, CommonLayer.dimlayer, TxTextHorizontalMode.TextLeft, TxTextVerticalMode.TextVerticalMid);

                //DBText dbText = new DBText();
                //dbText.Rotation = vectNorm.AngleOnPlane(line.GetPlane());
                //dbText.TextString = String.Format("{0:0}", shortLineLength * 1000 / m_drawScale);
                //dbText.Height = block.style.RealTextHeigth;
                //dbText.WidthFactor = 0.75;
                //dbText.VerticalMode = TxTextVerticalMode.TextVerticalMid;
                //dbText.Position = shortline.EndPoint;
                //dbText.AlignmentPoint = shortline.EndPoint;
                //dbText.TextStyleId = CommonSimbel.textStyleId;
                //dbText.Layer = CommonLayer.dimlayer;

                ////block.AddEntity(shortline);
                ////block.AddEntity(dbText);
            }

            //标注悬臂
            Point3d curvePoint = cv1.GetClosestPointTo(line.StartPoint, false);
            int upSideFlag = (curvePoint.Y < line.StartPoint.Y) ? 1 : -1;
            Point3d dimPoint1 = line.StartPoint + upSideFlag * vectPer * block.style.DimSecondLayer;
            Point3d dimPoint2 = line.EndPoint + upSideFlag * vectPer * block.style.DimSecondLayer;
            List<double> tempStep = new List<double>();
            tempStep.AddRange(step);
            block.AddDimToPointsAlignedCombine(dimPoint1, dimPoint2, upSideFlag * block.style.DimFirstLayer, tempStep, 1000 / m_drawScale);
        }
Beispiel #11
0
        public override void DrawDM(DatabaseToAcad block)
        {
            //                     WT1                 WT2
            //           2                     0                     3
            //           |-------------------------------------------|
            //           |     12   8                     9   13     |
            //          4|------------     6       7      -----------|5
            //                   \_ |   2|-/-------\-|3   | _/
            //                     \|    |/         \|    |/
            //                      \   4|           |5   /
            //                    10|    |           |    |11
            //                      |    |           |    |
            //                      |    |           |    |
            //                      |    |___________|    |
            //                      |   0             1   |
            //                      |---------------------|
            //                      6          1          7
            //                                WD

            List<Point3d> dmPoints = new List<Point3d>();
            MTL_Math.Array2.SetArray(dmPoints, 14);
            dmPoints[0] = new Point3d(DeckPoint.X, DeckPoint.Y + H, 0);
            dmPoints[1] = new Point3d(dmPoints[0].X, dmPoints[0].Y - H, 0);
            dmPoints[2] = new Point3d(dmPoints[0].X - WT1, dmPoints[0].Y - WT1 * iT, 0);
            dmPoints[3] = new Point3d(dmPoints[0].X + WT2, dmPoints[0].Y + WT2 * iT, 0);
            dmPoints[4] = new Point3d(dmPoints[2].X, dmPoints[2].Y - HT, 0);
            dmPoints[5] = new Point3d(dmPoints[3].X, dmPoints[3].Y - HT, 0);
            dmPoints[6] = new Point3d(dmPoints[0].X - WD * 0.5, dmPoints[0].Y - H, 0);
            dmPoints[7] = new Point3d(dmPoints[0].X + WD * 0.5, dmPoints[0].Y - H, 0);
            TxLine xlinef1 = new TxLine(dmPoints[6], new Point3d(dmPoints[6].X - H * 0.25, dmPoints[6].Y + H, 0));//左腹板外侧线
            TxLine xlinef2 = new TxLine(dmPoints[7], new Point3d(dmPoints[7].X + H * 0.25, dmPoints[7].Y + H, 0));//右腹板外侧线
            TxLine xlineJY = new TxLine(dmPoints[4] - Vector3d.YAxis * JYY, dmPoints[5] - Vector3d.YAxis * JYY);//顶板加腋处虚拟水平线
            //dmPoints[8] = AcadAssist.GetIntersectionPoint(xlinef1, new TxLine(dmPoints[4], dmPoints[5]));
            //dmPoints[9] = AcadAssist.GetIntersectionPoint(xlinef2, new TxLine(dmPoints[4], dmPoints[5]));
            //dmPoints[10] = AcadAssist.GetIntersectionPoint(xlinef1, xlineJY);
            //dmPoints[11] = AcadAssist.GetIntersectionPoint(xlinef2, xlineJY);
            dmPoints[8] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef1, new TxLine(dmPoints[4], dmPoints[5]));
            dmPoints[9] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef2, new TxLine(dmPoints[4], dmPoints[5]));
            dmPoints[10] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef1, xlineJY);
            dmPoints[11] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef2, xlineJY);

            dmPoints[12] = new Point3d(dmPoints[8].X - JYX, dmPoints[8].Y - JYX * iT, 0);
            dmPoints[13] = new Point3d(dmPoints[9].X + JYY, dmPoints[9].Y + JYX * iT, 0);

            List<Point3d> dmPoints2 = new List<Point3d>();
            MTL_Math.Array2.SetArray(dmPoints2, 8);
            dmPoints2[0] = new Point3d(dmPoints[6].X + WFb - HD * 0.25, dmPoints[6].Y + HD, 0);
            dmPoints2[1] = new Point3d(dmPoints[7].X - WFb + HD * 0.25, dmPoints[7].Y + HD, 0);
            TxLine xlinef3 = new TxLine(xlinef1.StartPoint + Vector3d.XAxis * WFb, xlinef1.EndPoint + Vector3d.XAxis * WFb);//左腹板内侧线
            TxLine xlinef4 = new TxLine(xlinef2.StartPoint - Vector3d.XAxis * WFb, xlinef2.EndPoint - Vector3d.XAxis * WFb);//左腹板内侧线
            ////dmPoints2[2] = AcadAssist.GetIntersectionPoint(xlinef3, new TxLine(dmPoints[4], dmPoints[5]));
            ////dmPoints2[3] = AcadAssist.GetIntersectionPoint(xlinef4, new TxLine(dmPoints[4], dmPoints[5]));
            ////dmPoints2[4] = AcadAssist.GetIntersectionPoint(xlinef3, xlineJY);
            ////dmPoints2[5] = AcadAssist.GetIntersectionPoint(xlinef4, xlineJY);
            dmPoints2[2] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef3, new TxLine(dmPoints[4], dmPoints[5]));
            dmPoints2[3] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef4, new TxLine(dmPoints[4], dmPoints[5]));
            dmPoints2[4] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef3, xlineJY);
            dmPoints2[5] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef4, xlineJY);

            double Point6X = Math.Abs(dmPoints2[4].X - dmPoints[0].X) - CTX;
            double Point7X = Math.Abs(dmPoints2[5].X - dmPoints[0].X) - CTX;
            dmPoints2[6] = new Point3d(dmPoints[0].X - Point6X, dmPoints[0].Y - Point6X * iT - HT, 0);
            dmPoints2[7] = new Point3d(dmPoints[0].X + Point7X, dmPoints[0].Y + Point7X * iT - HT, 0);
            //交通部的小箱梁处理倒角不一样,外侧倒角从交点向外偏移180,内侧倒角从下面点偏移150

            TxPolyline pline1 = new TxPolyline();
            pline1.AddVertexAt(0, new Point2d(dmPoints[2].X, dmPoints[2].Y), 0, 0, 0);
            pline1.AddVertexAt(1, new Point2d(dmPoints[3].X, dmPoints[3].Y), 0, 0, 0);
            pline1.AddVertexAt(2, new Point2d(dmPoints[5].X, dmPoints[5].Y), 0, 0, 0);
            pline1.AddVertexAt(3, new Point2d(dmPoints[13].X, dmPoints[13].Y), 0, 0, 0);
            pline1.AddVertexAt(4, new Point2d(dmPoints[11].X, dmPoints[11].Y), 0, 0, 0);
            pline1.AddVertexAt(5, new Point2d(dmPoints[7].X, dmPoints[7].Y), 0, 0, 0);
            pline1.AddVertexAt(6, new Point2d(dmPoints[6].X, dmPoints[6].Y), 0, 0, 0);
            pline1.AddVertexAt(7, new Point2d(dmPoints[10].X, dmPoints[10].Y), 0, 0, 0);
            pline1.AddVertexAt(8, new Point2d(dmPoints[12].X, dmPoints[12].Y), 0, 0, 0);
            pline1.AddVertexAt(9, new Point2d(dmPoints[4].X, dmPoints[4].Y), 0, 0, 0);
            pline1.AddVertexAt(10, new Point2d(dmPoints[2].X, dmPoints[2].Y), 0, 0, 0);

            TxPolyline pline2 = new TxPolyline();
            pline2.AddVertexAt(0, new Point2d(dmPoints2[6].X, dmPoints2[6].Y), 0, 0, 0);
            pline2.AddVertexAt(1, new Point2d(dmPoints2[7].X, dmPoints2[7].Y), 0, 0, 0);
            pline2.AddVertexAt(2, new Point2d(dmPoints2[5].X, dmPoints2[5].Y), 0, 0, 0);
            pline2.AddVertexAt(3, new Point2d(dmPoints2[1].X, dmPoints2[1].Y), 0, 0, 0);
            pline2.AddVertexAt(4, new Point2d(dmPoints2[0].X, dmPoints2[0].Y), 0, 0, 0);
            pline2.AddVertexAt(5, new Point2d(dmPoints2[4].X, dmPoints2[4].Y), 0, 0, 0);
            pline2.AddVertexAt(6, new Point2d(dmPoints2[6].X, dmPoints2[6].Y), 0, 0, 0);
            block.AddPolyline(pline1, CommonLayer.gz1layer);
            block.AddPolyline(pline2, CommonLayer.gz1layer);

            //绘制横隔板
            //double Hgb = H - 200;//横隔板高度(从顶板算起)
            List<Point3d> gbPoints = new List<Point3d>();
            MTL_Math.Array2.SetArray(gbPoints, 4);
            TxLine xlineGB = new TxLine(dmPoints[2] - Vector3d.YAxis * HGB, dmPoints[3] - Vector3d.YAxis * HGB);//横隔板处虚拟水平线
            gbPoints[0] = new Point3d(dmPoints[2].X, dmPoints[2].Y - HGB, 0);
            gbPoints[1] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef1, xlineGB);
            gbPoints[2] = new Point3d(dmPoints[3].X, dmPoints[3].Y - HGB, 0);
            gbPoints[3] = AcadAssist.GetIntersectionPoint_ExtLines(xlinef2, xlineGB);
            if (type == BeamLocate.Left || type == BeamLocate.Mid)
            {
                block.AddLine(dmPoints[5], gbPoints[2], CommonLayer.gz1layer);
                block.AddLine(gbPoints[2], gbPoints[3], CommonLayer.gz1layer);
            }
            if (type == BeamLocate.Right || type == BeamLocate.Mid)
            {
                block.AddLine(dmPoints[4], gbPoints[0], CommonLayer.gz1layer);
                block.AddLine(gbPoints[0], gbPoints[1], CommonLayer.gz1layer);
            }
        }
Beispiel #12
0
        public void DrawPM(DatabaseToAcad block)
        {
            //                1a                                            2a
            //                 /------------------/-/------------------------/
            //                /                3 / / 4                      /
            //             1e/------------------/ /------------------------/ 2e
            //              /                                             /
            //             /  3a  __/---------/ /---------------\    8a  /
            //          1d/  /---/ 5a        / /              6a \---/  /2d
            //           /  /  4a           / /                  7a /  /
            //         1/--/---------------/ /---------------------/--/
            //         /  /  4b           / /                7b   /  /
            //      1c/  /---\_ 5b    1a / / 2a          6b_/----/  /2c
            //       /  3b      \-------/ /---------------/    8b  /
            //      /                                             /
            //   1f/------------------/ /------------------------/2f
            //    /                 1/ /2                       /
            //   /------------------/-/------------------------/
            //  1b                                            2b

            TxCurve center2 = null;
            TxCurve borderDn2 = null;
            TxCurve borderUp2 = null;
            if (center == null)
            {
                center2 = new TxLine(new Point3d(0, 0, 0), new Point3d(L, 0, 0));
            }
            else
            {
                center2 = AcadAssist.CloneTxCurve(center);
            }
            if (borderDn == null)
            {
                borderDn2 = new TxLine(new Point3d(0, 0, 0), new Point3d(L, 0, 0));
            }
            else
            {
                borderDn2 = AcadAssist.CloneTxCurve(borderDn);
            }
            if (borderUp == null)
            {
                borderUp2 = new TxLine(new Point3d(0, 0, 0), new Point3d(L, 0, 0));
            }
            else
            {
                borderUp2 = AcadAssist.CloneTxCurve(borderUp);
            }

            TxLine borderLeft = new TxLine(borderDn2.StartPoint, borderUp2.StartPoint);
            TxLine borderRight = new TxLine(borderDn2.EndPoint, borderUp2.EndPoint);

            Vector3d vectCenterLine = center2.StartPoint.GetVectorTo(center2.EndPoint).GetNormal();
            Point3d ctPoint1 = center2.StartPoint;
            Point3d ctPoint1c = ctPoint1 + vectCenterLine.RotateBy(Math.PI * 0.5 + alf1, Vector3d.ZAxis) * (Wbox * 0.5 - WFbx) / Math.Cos(alf1);
            Point3d ctPoint1d = ctPoint1 - vectCenterLine.RotateBy(Math.PI * 0.5 + alf1, Vector3d.ZAxis) * (Wbox * 0.5 - WFbx) / Math.Cos(alf1);
            Point3d ctPoint1e = ctPoint1 + vectCenterLine.RotateBy(Math.PI * 0.5 + alf1, Vector3d.ZAxis) * (Wbox * 0.5) / Math.Cos(alf1);
            Point3d ctPoint1f = ctPoint1 - vectCenterLine.RotateBy(Math.PI * 0.5 + alf1, Vector3d.ZAxis) * (Wbox * 0.5) / Math.Cos(alf1);

            Point3d ctPoint2 = center2.EndPoint;
            Point3d ctPoint2c = ctPoint2 + vectCenterLine.RotateBy(Math.PI * 0.5 + alf2, Vector3d.ZAxis) * (Wbox * 0.5 - WFbx) / Math.Cos(alf2);
            Point3d ctPoint2d = ctPoint2 - vectCenterLine.RotateBy(Math.PI * 0.5 + alf2, Vector3d.ZAxis) * (Wbox * 0.5 - WFbx) / Math.Cos(alf2);
            Point3d ctPoint2e = ctPoint2 + vectCenterLine.RotateBy(Math.PI * 0.5 + alf2, Vector3d.ZAxis) * (Wbox * 0.5) / Math.Cos(alf2);
            Point3d ctPoint2f = ctPoint2 - vectCenterLine.RotateBy(Math.PI * 0.5 + alf2, Vector3d.ZAxis) * (Wbox * 0.5) / Math.Cos(alf2);

            Point3d ctPoint33 = center2.GetPointAtDist(Ln);
            Point3d ctPoint33a = ctPoint33 + vectCenterLine.RotateBy(Math.PI * 0.5 + alf1, Vector3d.ZAxis) * (Wbox * 0.5 - WFbx) / Math.Cos(alf1);
            Point3d ctPoint33b = ctPoint33 - vectCenterLine.RotateBy(Math.PI * 0.5 + alf1, Vector3d.ZAxis) * (Wbox * 0.5 - WFbx) / Math.Cos(alf1);
            Point3d ctPoint44 = center2.GetPointAtDist(Ln + Ld);
            Point3d ctPoint44a = ctPoint44 + vectCenterLine.RotateBy(Math.PI * 0.5 + alf1, Vector3d.ZAxis) * (Wbox * 0.5 - WFbx) / Math.Cos(alf1);
            Point3d ctPoint44b = ctPoint44 - vectCenterLine.RotateBy(Math.PI * 0.5 + alf1, Vector3d.ZAxis) * (Wbox * 0.5 - WFbx) / Math.Cos(alf1);
            Point3d ctPoint55 = center2.GetPointAtDist(Ln + Ld + Ldx);
            Point3d ctPoint55a = ctPoint55 + vectCenterLine.RotateBy(Math.PI * 0.5 + alf1, Vector3d.ZAxis) * (Wbox * 0.5 - WFb) / Math.Cos(alf1);
            Point3d ctPoint55b = ctPoint55 - vectCenterLine.RotateBy(Math.PI * 0.5 + alf1, Vector3d.ZAxis) * (Wbox * 0.5 - WFb) / Math.Cos(alf1);

            Point3d ctPoint8 = center2.GetPointAtDist(L - Ln);
            Point3d ctPoint8a = ctPoint8 + vectCenterLine.RotateBy(Math.PI * 0.5 + alf2, Vector3d.ZAxis) * (Wbox * 0.5 - WFbx) / Math.Cos(alf2);
            Point3d ctPoint8b = ctPoint8 - vectCenterLine.RotateBy(Math.PI * 0.5 + alf2, Vector3d.ZAxis) * (Wbox * 0.5 - WFbx) / Math.Cos(alf2);
            Point3d ctPoint7 = center2.GetPointAtDist(L - Ln - Ld);
            Point3d ctPoint7a = ctPoint7 + vectCenterLine.RotateBy(Math.PI * 0.5 + alf2, Vector3d.ZAxis) * (Wbox * 0.5 - WFbx) / Math.Cos(alf2);
            Point3d ctPoint7b = ctPoint7 - vectCenterLine.RotateBy(Math.PI * 0.5 + alf2, Vector3d.ZAxis) * (Wbox * 0.5 - WFbx) / Math.Cos(alf2);
            Point3d ctPoint6 = center2.GetPointAtDist(L - Ln - Ld - Ldx);
            Point3d ctPoint6a = ctPoint6 + vectCenterLine.RotateBy(Math.PI * 0.5 + alf2, Vector3d.ZAxis) * (Wbox * 0.5 - WFb) / Math.Cos(alf2);
            Point3d ctPoint6b = ctPoint6 - vectCenterLine.RotateBy(Math.PI * 0.5 + alf2, Vector3d.ZAxis) * (Wbox * 0.5 - WFb) / Math.Cos(alf2);

            //外轮廓
            block.AddCurve(center2, CommonLayer.cenlayer);
            //block.AddLine(borderDn2, CommonLayer.cenlayer);           //上下构造边线
            //block.AddLine(borderUp2, CommonLayer.cenlayer);           //上下构造边线
            block.AddLine(borderLeft, CommonLayer.cenlayer);            //左右构造边线
            block.AddLine(borderRight, CommonLayer.cenlayer);           //左右构造边线
            TxLine boxLineUp = new TxLine(ctPoint1e, ctPoint2e);
            TxLine boxLineDn = new TxLine(ctPoint1f, ctPoint2f);
            //block.AddLine(boxLineUp, CommonLayer.gz2layer);
            //block.AddLine(boxLineDn, CommonLayer.gz2layer);

            //内轮廓
            TxLine boxLineInBoxUp = new TxLine(ctPoint55a, ctPoint6a);
            TxLine boxLineInBoxDn = new TxLine(ctPoint55b, ctPoint6b);
            block.AddLine(ctPoint33a, ctPoint33b, CommonLayer.gz2layer);
            block.AddLine(ctPoint8a, ctPoint8b, CommonLayer.gz2layer);
            block.AddLine(ctPoint33a, ctPoint44a, CommonLayer.gz2layer);
            block.AddLine(ctPoint44a, ctPoint55a, CommonLayer.gz2layer);
            //block.AddLine(ctPoint55a, ctPoint6a, CommonLayer.gz2layer);
            block.AddLine(ctPoint6a, ctPoint7a, CommonLayer.gz2layer);
            block.AddLine(ctPoint7a, ctPoint8a, CommonLayer.gz2layer);

            block.AddLine(ctPoint33b, ctPoint44b, CommonLayer.gz2layer);
            block.AddLine(ctPoint44b, ctPoint55b, CommonLayer.gz2layer);
            //block.AddLine(ctPoint55b, ctPoint6b, CommonLayer.gz2layer);
            block.AddLine(ctPoint6b, ctPoint7b, CommonLayer.gz2layer);
            block.AddLine(ctPoint7b, ctPoint8b, CommonLayer.gz2layer);

            List<TxLine> hlCenters;
            List<TxLine> hlLinesL;
            List<TxLine> hlLinesR;
            this.GetHLLine(out hlCenters, out hlLinesL, out hlLinesR);

            //箱室外缘线
            List<Point3d> breakPointsUp = new List<Point3d>();
            List<Point3d> breakPointsDn = new List<Point3d>();
            breakPointsUp.Add(boxLineUp.StartPoint);
            breakPointsUp.Add(boxLineUp.EndPoint);
            breakPointsDn.Add(boxLineDn.StartPoint);
            breakPointsDn.Add(boxLineDn.EndPoint);
            for (int i = 0; i < hlLinesL.Count; i++)
            {
                Point3d tempUpPoint1 = AcadAssist.GetIntersectionPoint(boxLineUp, hlLinesL[i]);
                Point3d tempUpPoint2 = AcadAssist.GetIntersectionPoint(boxLineUp, hlLinesR[i]);
                breakPointsUp.Add(tempUpPoint1);
                breakPointsUp.Add(tempUpPoint2);

                Point3d tempDnPoint1 = AcadAssist.GetIntersectionPoint(boxLineDn, hlLinesL[i]);
                Point3d tempDnPoint2 = AcadAssist.GetIntersectionPoint(boxLineDn, hlLinesR[i]);
                breakPointsDn.Add(tempDnPoint1);
                breakPointsDn.Add(tempDnPoint2);
            }
            breakPointsUp.Sort(new CompairPoint3dX());
            breakPointsDn.Sort(new CompairPoint3dX());
            if (type == BeamLocate.Mid)
            {
                for (int i = 0; i < breakPointsUp.Count / 2; i++)
                {
                    block.AddLine(breakPointsUp[i * 2], breakPointsUp[i * 2 + 1], CommonLayer.gz2layer);
                }
                for (int i = 0; i < breakPointsDn.Count / 2; i++)
                {
                    block.AddLine(breakPointsDn[i * 2], breakPointsDn[i * 2 + 1], CommonLayer.gz2layer);
                }
            }
            else if (type == BeamLocate.Right)
            {
                block.AddLine(boxLineDn, CommonLayer.gz2layer);
                for (int i = 0; i < breakPointsUp.Count / 2; i++)
                {
                    block.AddLine(breakPointsUp[i * 2], breakPointsUp[i * 2 + 1], CommonLayer.gz2layer);
                }
            }
            else if (type == BeamLocate.Left)
            {
                block.AddLine(boxLineUp, CommonLayer.gz2layer);
                for (int i = 0; i < breakPointsDn.Count / 2; i++)
                {
                    block.AddLine(breakPointsDn[i * 2], breakPointsDn[i * 2 + 1], CommonLayer.gz2layer);
                }
            }

            //箱室内缘线
            List<Point3d> breakPointsInBoxUp = new List<Point3d>();
            List<Point3d> breakPointsInBoxDn = new List<Point3d>();
            breakPointsInBoxUp.Add(boxLineInBoxUp.StartPoint);
            breakPointsInBoxUp.Add(boxLineInBoxUp.EndPoint);
            breakPointsInBoxDn.Add(boxLineInBoxDn.StartPoint);
            breakPointsInBoxDn.Add(boxLineInBoxDn.EndPoint);
            for (int i = 1; i < hlLinesL.Count - 1; i++)
            {
                Point3d tempUpPoint1 = AcadAssist.GetIntersectionPoint(boxLineInBoxUp, hlLinesL[i]);
                Point3d tempUpPoint2 = AcadAssist.GetIntersectionPoint(boxLineInBoxUp, hlLinesR[i]);
                breakPointsInBoxUp.Add(tempUpPoint1);
                breakPointsInBoxUp.Add(tempUpPoint2);

                Point3d tempDnPoint1 = AcadAssist.GetIntersectionPoint(boxLineInBoxDn, hlLinesL[i]);
                Point3d tempDnPoint2 = AcadAssist.GetIntersectionPoint(boxLineInBoxDn, hlLinesR[i]);
                breakPointsInBoxDn.Add(tempDnPoint1);
                breakPointsInBoxDn.Add(tempDnPoint2);
            }
            breakPointsInBoxUp.Sort(new CompairPoint3dX());
            breakPointsInBoxDn.Sort(new CompairPoint3dX());
            for (int i = 0; i < breakPointsInBoxUp.Count / 2; i++)
            {
                block.AddLine(breakPointsInBoxUp[i * 2], breakPointsInBoxUp[i * 2 + 1], CommonLayer.gz2layer);
            }
            for (int i = 0; i < breakPointsInBoxDn.Count / 2; i++)
            {
                block.AddLine(breakPointsInBoxDn[i * 2], breakPointsInBoxDn[i * 2 + 1], CommonLayer.gz2layer);
            }
            //箱室内缘线

            //横梁线--考虑打断
            for (int i = 0; i < hlCenters.Count; i++)
                block.AddLine(hlCenters[i], CommonLayer.cenlayer);
            for (int i = 0; i < hlLinesL.Count; i++)
            {
                Point3d xPoint1 = AcadAssist.GetIntersectionPoint(boxLineDn, hlLinesL[i]);
                Point3d xPoint2 = AcadAssist.GetIntersectionPoint(boxLineDn, hlLinesR[i]);
                Point3d xPoint3 = AcadAssist.GetIntersectionPoint(boxLineUp, hlLinesL[i]);
                Point3d xPoint4 = AcadAssist.GetIntersectionPoint(boxLineUp, hlLinesR[i]);

                if (type == BeamLocate.Mid || type == BeamLocate.Left)
                {
                    block.AddLine(xPoint1, hlLinesL[i].StartPoint, CommonLayer.gz2layer);
                    block.AddLine(xPoint2, hlLinesR[i].StartPoint, CommonLayer.gz2layer);
                }
                if (type == BeamLocate.Mid || type == BeamLocate.Right)
                {
                    block.AddLine(xPoint3, hlLinesL[i].EndPoint, CommonLayer.gz2layer);
                    block.AddLine(xPoint4, hlLinesR[i].EndPoint, CommonLayer.gz2layer);
                }

                if (i != 0 && i != hlLinesL.Count - 1)
                {
                    Point3d xPoint1a = AcadAssist.GetIntersectionPoint(boxLineInBoxDn, hlLinesL[i]);
                    Point3d xPoint2a = AcadAssist.GetIntersectionPoint(boxLineInBoxDn, hlLinesR[i]);
                    Point3d xPoint3a = AcadAssist.GetIntersectionPoint(boxLineInBoxUp, hlLinesL[i]);
                    Point3d xPoint4a = AcadAssist.GetIntersectionPoint(boxLineInBoxUp, hlLinesR[i]);
                    block.AddLine(xPoint1a, xPoint3a, CommonLayer.gz2layer);
                    block.AddLine(xPoint2a, xPoint4a, CommonLayer.gz2layer);
                }
            }

            //腹板中心线
            //Curve centerLine = AcadAssist.TrimCurveGetFront(center2, AcadAssist.GetIntersectionPoint(center2, borderRight));
            TxCurve centerLine = AcadAssist.CloneTxCurve(center2);
            block.AddCurve(centerLine, CommonLayer.cenlayer);
            //中心线长度
            double Length = center2.GetDistAtPoint(center2.EndPoint);
            Point3d textPoint = center2.GetPointAtDist(Length * 0.4);
            Vector3d textVect = center2.GetFirstDerivative(textPoint);
            //double textAngle = textVect.AngleOnPlane(center2.GetPlane());
            double textAngle = AcadAssist.AngleOnPlan(textVect, center2);
            block.AddText(textPoint, String.Format("中心线长度{0:F0}", Length), block.style.RealTextHeigth * 1000, textAngle, CommonLayer.dimlayer, TxTextHorizontalMode.TextCenter, TxTextVerticalMode.TextBottom);

            //角度标注
            for (int i = 0; i < hlCenters.Count; i++)
            {
                Point3d hlPointx = AcadAssist.GetIntersectionPoint(center2, hlCenters[i]);
                Vector3d curVectx = center2.GetFirstDerivative(hlPointx).GetNormal();
                Vector3d vectHL = hlCenters[i].EndPoint.GetVectorTo(hlCenters[i].StartPoint).GetNormal();
                if (i == hlCenters.Count - 1)
                    block.AddDimAngularFix(hlPointx, hlPointx - curVectx * block.style.BlockScale * 2000, hlPointx + vectHL * block.style.BlockScale * 2000, block.style.DimFirstLayer * 1000);
                else
                    block.AddDimAngularFix(hlPointx, hlPointx + curVectx * block.style.BlockScale * 2000, hlPointx + vectHL * block.style.BlockScale * 2000, block.style.DimFirstLayer * 1000);
            }
        }
        /// <summary>
        /// 在图纸上画表格
        /// </summary>
        /// <param name="paper">待画入的图纸</param>
        /// <returns></returns>
        internal bool DrawTableOnPaper(ref PaperLayout paper)
        {
            if (blocks[0].DrawMode == BeamBoxBlock.DrawingMode.AUTO)
                UnifyBlockLines();
            BeamBoxBlock boxBlock = blocks[0];
            DatabaseToAcad block = new DatabaseToAcad(boxBlock.DimScale);
            DatabaseToAcad blockTable = new DatabaseToAcad(boxBlock.DimScale);
            boxBlock.DrawGeneral(block);
            try
            {
                TxTable table = TxTable.CreateTable(1, 1);
                DatabaseToAcad tempDB;
                for (int i = 0; i < blocks.Count; i++)
                {
                    TxTable temp;
                    tempDB = new DatabaseToAcad(DimScale);
                    //获取表格要求先虚绘一个图
                    blocks[i].DrawMode = BeamBoxBlock.DrawingMode.USER_CENTER;
                    blocks[i].Draw(tempDB);
                    blocks[i].GetParamTable(out temp);
                    if (temp.ColumnCount > table.ColumnCount)
                        table.tb.InsertColumns(table.ColumnCount, 1, temp.ColumnCount - table.ColumnCount);
                    table.tb.InsertRows(table.RowCount, 1, 5);
                    for (int j = 0; j < 5; j++)
                        for (int k = 0; k < temp.ColumnCount - 1; k++)
                            table.tb.Cells[table.RowCount - 5 + j, k].Value = temp.tb.Cells[j, k].Value;
                }
                table.tb.InsertRows(1, 1, 2);
                for (int i = 0; i < boxBlock.BoxCount; i++)
                {
                    table.tb.Cells[1, 1].Value = "板编号";
                    table.tb.Cells[2, i + 1].Value = (i + 1).ToString();
                }
                for (int i = boxBlock.BoxCount; i < table.ColumnCount - 1; i++)
                {
                    table.tb.Cells[1, boxBlock.BoxCount + 1].Value = "湿接缝编号";
                    table.tb.Cells[2, i + 1].Value = (i - boxBlock.BoxCount + 1).ToString();
                }
                table.tb.MergeCells(Autodesk.AutoCAD.DatabaseServices.CellRange.Create(table.tb, 1, 1, 1, boxBlock.BoxCount));
                table.tb.MergeCells(Autodesk.AutoCAD.DatabaseServices.CellRange.Create(table.tb, 1, boxBlock.BoxCount + 1, 1, table.ColumnCount - 1));
                table.tb.InsertColumns(0, 1, 1);
                table.tb.DeleteColumns(table.ColumnCount - 1, 1);
                blockTable.AddTable(table);

                table.tb.Cells[1, 0].Value = "桩号PL~PR";
                for (int i = 0; i < blocks.Count; i++)
                {
                    for (int j = 0; j < 5; j++)
                        table.tb.Cells[i * 5 + j + 2, 0].Value = "P" + (i + 1).ToString() + "~P" + (i + 2).ToString();
                    table.tb.MergeCells(Autodesk.AutoCAD.DatabaseServices.CellRange.Create(table.tb, i * 5 + 3, 0, i * 5 + 7, 0));
                }
                table.tb.Cells[1, 1].Value = "参数";
                table.tb.Cells[0, 0].Value = "梁参数表";
                table.tb.MergeCells(Autodesk.AutoCAD.DatabaseServices.CellRange.Create(table.tb, 1, 0, 2, 0));
                table.tb.MergeCells(Autodesk.AutoCAD.DatabaseServices.CellRange.Create(table.tb, 1, 1, 2, 1));
                table.tb.MergeCells(Autodesk.AutoCAD.DatabaseServices.CellRange.Create(table.tb, 0, 0, 0, table.ColumnCount - 1));
                //修改表格样式
                for (int i = 0; i < table.RowCount; i++)
                {
                    table.tb.Rows[i].Height = 3 * DrawScale * DimScale;
                    for (int j = 0; j < table.ColumnCount; j++)
                    {
                        table.tb.Cells[i, j].Alignment = Autodesk.AutoCAD.DatabaseServices.CellAlignment.MiddleCenter;
                        table.tb.Cells[i, j].TextHeight = 2 * DrawScale * DimScale;
                    }
                }
                table.tb.Columns[1].Width = 24 * DrawScale * DimScale;

                paper.AddBlock(block.ConvertToBlockBase());
                paper.AddBlock(blockTable.ConvertToBlockBase());
                paper.AutoLayoutBlock_OneRow();

                return true;
            }
            catch
            {
                System.Windows.Forms.MessageBox.Show("绘图出错,请修改结构定义。" + "可能是结构边线是否合理。");
                return false;
            }
        }
        /// <summary>
        /// 在图纸上画图
        /// </summary>
        /// <param name="paper">待画入的图纸</param>
        /// <param name="atOrgLoc">原位绘制</param>
        /// <returns></returns>
        internal bool DrawOnPaper(ref PaperLayout paper, bool atOrgLoc, SplitingMode mode)
        {
            try
            {
                if (mode == SplitingMode.EQUAL && blocks[0].DrawMode == BeamBoxBlock.DrawingMode.AUTO)
                    UnifyBlockLines();
                if (mode == SplitingMode.PARALLEL && blocks[0].DrawMode == BeamBoxBlock.DrawingMode.AUTO)
                    ParallelBlockLines();
                if (mode == SplitingMode.SEAM)
                    foreach (BeamBoxBlock block in blocks)
                        block.DrawMode = BeamBoxBlock.DrawingMode.AUTO;
                if (mode == SplitingMode.USER)
                    foreach (BeamBoxBlock block in blocks)
                        block.DrawMode = BeamBoxBlock.DrawingMode.USER_CENTER;
                if (atOrgLoc)
                {
                    for (int i = 0; i < BlockCount; i++)
                    {
                        DatabaseToAcad db = new DatabaseToAcad(blocks[i].DimScale);
                        blocks[i].DrawAtOrgLoc(db);
                        paper.AddBlock(db.ConvertToBlockBase());
                    }
                    paper.MoveBlock(-blocks[0].OffsetVector);
                }
                else
                {
                    for (int i = 0; i < BlockCount; i++)
                    {
                        DatabaseToAcad db = new DatabaseToAcad(blocks[i].DimScale);
                        blocks[i].Draw(db);
                        paper.AddBlock(db.ConvertToBlockBase());
                    }
                }

                return true;
            }
            catch
            {
                return false;
            }
        }
Beispiel #15
0
        public void DrawPM(DatabaseToAcad block)
        {
            //         1a                                         2a
            //          /-----------------/-----------------------/
            //         /  3a             /               5a      /
            //      1c/----\_ 4a        /            6a_/-------/2c
            //       /       \---------/--------------/        /
            //     1/-----------------/-----------------------/
            //     /      __/--------/---------------\       /
            //  1d/ -----/ 4b       /              6b \-----/2d
            //   /     3b          /                  5b   /
            //  /-----------------/-----------------------/
            //1b                                        2b

            if (center != null && center.StartPoint.X > center.EndPoint.X)
            {
                center = AcadAssist.ReverseTxLine(center);
            }
            if (borderDn != null && borderDn.StartPoint.X > borderDn.EndPoint.X)
            {
                borderDn = AcadAssist.ReverseCurve(borderDn);
            }
            if (borderUp != null && borderUp.StartPoint.X > borderUp.EndPoint.X)
            {
                borderUp = AcadAssist.ReverseCurve(borderUp);
            }

            TxLine center2 = null;
            TxCurve borderDn2 = null;
            TxCurve borderUp2 = null;
            if (center == null)
            {
                center2 = new TxLine(new Point3d(0, 0, 0), new Point3d(L, 0, 0));
            }
            else
            {
                center2 = AcadAssist.CloneTxLine(center);
            }
            if (borderDn == null)
            {
                borderDn2 = new TxLine(new Point3d(0, 0, 0), new Point3d(L, 0, 0));
            }
            else
            {
                borderDn2 = AcadAssist.CloneTxCurve(borderDn);
            }
            if (borderUp == null)
            {
                borderUp2 = new TxLine(new Point3d(0, 0, 0), new Point3d(L, 0, 0));
            }
            else
            {
                borderUp2 = AcadAssist.CloneTxCurve(borderUp);
            }

            TxLine borderLeft = new TxLine(borderDn2.StartPoint, borderUp2.StartPoint);
            TxLine borderRight = new TxLine(borderDn2.EndPoint, borderUp2.EndPoint);
            Vector3d vectCenterLine = center2.StartPoint.GetVectorTo(center2.EndPoint).GetNormal();
            Point3d ctPoint1 = center2.StartPoint;
            //Point3d ctPoint1a = new Point3d(ctPoint1.X + Math.Tan(alf1) * WTL1, ctPoint1.Y + WTL1, 0);
            //Point3d ctPoint1b = new Point3d(ctPoint1.X - Math.Tan(alf1) * WTL2, ctPoint1.Y - WTL2, 0);

            Point3d ctPoint1c = ctPoint1 + vectCenterLine.RotateBy(Math.PI * 0.5 + alf1, Vector3d.ZAxis) * (WD * 0.5) / Math.Cos(alf1);
            Point3d ctPoint1d = ctPoint1 - vectCenterLine.RotateBy(Math.PI * 0.5 + alf1, Vector3d.ZAxis) * (WD * 0.5) / Math.Cos(alf1);

            //Point3d ctPoint1c = new Point3d(ctPoint1.X + Math.Tan(alf1) * WD * 0.5, ctPoint1.Y + WD * 0.5, 0);
            //Point3d ctPoint1d = new Point3d(ctPoint1.X - Math.Tan(alf1) * WD * 0.5, ctPoint1.Y - WD * 0.5, 0);

            Point3d ctPoint2 = center2.EndPoint;
            //Point3d ctPoint2a = new Point3d(ctPoint2.X + Math.Tan(alf2) * WTR1, ctPoint1.Y + WTR1, 0);
            //Point3d ctPoint2b = new Point3d(ctPoint2.X - Math.Tan(alf2) * WTR2, ctPoint1.Y - WTR2, 0);
            Point3d ctPoint2c = ctPoint2 + vectCenterLine.RotateBy(Math.PI * 0.5 + alf2, Vector3d.ZAxis) * (WD * 0.5) / Math.Cos(alf2);
            Point3d ctPoint2d = ctPoint2 - vectCenterLine.RotateBy(Math.PI * 0.5 + alf2, Vector3d.ZAxis) * (WD * 0.5) / Math.Cos(alf2);

            //Point3d ctPoint2c = new Point3d(ctPoint2.X + Math.Tan(alf2) * WD * 0.5, ctPoint2.Y + WD * 0.5, 0);
            //Point3d ctPoint2d = new Point3d(ctPoint2.X - Math.Tan(alf2) * WD * 0.5, ctPoint2.Y - WD * 0.5, 0);

            Point3d ctPoint3 = center2.GetPointAtDist(Ld);
            Point3d ctPoint3a = new Point3d(ctPoint3.X + Math.Tan(alf1) * WD * 0.5, ctPoint3.Y + WD * 0.5, 0);
            Point3d ctPoint3b = new Point3d(ctPoint3.X - Math.Tan(alf1) * WD * 0.5, ctPoint3.Y - WD * 0.5, 0);
            Point3d ctPoint4 = center2.GetPointAtDist(Ld + Ldx);
            Point3d ctPoint4a = new Point3d(ctPoint4.X + Math.Tan(alf1) * WFb * 0.5, ctPoint3.Y + WFb * 0.5, 0);
            Point3d ctPoint4b = new Point3d(ctPoint4.X - Math.Tan(alf1) * WFb * 0.5, ctPoint3.Y - WFb * 0.5, 0);

            Point3d ctPoint5 = center2.GetPointAtDist(L - Ld);
            Point3d ctPoint5a = new Point3d(ctPoint5.X + Math.Tan(alf2) * WD * 0.5, ctPoint5.Y + WD * 0.5, 0);
            Point3d ctPoint5b = new Point3d(ctPoint5.X - Math.Tan(alf2) * WD * 0.5, ctPoint5.Y - WD * 0.5, 0);

            Point3d ctPoint6 = center2.GetPointAtDist(L - Ld - Ldx);
            Point3d ctPoint6a = new Point3d(ctPoint6.X + Math.Tan(alf2) * WFb * 0.5, ctPoint6.Y + WFb * 0.5, 0);
            Point3d ctPoint6b = new Point3d(ctPoint6.X - Math.Tan(alf2) * WFb * 0.5, ctPoint6.Y - WFb * 0.5, 0);

            //外轮廓
            //TxLine sideLine1 = new TxLine(ctPoint1a, ctPoint2a);
            //TxLine sideLine2 = new TxLine(ctPoint1b, ctPoint2b);
            //block.AddLine(ctPoint1a, ctPoint1b, CommonLayer.gz1layer);
            //block.AddLine(ctPoint2a, ctPoint2b, CommonLayer.gz1layer);
            //block.AddLine(ctPoint1a, ctPoint2a, CommonLayer.gz1layer);
            //block.AddLine(ctPoint1b, ctPoint2b, CommonLayer.gz1layer);
            //内轮廓
            TxPolyline plineUp = new TxPolyline();
            plineUp.AddVertexAt(0, new Point2d(ctPoint1c.X, ctPoint1c.Y), 0, 0, 0);
            plineUp.AddVertexAt(1, new Point2d(ctPoint3a.X, ctPoint3a.Y), 0, 0, 0);
            plineUp.AddVertexAt(2, new Point2d(ctPoint4a.X, ctPoint4a.Y), 0, 0, 0);
            plineUp.AddVertexAt(3, new Point2d(ctPoint6a.X, ctPoint6a.Y), 0, 0, 0);
            plineUp.AddVertexAt(4, new Point2d(ctPoint5a.X, ctPoint5a.Y), 0, 0, 0);
            plineUp.AddVertexAt(5, new Point2d(ctPoint2c.X, ctPoint2c.Y), 0, 0, 0);
            //block.AddPolyline(plineUp, CommonLayer.gz2layer);
            TxPolyline plineDn = new TxPolyline();
            plineDn.AddVertexAt(0, new Point2d(ctPoint1d.X, ctPoint1d.Y), 0, 0, 0);
            plineDn.AddVertexAt(1, new Point2d(ctPoint3b.X, ctPoint3b.Y), 0, 0, 0);
            plineDn.AddVertexAt(2, new Point2d(ctPoint4b.X, ctPoint4b.Y), 0, 0, 0);
            plineDn.AddVertexAt(3, new Point2d(ctPoint6b.X, ctPoint6b.Y), 0, 0, 0);
            plineDn.AddVertexAt(4, new Point2d(ctPoint5b.X, ctPoint5b.Y), 0, 0, 0);
            plineDn.AddVertexAt(5, new Point2d(ctPoint2d.X, ctPoint2d.Y), 0, 0, 0);
            //block.AddPolyline(plineDn, CommonLayer.gz2layer);

            //获取横梁线
            List<TxLine> hlCenters;
            List<TxLine> hlLinesL;
            List<TxLine> hlLinesR;
            this.GetHLLine(out hlCenters, out hlLinesL, out hlLinesR);

            //绘制横梁线--考虑剪切断开
            for (int i = 0; i < hlCenters.Count; i++)
                block.AddLine(hlCenters[i], CommonLayer.cenlayer);
            for (int i = 0; i < hlLinesL.Count; i++)
            {
                Point3d xPoint1 = AcadAssist.GetIntersectionPoint(plineDn, hlLinesL[i]);
                Point3d xPoint2 = AcadAssist.GetIntersectionPoint(plineDn, hlLinesR[i]);
                Point3d xPoint3 = AcadAssist.GetIntersectionPoint(plineUp, hlLinesL[i]);
                Point3d xPoint4 = AcadAssist.GetIntersectionPoint(plineUp, hlLinesR[i]);

                if (type == BeamLocate.Mid || type == BeamLocate.Left)
                {
                    block.AddLine(xPoint1, hlLinesL[i].StartPoint, CommonLayer.gz2layer);
                    block.AddLine(xPoint2, hlLinesR[i].StartPoint, CommonLayer.gz2layer);
                }
                if (type == BeamLocate.Mid || type == BeamLocate.Right)
                {
                    block.AddLine(xPoint3, hlLinesL[i].EndPoint, CommonLayer.gz2layer);
                    block.AddLine(xPoint4, hlLinesR[i].EndPoint, CommonLayer.gz2layer);
                }
            }

            //绘制腹板线--纵向
            if (type == BeamLocate.Mid || type == BeamLocate.Right)
            {
                List<Point3d> xPointsUp = new List<Point3d>();
                for (int i = 0; i < hlLinesL.Count; i++)
                {
                    xPointsUp.AddRange(AcadAssist.GetIntersectionPoints(plineUp, hlLinesL[i]));
                    //Point3dCollection curPointsL = new Point3dCollection();
                    //plineUp.IntersectWith(hlLinesL[i], Intersect.OnBothOperands, curPointsL, 0, 0);
                    //for (int j = 0; j < curPointsL.Count; j++)
                    //    xPointsUp.Add(curPointsL[j]);

                    xPointsUp.AddRange(AcadAssist.GetIntersectionPoints(plineUp, hlLinesR[i]));
                    //Point3dCollection curPointsR = new Point3dCollection();
                    //plineUp.IntersectWith(hlLinesR[i], Intersect.OnBothOperands, curPointsR, 0, 0);
                    //for (int j = 0; j < curPointsR.Count; j++)
                    //xPointsUp.Add(curPointsR[j]);
                }
                xPointsUp.Sort(new CompairPoint3dX());
                ////Point3dCollection xPointsUp2 = new Point3dCollection();
                ////for (int i = 0; i < xPointsUp.Count; i++)
                ////{
                ////    xPointsUp2.Add(xPointsUp[i]);
                ////}
                ////DBObjectCollection objCurvesUp = plineUp.GetSplitCurves(xPointsUp2);
                List<TxCurve> objCurvesUp = AcadAssist.SplitCurveByPoints(plineUp, xPointsUp);
                //输出基数个数
                int count1 = Convert.ToInt32((objCurvesUp.Count + 1) / 2);
                for (int i = 0; i < count1; i++)
                {
                    block.AddCurve((TxCurve)objCurvesUp[i * 2], CommonLayer.gz2layer);
                }
            }
            if (type == BeamLocate.Mid || type == BeamLocate.Left)
            {
                //腹板线--右侧侧
                List<Point3d> xPointsDn = new List<Point3d>();
                for (int i = 0; i < hlLinesL.Count; i++)
                {
                    xPointsDn.AddRange(AcadAssist.GetIntersectionPoints(plineUp, hlLinesL[i]));
                    ////Point3dCollection curPointsL = new Point3dCollection();
                    ////plineDn.IntersectWith(hlLinesL[i], Intersect.OnBothOperands, curPointsL, 0, 0);
                    ////for (int j = 0; j < curPointsL.Count; j++)
                    ////    xPointsDn.Add(curPointsL[j]);
                    ////Point3dCollection curPointsR = new Point3dCollection();
                    ////plineDn.IntersectWith(hlLinesR[i], Intersect.OnBothOperands, curPointsR, 0, 0);
                    ////for (int j = 0; j < curPointsR.Count; j++)
                    ////    xPointsDn.Add(curPointsR[j]);
                }
                xPointsDn.Sort(new CompairPoint3dX());
                ////Point3dCollection xPointsDn2 = new Point3dCollection();
                ////for (int i = 0; i < xPointsDn.Count; i++)
                ////{
                ////    xPointsDn2.Add(xPointsDn[i]);
                ////}
                List<TxCurve> objCurvesDn = AcadAssist.SplitCurveByPoints(plineDn, xPointsDn);
                //DBObjectCollection objCurvesDn = plineDn.GetSplitCurves(xPointsDn2);
                //输出基数个数
                int count2 = Convert.ToInt32((objCurvesDn.Count + 1) / 2);
                for (int i = 0; i < count2; i++)
                {
                    block.AddCurve((TxCurve)objCurvesDn[i * 2], CommonLayer.gz2layer);
                }
            }

            if (type == BeamLocate.Left)
                block.AddPolyline(plineUp, CommonLayer.gz2layer);
            if (type == BeamLocate.Right)
                block.AddPolyline(plineDn, CommonLayer.gz2layer);

            //腹板中心线
            TxCurve centerLine = AcadAssist.OffsetLineToBoarder(center2, 0, borderLeft, borderRight);
            block.AddCurve(centerLine, CommonLayer.cenlayer);
            //中心线长度
            Point3d textPoint = center2.GetPointAtDist(center2.Length * 0.4);
            Vector3d textVect = center2.GetFirstDerivative(textPoint);
            //double textAngle = textVect.AngleOnPlane(center2.GetPlane());
            double textAngle = AcadAssist.AngleOnPlan(textVect, center2);
            block.AddText(textPoint, String.Format("中心线长度{0:F0}", center2.Length), block.style.RealTextHeigth * 1000, textAngle, CommonLayer.dimlayer, TxTextHorizontalMode.TextCenter, TxTextVerticalMode.TextBottom);

            //角度标注
            for (int i = 0; i < hlCenters.Count; i++)
            {
                Point3d hlPointx = AcadAssist.GetIntersectionPoint(center2, hlCenters[i]);
                Vector3d curVectx = center2.GetFirstDerivative(hlPointx).GetNormal();
                Vector3d vectHL = hlCenters[i].EndPoint.GetVectorTo(hlCenters[i].StartPoint).GetNormal();
                if (i == hlCenters.Count - 1)
                    block.AddDimAngularFix(hlPointx, hlPointx - curVectx * block.style.BlockScale * 2000, hlPointx + vectHL * block.style.BlockScale * 2000, block.style.DimFirstLayer * 1000);
                else
                    block.AddDimAngularFix(hlPointx, hlPointx + curVectx * block.style.BlockScale * 2000, hlPointx + vectHL * block.style.BlockScale * 2000, block.style.DimFirstLayer * 1000);
            }
        }
Beispiel #16
0
        public override void DrawDM(DatabaseToAcad block)
        {
            //          WT1              WT2
            //    2             0              3
            //     |--------------------------|   |
            //     |        6        7        |   | HT
            //   4 |---------\WX  WX/---------|5  |    |  HYY
            //                \    /                   |
            //               8 |  | 9
            //                 |WFb
            //                 |  |
            //                 |  |
            //                 |  |
            //                 |  |
            //              14 |  | 15
            //                /    \          |
            //               /      \         |  HDY
            //            12|   WD   | 13           |
            //            10|--------| 11           | HD
            //                   1

            MTL_Math.Array2.SetArray(dmPoints, 16);
            dmPoints[0] = new Point3d(DeckPoint.X, DeckPoint.Y + H, 0);
            dmPoints[1] = new Point3d(dmPoints[0].X, dmPoints[0].Y - H, 0);
            dmPoints[2] = new Point3d(dmPoints[0].X - WT1, dmPoints[0].Y - WT1 * iT, 0);
            dmPoints[3] = new Point3d(dmPoints[0].X + WT2, dmPoints[0].Y + WT2 * iT, 0);
            dmPoints[4] = new Point3d(dmPoints[2].X, dmPoints[2].Y - HT, 0);
            dmPoints[5] = new Point3d(dmPoints[3].X, dmPoints[3].Y - HT, 0);
            dmPoints[6] = new Point3d(dmPoints[4].X + (WT1 - WX - WFb * 0.5), dmPoints[4].Y + (WT1 - WX - WFb * 0.5) * iT, 0);
            dmPoints[7] = new Point3d(dmPoints[5].X - (WT2 - WX - WFb * 0.5), dmPoints[5].Y - (WT2 - WX - WFb * 0.5) * iT, 0);
            dmPoints[8] = new Point3d(dmPoints[4].X + (WT1 - WFb * 0.5), dmPoints[4].Y + (WT1 - WFb * 0.5) * iT - HTY, 0);
            dmPoints[9] = new Point3d(dmPoints[5].X - (WT2 - WFb * 0.5), dmPoints[5].Y - (WT2 - WFb * 0.5) * iT - HTY, 0);
            dmPoints[10] = new Point3d(dmPoints[0].X - WD * 0.5, dmPoints[0].Y - H, 0);
            dmPoints[11] = new Point3d(dmPoints[0].X + WD * 0.5, dmPoints[0].Y - H, 0);
            dmPoints[12] = new Point3d(dmPoints[10].X, dmPoints[10].Y + HD, 0);
            dmPoints[13] = new Point3d(dmPoints[11].X, dmPoints[11].Y + HD, 0);
            dmPoints[14] = new Point3d(dmPoints[1].X - WFb * 0.5, dmPoints[1].Y + HD + HDY, 0);
            dmPoints[15] = new Point3d(dmPoints[1].X + WFb * 0.5, dmPoints[1].Y + HD + HDY, 0);

            //顶底缘线
            block.AddLine(dmPoints[2], dmPoints[3], CommonLayer.gz1layer);
            block.AddLine(dmPoints[10], dmPoints[11], CommonLayer.gz1layer);
            //左侧构造
            block.AddLine(dmPoints[2], dmPoints[4], CommonLayer.gz1layer);
            block.AddLine(dmPoints[4], dmPoints[6], CommonLayer.gz1layer);
            block.AddLine(dmPoints[6], dmPoints[8], CommonLayer.gz1layer);
            block.AddLine(dmPoints[8], dmPoints[14], CommonLayer.gz1layer);
            block.AddLine(dmPoints[14], dmPoints[12], CommonLayer.gz1layer);
            block.AddLine(dmPoints[12], dmPoints[10], CommonLayer.gz1layer);
            //右侧构造
            block.AddLine(dmPoints[3], dmPoints[5], CommonLayer.gz1layer);
            block.AddLine(dmPoints[5], dmPoints[7], CommonLayer.gz1layer);
            block.AddLine(dmPoints[7], dmPoints[9], CommonLayer.gz1layer);
            block.AddLine(dmPoints[9], dmPoints[15], CommonLayer.gz1layer);
            block.AddLine(dmPoints[15], dmPoints[13], CommonLayer.gz1layer);
            block.AddLine(dmPoints[13], dmPoints[11], CommonLayer.gz1layer);

            //绘制横隔板
            //double Hgb = H - 200;//横隔板高度(从顶板算起)
            MTL_Math.Array2.SetArray(gbPoints, 4);
            gbPoints[0] = new Point3d(dmPoints[2].X, dmPoints[2].Y - Hgb, 0);
            gbPoints[1] = new Point3d(dmPoints[10].X, dmPoints[10].Y + (H - Hgb) - iT * WD * 0.5, 0);
            gbPoints[2] = new Point3d(dmPoints[3].X, dmPoints[3].Y - Hgb, 0);
            gbPoints[3] = new Point3d(dmPoints[11].X, dmPoints[11].Y + (H - Hgb) + iT * WD * 0.5, 0);
            if (type == BeamLocate.Left || type == BeamLocate.Mid)
            {
                block.AddLine(dmPoints[5], gbPoints[2], CommonLayer.gz1layer);
                block.AddLine(gbPoints[2], gbPoints[3], CommonLayer.gz1layer);
            }
            if (type == BeamLocate.Right || type == BeamLocate.Mid)
            {
                block.AddLine(dmPoints[4], gbPoints[0], CommonLayer.gz1layer);
                block.AddLine(gbPoints[0], gbPoints[1], CommonLayer.gz1layer);
            }
        }
Beispiel #17
-6
        public override void Draw(DatabaseToAcad block)
        {
            // ======================== 基本几何操作 ====================================
            /// 点和向量的计算
            Point3d structPt1 = new Point3d(0, -5000, 0);

            Vector3d vect = new Vector3d(3, 9, 0);      ///
            Vector3d vectUnit = vect.GetNormal();       ///取单位向量
            Vector3d vectPer = vectUnit.RotateBy(Math.PI * 0.5, Vector3d.ZAxis);  ///向量的垂直,顺时针方向转90度

            Point3d structPt2 = structPt1 + vectUnit.MultiplyBy(2000);      ///点可以是点和向量相加
            Point3d structPt3 = structPt1 + vectPer.MultiplyBy(2000);

            /// 直线
            TxLine line1 = new TxLine(new Point3d(0, 0, 0), new Point3d(500, 500, 0));
            TxLine line2 = AcadAssist.GetOffsetLineToLeft(line1, 200);                  //线的偏移
            TxLine line3 = new TxLine(new Point3d(100, -500, 0), new Point3d(100, 5000, 0));
            TxLine line4 = new TxLine(new Point3d(1000, -500, 0), new Point3d(1000, 5000, 0));
            List<Point3d> xpnt = AcadAssist.GetIntersectionPoints(line1, line3); /// 两条线求交

            /// 圆弧
            TxArc arc = new TxArc(new Point3d(), new Point3d(100, 100, 0), new Point3d(200, 0, 0));///三点确定圆弧

            /// 圆弧转化为多义线
            TxPolyline pl2 = AcadAssist.ConvertToTxPolyline(arc);

            /// 多义线
            TxPolyline pl1 = new TxPolyline();
            pl1.AddVertexAt(0, new Point2d(0, 0), 0, 0, 0);
            pl1.AddVertexAt(1, new Point2d(0, 500), 0, 0, 0);
            pl1.AddVertexAt(2, new Point2d(500, 500), 0, 0, 0);
            pl1.AddVertexAt(3, new Point2d(300, 100), 0.5, 0, 0); /// 这个参数不是0,则是曲线
            pl1.AddVertexAt(4, new Point2d(0, 0), 0, 0, 0);

            // ======================== 基本图形的运算  AcadAssist.() ====================================
            /// 多义线裁剪和对称
            TxPolyline pl3 = AcadAssist.TrimPolylineGetFront(pl2, new Point3d(500, 500, 0));  ///  裁剪,求线的前面部分
            pl3 = AcadAssist.MillarTxPolyline(pl3, 0);

            // ======================== 绘制图形 ====================================
            /// -------- 绘制线 -----------
            block.AddLine(new Point3d(0, 0, 0), new Point3d(500, 500, 0), CommonLayer.zerolayer);
            /// --------绘制线  ----------------------- 图层说明 -- 构造有四个图层,  加入的对象颜色和线型都是随层的
            block.AddLine(line1, CommonLayer.gz1layer);  ///粗实线
            block.AddLine(line2, CommonLayer.gz2layer);  ///细实线
            block.AddLine(line3, CommonLayer.gz3layer);  ///粗虚线
            block.AddLine(line4, CommonLayer.gz4layer);  ///细虚线

            /// --------- 绘制其它基本图形
            block.AddCircle(new Point3d(0, 0, 0), 500, CommonLayer.zerolayer);
            block.AddCurve(arc, CommonLayer.dimlayer);

            //public void AddSectionLineHori(Point3d midPoint, string name, bool isTextUp, bool isArrowLeft);       /// 剖断线
            //public void AddSectionLineVert(Point3d midPoint, string name, bool isTextLeft, bool isArrowUpside);   /// 剖断线

            /// --------绘制线  ----------------------- 图层说明 -- 构造有四个图层,  加入的对象颜色和线型都是随层的
            block.AddCurve(pl1);
            block.AddCurve(pl2);
            block.AddCurve(pl3);

            ///标注文字和线 [带指引线的文字]
            block.AddTextDim(new Point3d(0, 500, 0), CommonSimbel.ConvertToDimStr(1000) + CommonSimbel.multipliSymbol + CommonSimbel.ConvertToDimStr(500), 2); /// 最后一个参数表示是哪个象限[1,2,3,4]
            block.AddTextDimAngle(new Point3d(0, 1500, 0), "sss", new Point3d(2500, 5000, 0), 250);

            ///加阴影部分
            TxPolyline plx = AcadAssist.CloneTxPolyline(pl1);
            block.AddHatch(plx, 1, CommonLayer.gz1layer);

            // -------- 绘制文字 ------
            block.AddText(new Point3d(800, 800, 0), "Hello1");
            block.AddText(new Point3d(900, 900, 0), "Hello2", block.style.RealTextHeigth, Math.PI * 0.25, CommonLayer.dimlayer, TxTextHorizontalMode.TextRight, TxTextVerticalMode.TextTop);

            ///加标题
            block.AddTitle(new Point3d(500, 500, 0), "图块标题"); /// 应该考虑图块放在上面还是下面
            ///  CommonSimbel.IsDownTitle

            ///加折断线 ,有三种,单折断线,双折断线,圆柱折断线
            //block.AddBreakLine()

            // ======================== 标注 ====================================
            //block.AddDimContinueAlign_AutoAdjust( ,);/// 自动向外调整位置
            //block.AddDimension_UserTextPoint()///  一般情况下文字位置自定处理的,但是也可以设定

            // ======================== 绘制钢筋 ====================================

            /// ------ 绘制点钢筋 ---------
            double BHC = 30;
            ISteelBar ist_dot = new ISteelBar("1", 12, SteelBarType.HRB400, "水平钢筋", 101);
            SteelDotByLine st_dot = SteelFactory.CreateSteelDots(ist_dot, structPt1, structPt2, BHC);
            block.AddSteelEntity(st_dot);

            /// ------ 绘制线钢筋 ---------
            ISteelBar ist_line = new ISteelBar("1", 12, SteelBarType.HRB400, "水平钢筋", 101);
            SteelLines st_line = SteelFactory.CreateSteelParalLine(ist_line, structPt1, structPt3, BHC, 45, 2000);
            block.AddSteelEntity(st_line);
        }