Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
0
        public static T transformByTask <T>(this T element, IPenetrTask task,
                                            double shiftX = 0.0, double shiftY = 0.0, double shiftZ = 0.0)
            where T : BCOM.Element
        {
            BCOM.Point3d shiftPoint = App.Point3dFromXYZ(shiftX, shiftY, shiftZ);
            element.Move(ref shiftPoint);

            BCOM.Point3d zero   = App.Point3dZero();
            var          angles = task.CorrectiveAngles;

            element.Rotate(ref zero, angles.X, angles.Y, angles.Z);

            BCOM.Matrix3d    rotation    = task.Rotation;
            BCOM.Transform3d transform3d = App.Transform3dFromMatrix3d(ref rotation);
            element.Transform(ref transform3d);

            BCOM.Point3d location = task.Location;
            element.Move(ref location);
            return(element);
        }
Exemplo n.º 6
0
 public static DMatrix3d ToDMatrix3d(this BCOM.Matrix3d rotation)
 {
     return(DMatrix3d.FromRows(rotation.RowX.ToDVector(),
                               rotation.RowY.ToDVector(), rotation.RowZ.ToDVector()));
 }
Exemplo n.º 7
0
        private BCOM.Matrix3d getRotation_(XDocument xdoc)
        {
            BCOM.Matrix3d rot = App.Matrix3dIdentity();
            foreach (XElement tag in xdoc.Root.Elements())
            {
                string tagName = tag.Name.LocalName;
                if (!tagName.IsMatch("(P3DEquipment)|(P3DHangerPipeSupport)"))
                {
                    continue;
                }

                foreach (XElement node in tag.Elements())
                {
                    string name = node.Name.LocalName;
                    if (name.IsMatch("OrientationMatrix"))
                    {
                        if (name.IsMatch("x0$"))
                        {
                            rot.RowX.X = node.Value.ToDouble();
                        }
                        else if (name.IsMatch("x1$"))
                        {
                            rot.RowX.Y = node.Value.ToDouble();
                        }
                        else if (name.IsMatch("x2$"))
                        {
                            rot.RowX.Z = node.Value.ToDouble();
                        }
                        else if (name.IsMatch("y0$"))
                        {
                            rot.RowY.X = node.Value.ToDouble();
                        }
                        else if (name.IsMatch("y1$"))
                        {
                            rot.RowY.Y = node.Value.ToDouble();
                        }
                        else if (name.IsMatch("y2$"))
                        {
                            rot.RowY.Z = node.Value.ToDouble();
                        }
                        else if (name.IsMatch("z0$"))
                        {
                            rot.RowZ.X = node.Value.ToDouble();
                        }
                        else if (name.IsMatch("z1$"))
                        {
                            rot.RowZ.Y = node.Value.ToDouble();
                        }
                        else if (name.IsMatch("z2$"))
                        {
                            rot.RowZ.Z = node.Value.ToDouble();
                        }
                    }
                }
            }

            rot.RowX = RoundTool.roundExt(rot.RowX, 0.00001);
            rot.RowY = RoundTool.roundExt(rot.RowY, 0.00001);
            rot.RowZ = RoundTool.roundExt(rot.RowZ, 0.00001);

            return(rot);
        }