BCOM.Element CreatePileCrossSectionElement(IPileProperty pileprop) { //double uorpermaster = app.ActiveModelReference.UORsPerMasterUnit; BCOM.Matrix3d m = app.Matrix3dIdentity(); BCOM.Point3d centroidp = pileprop.PileTopPoint.Point3dToBCOMPoint3d(1e4 / uorpermaster); centroidp.Z = 0; // xy平面 double pilediameter = pileprop.PileDiameter * 1e4 / uorpermaster; int colorindex = 3; if ((pileprop is SquarePileGeometry) || (pileprop is SquarePileGeometry)) { BCOM.Point3d[] squarvertexs = { app.Point3dFromXY(pilediameter / 2, pilediameter / 2), app.Point3dFromXY(-pilediameter / 2, pilediameter / 2), app.Point3dFromXY(-pilediameter / 2, -pilediameter / 2), app.Point3dFromXY(pilediameter / 2, -pilediameter / 2) }; BCOM.ShapeElement shape = app.CreateShapeElement1(null, ref squarvertexs, BCOM.MsdFillMode.NotFilled); shape.Move(ref centroidp); shape.Color = colorindex; return(shape); } else { var c = app.CreateEllipseElement2(null, ref centroidp, pilediameter / 2, pilediameter / 2, ref m, BCOM.MsdFillMode.NotFilled); c.Color = colorindex; return(c); } }
public void Test() { //try //{ // Stopwatch sw = new Stopwatch(); // sw.Start(); // StringBuilder sb = new StringBuilder(); // foreach (var pile in Piles) // { // PileLengthCalculation pilecalculation = new PileLengthCalculation(pile, 2000); // sb.Append(pile.PileCode + "," + Utilities.CellingWithInterval(pilecalculation.GetPileLengthByBearingCapacity(),0.5) + "\n"); // } // sw.Stop(); // File.WriteAllText(@"D:\Result.csv", sb.ToString()); // MessageBox.Show(sw.Elapsed.TotalSeconds.ToString()); // //MessageBox.Show(sb.ToString()); //} //catch (Exception e) //{ // MessageBox.Show(e.ToString()); //} BCOM.Application app = Program.COM_App; BCOM.Point3d o = app.Point3dZero(); BCOM.Matrix3d m = app.Matrix3dIdentity(); var text = app.CreateTextElement1(null, "text", ref o, ref m); BCOM.TextStyle ts = app.ActiveSettings.TextStyle; ts.Color = 2; text.let_TextStyle(ts); app.ActiveModelReference.AddElement(text); }
/// Called by the state machine for each mouse move event. /// point: Current cursor location. /// view: Cursor is in this view. /// drawMode: Draw mode supplied by the drawing engine. public void Dynamics(ref Point3d Point, BCOM.View View, MsdDrawingMode DrawMode) { if (m_nPoints != 1) { return; } string[] txtStr = new string[2]; Point3d[] txtPts = new Point3d[2]; Element[] elems = new Element[3]; m_atPoints[1] = Point; txtStr[0] = (myForm.rbEN.Checked ? "E=" : "X=") + m_atPoints[0].X.ToString("F2"); txtStr[1] = (myForm.rbEN.Checked ? "N=" : "Y=") + m_atPoints[0].Y.ToString("F2"); double txtLen = app.ActiveSettings.TextStyle.Width * Math.Max(txtStr[0].Length, txtStr[1].Length); double txtLineSpacing = app.ActiveSettings.TextStyle.Height; if (myForm.rbHorizontal.Checked) { m_atPoints[2].X = m_atPoints[1].X + (m_atPoints[0].X > m_atPoints[1].X ? -txtLen : txtLen) * 1.2; m_atPoints[2].Y = m_atPoints[1].Y; txtPts[0].X = (m_atPoints[1].X + m_atPoints[2].X) / 2; txtPts[0].Y = m_atPoints[1].Y + txtLineSpacing; txtPts[1].X = txtPts[0].X; txtPts[1].Y = m_atPoints[1].Y - txtLineSpacing; } else { m_atPoints[2].X = m_atPoints[1].X; m_atPoints[2].Y = m_atPoints[1].Y + (m_atPoints[0].Y > m_atPoints[1].Y ? -txtLen : txtLen) * 1.2; txtPts[0].X = m_atPoints[1].X - txtLineSpacing; txtPts[0].Y = (m_atPoints[1].Y + m_atPoints[2].Y) / 2; txtPts[1].X = m_atPoints[1].X + txtLineSpacing; txtPts[1].Y = txtPts[0].Y; } elems[0] = app.CreateLineElement1(null, ref m_atPoints); elems[0].LineStyle = app.ActiveDesignFile.LineStyles.Find("0", null); Matrix3d rMatrix = app.Matrix3dIdentity(); for (int i = 1; i < 3; i++) { elems[i] = app.CreateTextElement1(null, txtStr[i - 1], ref txtPts[i - 1], ref rMatrix); elems[i].AsTextElement().TextStyle.Font = app.ActiveDesignFile.Fonts.Find(MsdFontType.MicroStation, "ENGINEERING", null); elems[i].AsTextElement().TextStyle.Justification = MsdTextJustification.CenterCenter; if (myForm.rbVertical.Checked) { elems[i].RotateAboutZ(ref txtPts[i - 1], Math.PI / 2); } } CellElement elemCell = app.CreateCellElement1("NoteCoordCell", ref elems, ref m_atPoints[0], false); elemCell.Redraw(DrawMode); if (MsdDrawingMode.Normal == DrawMode) { app.ActiveModelReference.AddElement(elemCell); } }
public static void TestDimsionElement() { BCOM.Application app = Program.COM_App; var m = app.Matrix3dIdentity(); var dim = app.CreateDimensionElement1(null, ref m, Bentley.Interop.MicroStationDGN.MsdDimType.AngleLocation); var p0 = app.Point3dFromXY(100, 100); var p1 = app.Point3dFromXY(000, 0); var p2 = app.Point3dFromXY(0, 100); dim.AddReferencePoint(app.ActiveModelReference, ref p0); dim.AddReferencePoint(app.ActiveModelReference, ref p1); dim.AddReferencePoint(app.ActiveModelReference, ref p2); app.ActiveModelReference.AddElement(dim); }