Пример #1
0
        //BCOM.LineElement[] CreateAxisGrid()
        //{
        //    Tuple<BCOM.Point3d, BCOM.Point3d> temp = new Tuple<BCOM.Point3d, BCOM.Point3d>(app.Point3dZero(), app.Point3dZero());
        //    app.createli
        //}

        public void CreateMap()
        {
            BCOM.ModelReference modelref = AddNewModelReference("桩位图");
            modelref.Activate();

            List <BCOM.Element> elelist = new List <BCOM.Element>();

            BG.DVector3d pilevector;
            foreach (var pile in Piles)
            {
                pilevector = new BG.DVector3d(pile.PilePropertyInfo.PileTopPoint.Point3dToDPoint3d(), pile.PilePropertyInfo.PileBottomPoint.Point3dToDPoint3d());
                if (!pilevector.IsParallelOrOppositeTo(BG.DVector3d.UnitZ))
                {
                    elelist.AddRange(CreateArrowElement(pile.PilePropertyInfo.PileTopPoint, pile.PilePropertyInfo));
                }
                elelist.Add(CreatePileSkewnessText(pile.PilePropertyInfo));
                elelist.Add(CreatePileCrossSectionElement(pile.PilePropertyInfo));
                elelist.Add(CreatePilePositionText(pile.PilePropertyInfo.PileTopPoint, pile.PileCode));
            }

            foreach (var ele in elelist)
            {
                app.ActiveModelReference.AddElement(ele);
            }

            app.MessageCenter.AddMessage("桩位图绘制完成", "请在[桩位图]模型中查看", BCOM.MsdMessageCenterPriority.Info);
        }
Пример #2
0
        //posistion unit:m
        BCOM.LineElement[] CreateArrowElement(Point3d position, IPileProperty pileprop)
        {
            //double uorpermaster = app.ActiveModelReference.UORsPerMasterUnit;
            BCOM.Point3d centroidp = position.Point3dToBCOMPoint3d(1e4 / uorpermaster);
            centroidp.Z = 0; // 平面
            BG.DVector3d linevector     = new BG.DVector3d(pileprop.PileTopPoint.Point3dToDPoint3d(), pileprop.PileBottomPoint.Point3dToDPoint3d());
            double       xyrotationRad  = linevector.AngleXY.Radians;
            double       arrowbarlength = 5 * pileprop.PileDiameter * 1e4 / uorpermaster;

            BCOM.Point3d     startp = app.Point3dZero(), endp = app.Point3dFromXY(arrowbarlength, 0);
            BCOM.LineElement bar      = app.CreateLineElement2(null, ref startp, ref endp);
            BCOM.Point3d     wingendp = app.Point3dFromXY(-arrowbarlength / 3, 0);
            var wing1 = app.CreateLineElement2(null, ref startp, ref wingendp);
            var wing2 = wing1.Clone().AsLineElement();

            wing1.RotateAboutZ(ref startp, app.Radians(25));
            wing2.RotateAboutZ(ref startp, app.Radians(-25));
            wing1.Move(ref endp); wing2.Move(ref endp);
            var lineArray = new BCOM.LineElement[] { bar, wing1, wing2 };

            foreach (var line in lineArray)
            {
                line.RotateAboutZ(ref startp, xyrotationRad);
                line.Move(ref centroidp);
                line.Color = 2;
                //line.LineWeight = 3;
            }
            return(lineArray);
        }
Пример #3
0
        public override BD.StatusInt OnElementModify(BDE.Element element)
        {
            BDE.ShapeElement shape = element as BDE.ShapeElement;
            if (shape == null)
            {
                return(BD.StatusInt.Error);
            }
            BG.CurveVector  curveVector = shape.GetCurveVector();
            BG.DTransform3d world2LoaclDTransform3D;
            BG.DTransform3d loacl2WorlDTransform3D;
            BG.DRange3d     shapeRange3D;
            curveVector.IsPlanar(out loacl2WorlDTransform3D, out world2LoaclDTransform3D, out shapeRange3D);
            BG.DMatrix3d       rotMatrix3D = loacl2WorlDTransform3D.Matrix;
            List <BG.DPoint3d> points      = new List <BG.DPoint3d>();

            curveVector.GetPrimitive(0).TryGetLineString(points);

            BG.DSegment3d linex = new BG.DSegment3d(points[0], points[1]);
            BG.DSegment3d liney = new BG.DSegment3d(points[0], points[3]);

            int ucellnum = 0;
            int vcellnum = 0;

            if (isOutRect)
            {
                ucellnum = (int)Math.Ceiling(linex.Length / uaxisoffset);
                vcellnum = (int)Math.Ceiling(liney.Length / vaxisoffset);
            }
            else
            {
                ucellnum = (int)Math.Floor(linex.Length / uaxisoffset);
                vcellnum = (int)Math.Floor(liney.Length / vaxisoffset);
            }

            double ufraction = uaxisoffset / linex.Length;
            double vfraction = vaxisoffset / liney.Length;

            for (int i = 0; i < vcellnum; i++)
            {
                BG.DPoint3d yaxisPoint = liney.PointAtFraction(i * vfraction);
                for (int j = 0; j < ucellnum; j++)
                {
                    BG.DPoint3d  xaxisPoint  = linex.PointAtFraction(j * ufraction);
                    BG.DVector3d xyDVector3D = BG.DVector3d.Add(BG.DPoint3d.Subtract(xaxisPoint, points[0]), BG.DPoint3d.Subtract(yaxisPoint, points[0]));
                    BG.DPoint3d  putPoint3D  = BG.DPoint3d.Add(points[0], xyDVector3D);
                    CellFunction.PlaceCell(new ArmorCellInfo()
                    {
                        CellName  = cellName,
                        CellTrans = rotMatrix3D,
                        Origin    = putPoint3D
                    });
                    Bentley.UI.Threading.DispatcherHelper.DoEvents();
                }
            }
            return(BD.StatusInt.Success);
        }
Пример #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);
        }