예제 #1
0
        /// <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
            }
        }
예제 #2
0
        /// <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
            }
        }