private void addLegend(string title, Point3d position, double tableWidth, double tableHeight) { CADOperator cadOperator = new CADOperator(); //添加文字 DBText dbtext = cadOperator.NewDBText(title, position, tableHeight / 7, 0, false); cadOperator.addEntity(dbtext); //添加表格 Table table = new Table(); table.SetSize(8, 4); table.Position = new Point3d(position.X, position.Y - 20, position.Z); table.Width = tableWidth; table.Height = tableHeight; table.Cells.TextHeight = tableHeight / 10; table.Cells[0, 0].TextString = "颜色"; table.Cells[0, 1].TextString = "时间"; table.Cells[0, 2].TextString = "颜色"; table.Cells[0, 3].TextString = "时间"; string[] cellString = constantValue.clocks; for (int i = 1; i < 8; i++) { table.Cells[i, 0].BackgroundColor = Autodesk.AutoCAD.Colors.Color.FromColorIndex( Autodesk.AutoCAD.Colors.ColorMethod.ByAci, (short)constantValue.colorArray[i - 1 + 6]); table.Cells[i, 1].TextString = cellString[i - 1]; } for (int i = 1; i < 7; i++) { table.Cells[i, 2].BackgroundColor = Autodesk.AutoCAD.Colors.Color.FromColorIndex( Autodesk.AutoCAD.Colors.ColorMethod.ByAci, (short)constantValue.colorArray[i + 6 + 6]); table.Cells[i, 3].TextString = cellString[i + 6]; } cadOperator.addEntity(table); }
/// <summary> /// /// </summary> /// <param name="line"></param> /// <param name="dirt"></param> /// <returns></returns> public double midP2LineInDirection(Line line, Vector3d dirt) { Geometry geo = new Geometry(); Line myLine = this.Entity; // Get mid point of itself Point3d midP = geo.GetMidPoint(myLine); //construct assistant line Point3d assisP = midP + dirt; Line guides = new Line(midP, assisP); // Get Intersection point Point3dCollection insectPoints = new Point3dCollection(); guides.IntersectWith(line, Intersect.ExtendBoth, insectPoints, 0, 0); CADOperator ope = new CADOperator(); ope.addEntity(new Line(midP, insectPoints[0])); return(midP.DistanceTo(insectPoints[0])); }