예제 #1
0
        /// <summary>
        /// border1--下缘线,border2--上缘线,
        /// drawScale --- 输入的线是米单位还是毫米单位
        /// drawScale = 1,是米单位,线要放大1000倍; drawScale= 1000是毫米单位,线不需要缩放
        /// </summary>
        public void SetLinePM(TxCurve x_center, TxCurve x_borderDn, TxCurve x_borderUp, List<TxLine> midHLLines, int drawScale)
        {
            center = AcadAssist.CloneTxCurve(x_center);
            borderDn = AcadAssist.CloneTxCurve(x_borderDn);
            borderUp = AcadAssist.CloneTxCurve(x_borderUp);
            List<TxLine> zhlLines = new List<TxLine>();
            for (int i = 0; i < midHLLines.Count; i++)
            {
                zhlLines.Add(AcadAssist.CloneTxLine(midHLLines[i]));
            }

            if (center != null && center.StartPoint.X > center.EndPoint.X)
            {
                center = AcadAssist.ReverseCurve(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);
            }
            for (int i = 0; i < zhlLines.Count; i++)
            {
                if (zhlLines[i].StartPoint.Y > zhlLines[i].EndPoint.Y)
                {
                    zhlLines[i] = AcadAssist.ReverseTxLine(zhlLines[i]);
                }
            }

            //缩放比例
            if (drawScale == 1)
            {
                center.TransformBy(Matrix3d.Scaling(1000, center.StartPoint));
                borderDn.TransformBy(Matrix3d.Scaling(1000, center.StartPoint));
                borderUp.TransformBy(Matrix3d.Scaling(1000, center.StartPoint));
                for (int i = 0; i < zhlLines.Count; i++)
                    zhlLines[i].TransformBy(Matrix3d.Scaling(1000, center.StartPoint));
            }

            L = center.GetDistAtPoint(center.EndPoint);
            Vector3d centerVect = center.StartPoint.GetVectorTo(center.EndPoint).RotateBy(Math.PI * 0.5, Vector3d.ZAxis);
            Vector3d sideLeftVect = borderDn.StartPoint.GetVectorTo(borderUp.StartPoint);
            alf1 = AcadAssist.GetRotateAngle(centerVect, sideLeftVect);// centerVect.GetAngleTo(sideLeftVect); CAD的函数求的夹角都是正的.
            //WTL1 = borderUp.StartPoint.DistanceTo(center.GetClosestPointTo(borderUp.StartPoint, true));
            //WTR1 = borderDn.StartPoint.DistanceTo(center.GetClosestPointTo(borderDn.StartPoint, true));

            Vector3d sideRightVect = borderDn.EndPoint.GetVectorTo(borderUp.EndPoint);
            alf2 = AcadAssist.GetRotateAngle(centerVect, sideRightVect);// centerVect.GetAngleTo(sideLeftVect); CAD的函数求的夹角都是正的.
            //WTL2 = borderUp.EndPoint.DistanceTo(center.GetClosestPointTo(borderUp.EndPoint, true));
            //WTR2 = borderDn.EndPoint.DistanceTo(center.GetClosestPointTo(borderDn.EndPoint, true));

            HLx.Clear();
            HLa.Clear();
            for (int i = 0; i < zhlLines.Count; i++)
            {
                Point3d hlPoint = AcadAssist.GetIntersectionPoint(center, zhlLines[i]);
                double temp_henliangX = center.GetDistAtPoint(hlPoint);
                Vector3d henliangVect = zhlLines[i].StartPoint.GetVectorTo(zhlLines[i].EndPoint);
                double temp_alf = AcadAssist.GetRotateAngle(centerVect, henliangVect);

                if (i == 0)
                    HLx.Add(temp_henliangX);
                else
                    HLx.Add(temp_henliangX - HLx[i - 1]);
                //设置角度
                HLa.Add(temp_alf);
            }
        }
예제 #2
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);
            }
        }
예제 #3
0
        /// <summary>
        /// 绘制支座,需先绘制梁图
        /// </summary>
        private void DrawSupportPoints()
        {
            if (!isDrawn)
                throw new Exception("尚未绘图");
            try
            {
                Point3d borderPointL_Up = AcadAssist.GetIntersectionPoint(cvBoardUp2, pierline12);
                Point3d borderPointL_Dn = AcadAssist.GetIntersectionPoint(cvBoardDn2, pierline12);
                Point3d roadCenterL = AcadAssist.GetIntersectionPoint(curveZX2, pierline12);
                double DL = borderPointL_Up.DistanceTo(roadCenterL);
                double DR = borderPointL_Dn.DistanceTo(roadCenterL);
                double sumLL = borderPointL_Up.DistanceTo(borderPointL_Dn);
                if (((DL + DR) - sumLL) > 1)
                {
                    DL = ((DL > DR) ? 1 : -1) * DL;
                    DR = ((DL > DR) ? -1 : 1) * DR;
                }

                Vector3d vectGailingPer1111 = AcadAssist.GetFirstDerivative(pierline12, borderPointL_Up);

                Vector3d vectGailingPer1 = AcadAssist.GetFirstDerivative(pierline12, borderPointL_Up).GetNormal().RotateBy(-0.5 * Math.PI, Vector3d.ZAxis);
                Vector3d vectGailingPer2 = AcadAssist.GetFirstDerivative(pierline12, borderPointL_Dn).GetNormal().RotateBy(-0.5 * Math.PI, Vector3d.ZAxis);

                Vector3d vect_up = AcadAssist.GetFirstDerivative(cvBoardUp2, borderPointL_Up);
                Vector3d vect_dn = AcadAssist.GetFirstDerivative(cvBoardDn2, borderPointL_Dn);
                double rotateAngl1 = vect_up.GetAngleTo(vectGailingPer1);
                double rotateAngl2 = vect_dn.GetAngleTo(vectGailingPer2);

                double rotateAngl1_360 = rotateAngl1 * 180 / Math.PI;
                double rotateAngl2_360 = rotateAngl2 * 180 / Math.PI;

                TxCurve gailiangSideInnerL = AcadAssist.OffsetCurveToBoarderRight(pierline12, +gailiangInSide * 0.001 / m_drawScale, cvBoardUp2, cvBoardDn2); ///倒T盖梁的内侧结构线
                TxCurve gailiangSideInnerR = AcadAssist.OffsetCurveToBoarderRight(pierline22, -gailiangInSide * 0.001 / m_drawScale, cvBoardUp2, cvBoardDn2); ///倒T盖梁的内侧结构线
                TxCurve gailiangSideOuterL = AcadAssist.OffsetCurveToBoarderRight(pierline12, +gailiangOutSide * 0.001 / m_drawScale, cvBoardUp2, cvBoardDn2); ///倒T盖梁的外侧结构边线
                TxCurve gailiangSideOuterR = AcadAssist.OffsetCurveToBoarderRight(pierline22, -gailiangOutSide * 0.001 / m_drawScale, cvBoardUp2, cvBoardDn2); ///倒T盖梁的内侧结构边线
                if (gailiangInSide > 0) block.AddCurve(gailiangSideInnerL, CommonLayer.qtlayer);
                if (gailiangInSide > 0) block.AddCurve(gailiangSideInnerR, CommonLayer.qtlayer);
                block.AddCurve(gailiangSideOuterL, CommonLayer.qtlayer);
                block.AddCurve(gailiangSideOuterR, CommonLayer.qtlayer);

                supportLineL = AcadAssist.OffsetCurveToBoarderRight(pierline12, +supportOffsetL * 0.001 / m_drawScale, cvBoardUp2, cvBoardDn2);
                supportLineR = AcadAssist.OffsetCurveToBoarderRight(pierline22, -supportOffsetR * 0.001 / m_drawScale, cvBoardUp2, cvBoardDn2);
                block.AddCurve(supportLineL, CommonLayer.qtlayer); ///盖梁上的支座中心线
                block.AddCurve(supportLineR, CommonLayer.qtlayer); ///盖梁上的支座中心线

                supportPointsL = new List<Point3d>();
                supportPointsR = new List<Point3d>();
                //List<Point3d> supportPointsL = new List<Point3d>();
                //List<Point3d> supportPointsR = new List<Point3d>();
                for (int i = 0; i < cenLines.Count; i++)
                {
                    if (supportDistOnBeam == 0)
                    {
                        supportPointsL.Add(AcadAssist.GetIntersectionPoint(supportLineL, cenLines[i]));
                        supportPointsR.Add(AcadAssist.GetIntersectionPoint(supportLineR, cenLines[i]));
                    }
                    else
                    {
                        TxLine centerOffsetLine1 = AcadAssist.GetOffsetLineToLeft(cenLines[i], -0.5 * supportDistOnBeam * 0.001 / m_drawScale); // 向下偏移
                        TxLine centerOffsetLine2 = AcadAssist.GetOffsetLineToLeft(cenLines[i], +0.5 * supportDistOnBeam * 0.001 / m_drawScale); // 向上偏移
                        supportPointsL.Add(AcadAssist.GetIntersectionPoint(supportLineL, centerOffsetLine1));
                        supportPointsL.Add(AcadAssist.GetIntersectionPoint(supportLineL, centerOffsetLine2));
                        supportPointsR.Add(AcadAssist.GetIntersectionPoint(supportLineR, centerOffsetLine1));
                        supportPointsR.Add(AcadAssist.GetIntersectionPoint(supportLineR, centerOffsetLine2));

                        if (IsDimZZDistOnBeam)
                        {
                            //-----------标注支座间距[垂直梁中心线标注]----
                            Point3d supportPointsL0 = AcadAssist.GetIntersectionPoint(supportLineL, cenLines[i]);
                            Point3d supportPointsL1 = AcadAssist.GetIntersectionPoint(supportLineL, centerOffsetLine1);
                            Point3d supportPointsL2 = AcadAssist.GetIntersectionPoint(supportLineL, centerOffsetLine2);
                            Point3d supportPointsL1_onBeam = cenLines[i].GetClosestPointTo(supportPointsL1, false);
                            Point3d supportPointsL2_onBeam = cenLines[i].GetClosestPointTo(supportPointsL2, false);
                            block.AddDimRotated(supportPointsL1, supportPointsL1_onBeam, -block.style.DimFirstLayer, 0, CommonSimbel.ConvertToDimStr(0.5 * supportDistOnBeam));
                            block.AddDimRotated(supportPointsL2_onBeam, supportPointsL2, -block.style.DimFirstLayer, 0, CommonSimbel.ConvertToDimStr(0.5 * supportDistOnBeam));

                            Point3d supportPointsR0 = AcadAssist.GetIntersectionPoint(supportLineL, cenLines[i]);
                            Point3d supportPointsR1 = AcadAssist.GetIntersectionPoint(supportLineR, centerOffsetLine1);
                            Point3d supportPointsR2 = AcadAssist.GetIntersectionPoint(supportLineR, centerOffsetLine2);
                            Point3d supportPointsR1_onBeam = cenLines[i].GetClosestPointTo(supportPointsR1, false);
                            Point3d supportPointsR2_onBeam = cenLines[i].GetClosestPointTo(supportPointsR2, false);
                            block.AddDimRotated(supportPointsR1, supportPointsR1_onBeam, +block.style.DimFirstLayer, 0, CommonSimbel.ConvertToDimStr(0.5 * supportDistOnBeam));
                            block.AddDimRotated(supportPointsR2_onBeam, supportPointsR2, +block.style.DimFirstLayer, 0, CommonSimbel.ConvertToDimStr(0.5 * supportDistOnBeam));
                        }
                    }
                }
                ///------------------------------------------------------

                for (int i = 0; i < supportPointsL.Count; i++)
                {
                    if (IsSupportRound)
                    {
                        block.AddCircle(supportPointsL[i], supportDiameter * 0.001 / m_drawScale, CommonLayer.qtlayer);
                    }
                    else
                    {
                        block.AddCenterSquare(supportPointsL[i], supportDiameter * 0.001 / m_drawScale, CommonLayer.qtlayer);
                    }
                }
                for (int i = 0; i < supportPointsR.Count; i++)
                {
                    if (IsSupportRound)
                    {
                        block.AddCircle(supportPointsR[i], supportDiameter * 0.001 / m_drawScale, CommonLayer.qtlayer);
                    }
                    else
                    {
                        block.AddCircle(supportPointsL[i], supportDiameter * 0.001 / m_drawScale, CommonLayer.qtlayer);
                    }
                }
            }
            catch
            {
                System.Windows.Forms.MessageBox.Show("绘图出错,请修改结构定义。" + "可能是结构边线是否合理。");
            }
        }
예제 #4
0
        /// <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("绘图出错,请修改结构定义。" + "可能是结构边线是否合理。");
            }
        }
예제 #5
0
        public BeamBoxBlock()
        {
            base.DimScale = 0.1;

            user_curveZX = new TxLine(new Point3d(-5, 0, 0), new Point3d(25, 0, 0));
            user_cvBoardUp = new TxLine(new Point3d(-10, +8, 0), new Point3d(30, +8, 0));
            user_cvBoardDn = new TxLine(new Point3d(-10, -8, 0), new Point3d(30, -8, 0));
            user_pierline1 = new TxLine(new Point3d(0, -15, 0), new Point3d(0, +15, 0));
            user_pierline2 = new TxLine(new Point3d(20, -15, 0), new Point3d(20, +15, 0));
        }
예제 #6
0
        /// <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);
        }