Exemplo n.º 1
0
        public static BCOM.Point3d getMiddlePoint(BCOM.Point3d first, BCOM.Point3d second)
        {
            BCOM.Vector3d vec =
                App.Vector3dSubtractPoint3dPoint3d(second, first);

            return(App.Point3dAddScaledVector3d(first, vec, 0.5));
        }
Exemplo n.º 2
0
        public static BCOM.LineElement getElementRangeBox(BCOM.Element el)
        {
            BCOM.View view = ViewHelper.getActiveView();

            BCOM.Point3d[] verts = new BCOM.Point3d[16];
            verts[0]     = el.Range.Low;
            verts[1]     = verts[0];
            verts[1].X   = el.Range.High.X;
            verts[2]     = verts[1];
            verts[2].Y   = el.Range.High.Y;
            verts[3]     = verts[2];
            verts[3].X   = el.Range.Low.X;
            verts[4]     =
                verts[5] = verts[0];
            verts[5].Z   = el.Range.High.Z;
            verts[6]     = verts[5];
            verts[6].Y   = el.Range.High.Y;
            verts[7]     = verts[6];
            verts[7].X   = el.Range.High.X;
            verts[8]     = verts[7];
            verts[8].Y   = el.Range.Low.Y;
            verts[9]     = verts[5];
            verts[10]    = verts[6];
            verts[11]    = verts[3];
            verts[12]    = verts[2];
            verts[13]    = verts[7];
            verts[14]    = verts[8];
            verts[15]    = verts[1];

            return(App.CreateLineElement1(null, verts));
        }
Exemplo n.º 3
0
        private void init(BCOM.Element element, Sp3dTask_Old task)
        {
            elemRef  = element.MdlElementRef();
            modelRef = element.ModelReference.MdlModelRefP();
            elemId   = element.ID;
            Oid      = task.pipe.Oid;

            if (task.pipe == null || task.component == null)
            {
                ErrorText = "Не удалось прочитать данные задания";
                return;
            }

            Code = task.pipe.Name;

            BCOM.Point3d pt = new BCOM.Point3d();
            pt.X     = task.pipe.LocationX;
            pt.Y     = task.pipe.LocationY;
            pt.Z     = task.pipe.LocationZ;
            Location = pt;

            // разбор типоразмера:
            try
            {
                string[] parameters = task.pipe.Description.TrimStart('T').Split('-');
                Diametr = int.Parse(parameters[1]);
            }
            catch (Exception)
            {
                ErrorText = string.Format("Не удалость разобрать типоразмер \"{0}\"",
                                          task.pipe.Description);
            }
        }
Exemplo n.º 4
0
        public static bool IsPlanesAreParallel(BCOM.Plane3d first, BCOM.Plane3d second)
        {
            BCOM.Point3d secondNegateNormal = App.Point3dNegate(ref second.Normal);

            return(App.Point3dAreVectorsParallel(first.Normal, second.Normal) ||
                   App.Point3dAreVectorsParallel(first.Normal, secondNegateNormal));
        }
Exemplo n.º 5
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.º 6
0
 private PenetrVueTask(BCOM.Point3d location, long flangeType, int lengthCm)
 {
     initialize_();
     rawLocation_     = location;
     this.FlangesType = flangeType;
     this.LengthCm    = lengthCm;
 }
Exemplo n.º 7
0
        public override TFPerforatorList GetPerfoList()
        {
            double pipeOutsideDiam = PenInfo.pipeDiameterOutside / taskUOR.activeSubPerMaster;
            double length          = Task.LengthCm * 10 / taskUOR.activeSubPerMaster;

            var angles = Task.CorrectiveAngles;

            BCOM.Transform3d taskTran = App.Transform3dFromMatrix3d(Task.Rotation);

            // ПЕРФОРАТОР
            BCOM.EllipseElement perfoEl =
                App.CreateEllipseElement2(null, App.Point3dZero(),
                                          pipeOutsideDiam / 2, pipeOutsideDiam / 2,
                                          App.Matrix3dIdentity(), BCOM.MsdFillMode.Filled);
            {
                BCOM.Point3d offset = App.Point3dAddScaled(
                    App.Point3dZero(),
                    App.Point3dFromXYZ(0, 0, 1), length / 2);
                perfoEl.Move(offset);
                perfoEl.Rotate(App.Point3dZero(), angles.X, angles.Y, angles.Z);
            }
            perfoEl.Level = ElementHelper.GetOrCreateLevel(PenConfigVariables.PerfoLevel);
            ElementHelper.setSymbologyByLevel(perfoEl);
            perfoEl.Transform(taskTran);
            perfoEl.Move(Task.Location);

            BCOM.Point3d perfoVec = perfoEl.Normal;

            TFCOM.TFPerforatorList perfoList = AppTF.CreateTFPerforator();
            var tranIdentity = App.Transform3dIdentity();

            perfoList.InitFromElement(perfoEl, perfoVec, length / 2 * 1.01, tranIdentity);
            return(perfoList);
        }
Exemplo n.º 8
0
        private BCOM.Point3d getLocation_(XDocument xdoc)
        {
            BCOM.Point3d pt = App.Point3dZero();

            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("Location"))
                    {
                        if (name.IsMatch("X$"))
                        {
                            pt.X = node.Value.ToDouble();
                        }
                        else if (name.IsMatch("Y$"))
                        {
                            pt.Y = node.Value.ToDouble();
                        }
                        else if (name.IsMatch("Z$"))
                        {
                            pt.Z = node.Value.ToDouble();
                        }
                    }
                }
            }
            return(pt);
        }
Exemplo n.º 9
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.º 10
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);
        }
Exemplo n.º 11
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.º 12
0
 public static BCOM.Point3d roundExt(BCOM.Point3d pt, double snap)
 {
     BCOM.Point3d res;
     res.X = roundEx_(pt.X, snap);
     res.Y = roundEx_(pt.Y, snap);
     res.Z = roundEx_(pt.Z, snap);
     return(res);
 }
Exemplo n.º 13
0
 public static BCOM.Point3d shift(this BCOM.Point3d p3d,
                                  double dX = 0.0, double dY = 0.0, double dZ = 0.0)
 {
     BCOM.Point3d pt = App.Point3dZero();
     pt.X = p3d.X + dX;
     pt.Y = p3d.Y + dY;
     pt.Z = p3d.Z + dZ;
     return(pt);
 }
Exemplo n.º 14
0
 public void LocateFilter(BCOM.Element element, ref BCOM.Point3d point, ref bool accepted)
 {
     accepted = false;
     if (element != null && element.IsPenetrationCell())
     {
         accepted = true;
         startLeaderPrimitive(element);
     }
 }
Exemplo n.º 15
0
        private PenetrVueTask(Element element, Sp3dPenTask task)
        {
            if (task == null)
            {
                return;
            }

            initialize_(element);

            Oid = task.Oid;
            UID = task.UID;

            rawLocation_ = (!App.Point3dEqual(task.Location, App.Point3dZero()))
            ?  task.Location :  Cell.Origin;

            long activeModelRef = App.ActiveModelReference.MdlModelRefP();

            if (ModelRef.IsAttachmentOf(App.ActiveModelReference))
            {
                rawLocation_ = App.Point3dScale(rawLocation_, UOR.subPerMaster);
            }

            Rotation = task.Rotation;

            Code = task.Code;
            // разбор типоразмера:
            parseTypeSize(task.Name);

            if (task.XAttrDoc.Root.GetChild("P3DEquipment") != null)
            {
                TaskType = TaskTypeEnum.PipeEquipment;
            }
            else if (task.XAttrDoc.Root.GetChild("P3DHangerPipeSupport") != null &&
                     task.XAttrDoc.Root.GetChild("P3DHangerStdComponent") != null)
            {
                TaskType = TaskTypeEnum.PipeOld;
            }
            else
            {
                TaskType = TaskTypeEnum.Pipe;
            }

            if (TaskType == TaskTypeEnum.Pipe)
            {
                findFlanges();
            }
            else
            {
                findFlangesOld();
            }

            scanInfo();

            // важно в конце - после определения пересечений
            RefPoints[0] = Location;
        }
Exemplo n.º 16
0
        public MstnNodeData(long parID, long ID, BCOM.Point3d rmCoordinates, BCOM.Element nodeElement, BCOM.LineElement lineElement, string nodeName, string nodeDescr)
        {
            //ParentNodeID = 0;// ;
            this.ID          = nodeElement.ID;
            this.nodeElement = nodeElement;

            //if (sourceElement.IsCellElement())
            //    //this in as LV transfomer
            //else
            //    //it is  a source shape, ellipse
        }
Exemplo n.º 17
0
        private void transformToBase(BCOM.Element element, BCOM.Point3d origin)
        {
            // инвертируем трансформацию:
            if (App.Matrix3dHasInverse(Rotation))
            {
                BCOM.Transform3d tran = App.Transform3dFromMatrix3d(Rotation);
                element.Transform(App.Transform3dInverse(tran));
            }
            var angles = CorrectiveAngles;

            element.Rotate(App.Point3dZero(), -angles.X, -angles.Y, -angles.Z);
        }
Exemplo n.º 18
0
 public void LocateFilter(BCOM.Element Element, ref BCOM.Point3d Point, ref bool Accepted)
 {
     if (Element.IsCellElement())
     {
         if (Element.AsCellElement().Name == "Embankment" || Element.AsCellElement().Name == "RetainWall" ||
             Element.AsCellElement().Name == "Pond" || Element.AsCellElement().Name == "Road" ||
             Element.AsCellElement().Name == "OpenChannel" || Element.AsCellElement().Name == "Dike")
         {
             AddInMain.ComApp.ShowPrompt("GeoTag element selected, data point to accept.");
             Accepted = true;
         }
     }
 }
Exemplo n.º 19
0
        private void ensureLocateEnabled(ref BCOM.Point3d Point, BCOM.View View)
        {
            if (ensureLocateEnabledRequired_)
            { // ! unblock Locate
                ensureLocateEnabledRequired_ = false;
                app_.CommandState.StopDynamics();

                app_.CommandState.LocateElement(ref Point, View, true);
                app_.CommandState.GetHitPath();

                app_.CommandState.StartDynamics();
            }
        }
Exemplo n.º 20
0
        public static DPoint3d closestPointOnSurf(DPoint3d point, ISurface surf, double tol)
        {
            Bentley.Interop.MicroStationDGN.Point3d cpRef = new Bentley.Interop.MicroStationDGN.Point3d();
            cpRef.X = point.X;
            cpRef.Y = point.Y;
            cpRef.Z = point.Z;

            Bentley.Interop.MicroStationDGN.Point3d cp = new Bentley.Interop.MicroStationDGN.Point3d();
            Bentley.Interop.MicroStationDGN.Point2d cp2d = new Bentley.Interop.MicroStationDGN.Point2d();

            GeometryTools.BSplineSurfaceComputeMinimumDistance(ref cp, ref cp2d, ref cpRef, tol, surf.com_bsplineSurface);

            return new DPoint3d(cp.X, cp.Y, cp.Z);
        }
Exemplo n.º 21
0
        public static BCOM.ArcElement createCircle(
            double diameter, BCOM.Point3d?origin = null)
        {
            BCOM.Point3d center =
                origin.HasValue ? origin.Value : App.Point3dZero();

            var rot = App.Matrix3dIdentity();

            //return App.CreateEllipseElement2(null, origin,
            //    diameter/2, diameter/2, rot, BCOM.MsdFillMode.NotFilled);

            return(App.CreateArcElement2(null, center, diameter / 2, diameter / 2,
                                         rot, 0, Math.PI * 2));
        }
Exemplo n.º 22
0
        //WS: note: the drop command is uing MS built UI command, so always make sure element got selected first.
        private void btnDrop_Click(object sender, EventArgs e)
        {
            BCOM.CellElement oCel = null;

            BCOM.ElementEnumerator oEnum = AddInMain.ComApp.ActiveModelReference.GetSelectedElements();

            BCOM.Element[] oEleSet = oEnum.BuildArrayFromContents();

            if (oEleSet.Length != 1)
            {
                AddInMain.ComApp.CadInputQueue.SendCommand("CHOOSE NONE");
                AddInMain.ComApp.CommandState.StartLocate(new DropTagCell());
            }

            if (oEleSet.Length == 1)
            {
                if (oEleSet[0].IsCellElement())
                {
                    if (oEleSet[0].AsCellElement().Name == "Embankment" || oEleSet[0].AsCellElement().Name == "Dike" || oEleSet[0].AsCellElement().Name == "Pond" ||
                        oEleSet[0].AsCellElement().Name == "Road" || oEleSet[0].AsCellElement().Name == "OpenChannel" || oEleSet[0].AsCellElement().Name == "RetainWall")
                    {
                        oCel = oEleSet[0].AsCellElement();

                        oECAdaptor.DeleteInstancesOnElement(oCel, oCel.Name);

                        //WS: delete the ECInstance first.
                        //oECAdaptor.DeleteInstancesOnElement(oCel, "Tag");
                        BCOM.Point3d oPt = oCel.Origin;

                        //WS: window pops up here
                        AddInMain.ComApp.CadInputQueue.SendCommand("DROP ELEMENT");
                        AddInMain.ComApp.SetCExpressionValue("dropOptions.complex", -1, "DROP");

                        int iActiveViewNum = Commons.GetActiveViewIndex();
                        AddInMain.ComApp.CadInputQueue.SendDataPoint(ref oPt, iActiveViewNum);

                        MessageBox.Show("Please re-select elements for old tag, and start Step 3.");

                        btnSelect.Enabled = false;
                        btnDrop.Enabled   = false;
                        btnEdit.Enabled   = true;
                    }
                    else
                    {
                        AddInMain.ComApp.CadInputQueue.SendCommand("CHOOSE NONE");
                        AddInMain.ComApp.CommandState.StartLocate(new DropTagCell());
                    }
                }
            }
        }
Exemplo n.º 23
0
        private GroupByTaskModel()
        {
            penData_ = PenetrDataSource.Instance;

            TaskTable = new DataTable();
            TaskTable.Columns.Add(FieldName.STATUS, typeof(string));
            TaskTable.Columns.Add(PropKey.CODE, typeof(string));
            TaskTable.Columns.Add(PropKey.NAME, typeof(string));
            TaskTable.Columns.Add(FieldName.FLANGES, typeof(long));
            TaskTable.Columns.Add(FieldName.DIAMETER, typeof(string));
            TaskTable.Columns.Add(FieldName.LENGTH, typeof(int));
            TaskTable.Columns.Add(FieldName.REF_POINT1, typeof(string));
            TaskTable.Columns.Add(FieldName.REF_POINT2, typeof(string));
            TaskTable.Columns.Add(FieldName.REF_POINT3, typeof(string));

            foreach (Sp3dToDataGroupMapProperty item in Sp3dToDGMapping.Instance.Items)
            {
                if (item.Key == PropKey.CODE || item.Key == PropKey.NAME)
                {
                    continue;
                }

                if (!string.IsNullOrEmpty(item.TargetXPath))
                {
                    TaskTable.Columns.Add(item.TargetName, typeof(string));
                }
            }
            TaskTable.RowChanged += TaskTable_RowChanged;
            signOnNotify(NP.SelectionCount, NP.TaskSelection);


            BCOM.Point3d     zero = App.Point3dZero();
            BCOM.LineElement line = App.CreateLineElement2(null, zero, zero);
            line.Color = 255;

            selectionTranCon_ = App.CreateTransientElementContainer1(
                line,
                BCOM.MsdTransientFlags.DisplayFirst |
                BCOM.MsdTransientFlags.Overlay,
                BCOM.MsdViewMask.AllViews,
                BCOM.MsdDrawingMode.Temporary);

            previewTranCon_ = App.CreateTransientElementContainer1(
                line,
                BCOM.MsdTransientFlags.DisplayFirst |
                BCOM.MsdTransientFlags.Overlay | BCOM.MsdTransientFlags.Snappable | BCOM.MsdTransientFlags.IncludeInPlot,
                BCOM.MsdViewMask.AllViews,
                BCOM.MsdDrawingMode.Temporary);
        }
Exemplo n.º 24
0
        public void SetRefPoint(int index, string coords)
        {
            BCOM.Point3d?pointInfo = ElementHelper.GetPoint3d(coords);

            if (!pointInfo.HasValue)
            {
                RefPoints[index] = null;
            }
            else if (index < RefPoints.Length)
            {
                BCOM.Point3d pt = RoundTool.roundExt(
                    pointInfo.Value, /* 5 мм */ 5 / UOR.activeSubPerMaster);
                RefPoints[index] = pt;
            }
        }
Exemplo n.º 25
0
        public static bool CreateDefpointsLevel(BCOM.Point3d startpoint)
        {
            //bool createDefpointsLevel_ = false;

            // ActiveSettings.Level = ActiveDesignFile.Levels("Defpoints")

            if (!(LevelExists("Defpoints")))
            {
                BCOM.Point3d point;

                // Dim startpoint As BCOM.Point3d
                BCOM.Point3d point2;
                // Dim lngTemp As Long

                // Start a command
                Program.MSApp.CadInputQueue.SendCommand("LEVELMANAGER DIALOG TOGGLE");

                Program.MSApp.CadInputQueue.SendCommand("LEVELMANAGER LEVEL NEWFROMGUI");

                // Send a keyin that can be a command string
                Program.MSApp.CadInputQueue.SendKeyin("LEVEL SET NAME \"New Level (0)\" \"Defpoints\"");

                // Set a variable associated with a dialog box
                Program.MSApp.SetCExpressionValue("lvlmangrGlobals.wLevelName", "Defpoints", "LVLMANGR");

                Program.MSApp.CadInputQueue.SendKeyin("LEVEL SET PLOT OFF   \"Defpoints\"");

                point  = startpoint;
                point2 = point;
                Program.MSApp.CadInputQueue.SendDragPoints(ref point, ref point2, 1);

                Program.MSApp.CadInputQueue.SendDataPoint(ref point, 1);

                Program.MSApp.CadInputQueue.SendDragPoints(ref point, ref point2, 1);

                Program.MSApp.CommandState.StartDefaultCommand();
            }

            if (LevelExists("Defpoints"))
            {
                if (Program.MSApp.ActiveDesignFile.Levels["Defpoints"].Plot == true)
                {
                    Program.MSApp.ActiveDesignFile.Levels["Defpoints"].Plot = false;
                }
                return(true);
            }
            return(false);
        }
Exemplo n.º 26
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.º 27
0
 public MstnNodeData(long ID, BCOM.Point3d rmCoordinates, BCOM.Element nodeElement, BCOM.LineElement lineElement, string nodeName, string nodeDescr)
 {
     this.ParentNodeID     = -1;
     this.ID               = nodeElement.ID;
     this.nodeElement      = nodeElement;
     this.nodeName         = nodeName;
     this.nodeDescription  = nodeDescr;
     this._reticMasterPt3D = rmCoordinates;
     this.conductor        = lineElement;
     //if (nodeElement.IsCellElement())
     //    this in as LV transfomer
     //    get MVLV cell in that position
     //    assign the parent node ID to the mvlv cell id
     //else
     //    it is a source shape, ellipse
     //   ParentNodeID = 0;
 }
Exemplo n.º 28
0
        public void DataPoint(ref BCOM.Point3d Point, BCOM.View View)
        {
            PenetrUserTask userTask;

            if (!processInput(out userTask, ref Point, View))
            {
                return;
            }

            PenetrInfo penInfo = PenetrDataSource.Instance.getPenInfo(
                userTask.FlangesType,
                userTask.DiameterType.Number);

            ElementHelper.RunByRecovertingSettings(() => {
                PenetrHelper.addToModel(userTask, penInfo);
            });
        }
Exemplo n.º 29
0
        public static BCOM.LineElement createCrossInContour(
            BCOM.VertexList contour)
        {
            BCOM.Point3d[] shapeVerts = contour.GetVertices();
            var            shape      = App.CreateShapeElement1(null, shapeVerts);

            BCOM.Point3d centroid = shape.Centroid();

            var points = new List <BCOM.Point3d>();

            foreach (BCOM.Point3d vert in shapeVerts)
            {
                points.Add(vert);
                points.Add(centroid);
            }

            return(App.CreateLineElement1(null, points.ToArray()));
        }
Exemplo n.º 30
0
        public BCOM.Point3d ReticMCoordinates(BCOM.Point3d flashOrigin)
        {
            BCOM.Point3d finalPoint3D;/// ;// xCoord, yCoord;
            if (this.nodeElement.IsCellElement())
            {
                finalPoint3D.X = this.nodeElement.AsCellElement().Origin.X + flashOrigin.X;
                finalPoint3D.Y = this.nodeElement.AsCellElement().Origin.Y + flashOrigin.Y;
                finalPoint3D.Z = this.nodeElement.AsCellElement().Origin.Z;// ;
            }
            else
            {
                finalPoint3D.X = this.nodeElement.AsEllipseElement().CenterPoint.X + flashOrigin.X;
                finalPoint3D.Y = this.nodeElement.AsEllipseElement().CenterPoint.Y + flashOrigin.Y;
                finalPoint3D.Z = this.nodeElement.AsEllipseElement().CenterPoint.Z;// ;
            }

            return(finalPoint3D);
        }
Exemplo n.º 31
0
        public static DPoint3d closestPointOnSurf(DPoint3d point, ISurface surf, double tol, out double Dist, out Point2d UV, out DVector3d normal)
        {
            Bentley.Interop.MicroStationDGN.Point3d cpRef = new Bentley.Interop.MicroStationDGN.Point3d();
            cpRef.X = point.X;
            cpRef.Y = point.Y;
            cpRef.Z = point.Z;

            Bentley.Interop.MicroStationDGN.Point3d cp = new Bentley.Interop.MicroStationDGN.Point3d();
            Bentley.Interop.MicroStationDGN.Point2d cp2d = new Bentley.Interop.MicroStationDGN.Point2d();

            Dist = GeometryTools.BSplineSurfaceComputeMinimumDistance(ref cp, ref cp2d, ref cpRef, tol, surf.com_bsplineSurface);
            UV = new Point2d();
            UV.X = cp2d.X;
            UV.Y = cp2d.Y;

            normal = NormalAtUVParameterOnSurface(surf.com_bsplineSurface, UV.X, UV.Y);

            return new DPoint3d(cp.X, cp.Y, cp.Z);
        }
Exemplo n.º 32
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);
        }