Example #1
0
 //position unit:m
 BCOM.TextElement CreatePilePositionText(Point3d p, string text)
 {
     BCOM.Point3d centroidp = p.Point3dToBCOMPoint3d(1e4 / uorpermaster);
     centroidp.Z = 0; // xy plane
     BCOM.Matrix3d    m       = app.Matrix3dIdentity();
     BCOM.TextElement textele = app.CreateTextElement1(null, text, ref centroidp, ref m);
     return(textele);
 }
        private BCOM.Element createLeader()
        {
            List <BCOM.Element> elements = new List <BCOM.Element>();

            if (pointIndex_ < 1)
            {
                points_[1] = points_[2] = points_[0];
            }
            else if (pointIndex_ < 2)
            {
                points_[2] = points_[1];
            }
            else
            {
                points_[2] = app_.Point3dFromXY(points_[2].X, points_[1].Y);
            }

            int kX = (points_[2].X - points_[1].X) >= 0 ? 1 : -1;

            BCOM.TextElement textUpper = app_.CreateTextElement1(
                null, leaderInfo_.TextLines[0], app_.Point3dZero(), app_.Matrix3dZero());
            textUpper.Redraw(BCOM.MsdDrawingMode.Temporary);
            textUpper.set_Origin(points_[2].shift(dY: textUpper.Range.getHeight() * 0.75));

            BCOM.TextElement textLower = app_.CreateTextElement1(
                null, leaderInfo_.TextLines[1], app_.Point3dZero(), app_.Matrix3dZero());
            textLower.Redraw(BCOM.MsdDrawingMode.Temporary);
            textLower.set_Origin(points_[2].shift(dY: -textUpper.Range.getHeight() * 0.25));

            double maxwidth =
                Math.Max(textUpper.Range.getWidth(), textLower.Range.getWidth());

            if (kX < 0)
            {
                textUpper.set_Origin(textUpper.get_Origin().shift(-maxwidth));
                textLower.set_Origin(textLower.get_Origin().shift(-maxwidth));
            }

            points_[3] = app_.Point3dFromXY(points_[2].X +
                                            kX * (maxwidth + leaderInfo_.GapTextAfter), points_[2].Y);

            BCOM.Element line = app_.CreateLineElement1(null, points_);
            elements.Add(line);

            elements.Add(textUpper);
            elements.Add(textLower);

            return(app_.CreateCellElement1(
                       "PenetrLeader", elements.ToArray(), points_[0]));
        }
Example #3
0
        BCOM.TextElement CreatePileSkewnessText(IPileProperty pileprop)
        {
            //double uorpermaster = app.ActiveModelReference.UORsPerMasterUnit;
            BCOM.Point3d centroidp = pileprop.PileTopPoint.Point3dToBCOMPoint3d(1e4 / uorpermaster);
            centroidp.Z = 0; // xy plane
            BCOM.Point3d     zerop = app.Point3dZero();
            BCOM.Point3d     textelefirstpoisition = app.Point3dFromXY(pileprop.PileDiameter * 1e4 / uorpermaster, 0);
            BCOM.Matrix3d    identitym             = app.Matrix3dIdentity();
            BCOM.TextElement textele = app.CreateTextElement1(null, Utilities.GetPileSkewnessString(pileprop.GetCosAlpha()), ref textelefirstpoisition, ref identitym);

            BG.DVector3d linevector    = new BG.DVector3d(pileprop.PileTopPoint.Point3dToDPoint3d(), pileprop.PileBottomPoint.Point3dToDPoint3d());
            double       xyrotationRad = linevector.AngleXY.Radians;

            textele.RotateAboutZ(ref zerop, xyrotationRad);
            textele.Move(ref centroidp);
            return(textele);
        }