/// <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> 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> /// 通图标注,需先绘制梁图 /// </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("绘图出错,请修改结构定义。" + "可能是结构边线是否合理。"); } }