Пример #1
0
            protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
            {
                // SHOW POSITION VALUE

                Autodesk.AutoCAD.GraphicsInterface.WorldGeometry wg2 = draw.Geometry as Autodesk.AutoCAD.GraphicsInterface.WorldGeometry;

                if (wg2 != null)
                {
                    // Push our transforms onto the stack

                    wg2.PushOrientationTransform(Autodesk.AutoCAD.GraphicsInterface.OrientationBehavior.Screen);

                    wg2.PushPositionTransform(Autodesk.AutoCAD.GraphicsInterface.PositionBehavior.Screen, new Point2d(30, 30));

                    // Draw our screen-fixed text

                    wg2.Text(

                        new Point3d(0, 0, 0),                                                          // Position

                        new Vector3d(0, 0, 1),                                                         // Normal

                        new Vector3d(1, 0, 0),                                                         // Direction

                        BasePoint.ToString() + ":" + NewAngle.ToString() + ":" + BaseAngle.ToString(), // Text

                        true,                                                                          // Rawness

                        _style                                                                         // TextStyle

                        );


                    // Remember to pop our transforms off the stack

                    wg2.PopModelTransform();

                    wg2.PopModelTransform();
                }

                // END OF SHOW POSITION VALUE

                if (GetPoint)
                {
                    Entities.Clear();
                    Entities.Add(CreateMeasuredJackpanelEntity(BasePoint));
                    Entities.Add(CreateLine(new Point3d(BasePoint.X + 6, BasePoint.Y + 5, 0), new Point3d(BasePoint.X - 6, BasePoint.Y - 5, 0), 0, 0, 0));

                    //~~~~~~~~ SCALE ~~~~~~~~~~

                    Matrix3d trans1 = Matrix3d.Scaling(MyScale, new Point3d(BasePoint.X, BasePoint.Y, 0));
                    foreach (Entity en in Entities)
                    {
                        en.TransformBy(trans1);
                    }

                    //~~~~~~~~~~~~~~~~~~~~~~~~~
                }
                else if (GetAngle)
                {
                    Matrix3d trans = Matrix3d.Rotation(NewAngle - BaseAngle, ed.CurrentUserCoordinateSystem.CoordinateSystem3d.Zaxis,

                                                       new Point3d(BasePoint.X, BasePoint.Y, 0));


                    foreach (Entity en in Entities)
                    {
                        en.TransformBy(trans);
                    }

                    BaseAngle = NewAngle;
                    //NewAngle = 0;
                }

                //~~~~~~~~ SCALE ~~~~~~~~~~

                //////if (Atend.Control.Common.SelectedDesignScale != 0)
                //////{
                //////    double ScaleValue = 1 / Atend.Control.Common.SelectedDesignScale;
                //////    Matrix3d trans1 = Matrix3d.Scaling(1.50,

                //////                       new Point3d(BasePoint.X, BasePoint.Y, 0));

                //////    foreach (Entity en in Entities)
                //////    {

                //////        en.TransformBy(trans1);

                //////    }
                //////}

                //~~~~~~~~~~~~~~~~~~~~~~~~~


                foreach (Entity en in Entities)
                {
                    draw.Geometry.Draw(en);
                }


                return(true);
            }
            protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
            {
                Entities.Clear();
                Autodesk.AutoCAD.GraphicsInterface.WorldGeometry wg2 = draw.Geometry as Autodesk.AutoCAD.GraphicsInterface.WorldGeometry;
                string STR = "**";
                Editor ed  = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

                AcDrawSecsionerCell.DrawSecionerCellJig02    Secsioner;
                AcDrawDezhangtorCell.DrawDezhangtorCellJig02 Dezhangtor;
                AcDrawBusCouplerSecsionerCell.DrawBusCouplerSecsionerCellJig02   BusSecsioner;
                AcDrawBusCouplerDezhangtorCell.DrawBusCouplerDezhangtorCellJig02 BusDezhangtor;
                AcDrawMeasureCell.DrawMeasureCellJig02   Measure;
                AcDrawReleCell.DrawReleCellJig02         Rele;
                AcDrawFuziblCell.DrawFuziblCellCellJig02 Fuzibl;
                //List<Guid> Guids = new List<Guid>();

                int CellCounter = 1;

                if (MiddleJaclPanelParentCode != Guid.Empty)
                {
                    //foreach (Atend.Base.Equipment.EJackPanelCell jc in Cells)
                    foreach (Guid Key in Cells.Keys)
                    {
                        Atend.Base.Equipment.EJackPanelCell CellTemp = Cells[Key];
                        if (CellTemp != null)
                        {
                            switch (CellTemp.ProductType)
                            {
                            case 1:
                                //اندازه گیری
                                STR = STR + "001";
                                if (Key != null)
                                {
                                    Measure = new AcDrawMeasureCell.DrawMeasureCellJig02(CellTemp.ProductCode, Key, MyScale);
                                    List <Entity> TempEnt1 = Measure.GetDemo(new Point3d(CenterPoint.X + (CellCounter - 1) * 40, CenterPoint.Y, CenterPoint.Z));
                                    foreach (Entity ent in TempEnt1)
                                    {
                                        Entities.Add(ent);
                                    }
                                }
                                break;

                            case 2:
                                //رله
                                STR = STR + "002";
                                if (Key != null)
                                {
                                    Rele = new AcDrawReleCell.DrawReleCellJig02(CellTemp.ProductCode, Key, MyScale);
                                    List <Entity> TempEnt1 = Rele.GetDemo(new Point3d(CenterPoint.X + (CellCounter - 1) * 40, CenterPoint.Y, CenterPoint.Z));
                                    foreach (Entity ent in TempEnt1)
                                    {
                                        Entities.Add(ent);
                                    }
                                }

                                break;

                            case 3:
                                //کلید سکسیونر
                                STR = STR + "003";
                                if (Key != null)
                                {
                                    Secsioner = new AcDrawSecsionerCell.DrawSecionerCellJig02(CellTemp.ProductCode, Key, MyScale);
                                    List <Entity> TempEnt1 = Secsioner.GetDemo(new Point3d(CenterPoint.X + (CellCounter - 1) * 40, CenterPoint.Y, CenterPoint.Z));
                                    foreach (Entity ent in TempEnt1)
                                    {
                                        Entities.Add(ent);
                                    }
                                }
                                break;

                            case 4:
                                //کلید دژنکتور
                                STR = STR + "004";
                                if (Key != null)
                                {
                                    //STR = STR + "004";
                                    Dezhangtor = new AcDrawDezhangtorCell.DrawDezhangtorCellJig02(CellTemp.ProductCode, Key, MyScale);
                                    List <Entity> TempEnt2 = Dezhangtor.GetDemo(new Point3d(CenterPoint.X + (CellCounter - 1) * 40, CenterPoint.Y, CenterPoint.Z));
                                    foreach (Entity ent in TempEnt2)
                                    {
                                        Entities.Add(ent);
                                    }
                                }
                                break;

                            case 5:
                                //BusCoupler سکسیونر
                                STR = STR + "005";
                                if (Key != null)
                                {
                                    //STR = STR + "005";
                                    BusSecsioner = new AcDrawBusCouplerSecsionerCell.DrawBusCouplerSecsionerCellJig02(CellTemp.ProductCode, Key, MyScale);
                                    List <Entity> TempEnt3 = BusSecsioner.GetDemo(new Point3d(CenterPoint.X + (CellCounter - 1) * 40, CenterPoint.Y, CenterPoint.Z));

                                    foreach (Entity ent in TempEnt3)
                                    {
                                        Entities.Add(ent);
                                    }
                                }
                                break;

                            case 6:
                                //BusCoupler دژنکتور
                                STR = STR + "006";
                                if (Key != null)
                                {
                                    //STR = STR + "006";
                                    BusDezhangtor = new AcDrawBusCouplerDezhangtorCell.DrawBusCouplerDezhangtorCellJig02(CellTemp.ProductCode, Key, MyScale);
                                    List <Entity> TempEnt4 = BusDezhangtor.GetDemo(new Point3d(CenterPoint.X + (CellCounter - 1) * 40, CenterPoint.Y, CenterPoint.Z));

                                    foreach (Entity ent in TempEnt4)
                                    {
                                        Entities.Add(ent);
                                    }
                                }
                                break;

                            case 7:
                                //فوزیبل
                                STR = STR + "007";
                                if (Key != null)
                                {
                                    //STR = STR + "007";
                                    Fuzibl = new AcDrawFuziblCell.DrawFuziblCellCellJig02(CellTemp.ProductCode, Key, MyScale);
                                    List <Entity> TempEnt4 = Fuzibl.GetDemo(new Point3d(CenterPoint.X + (CellCounter - 1) * 40, CenterPoint.Y, CenterPoint.Z));
                                    foreach (Entity ent in TempEnt4)
                                    {
                                        Entities.Add(ent);
                                    }
                                }
                                break;
                            }
                            CellCounter++;
                        }
                    }
                }// parent !=null

                Matrix3d trans1 = Matrix3d.Scaling(MyScale, new Point3d(CenterPoint.X, CenterPoint.Y, 0));

                foreach (Entity en in Entities)
                {
                    en.TransformBy(trans1);
                }


                foreach (Entity ent in Entities)
                {
                    draw.Geometry.Draw(ent);
                }

                // SHOW POSITION VALUE

                if (wg2 != null)
                {
                    // Push our transforms onto the stack

                    wg2.PushOrientationTransform(Autodesk.AutoCAD.GraphicsInterface.OrientationBehavior.Screen);

                    wg2.PushPositionTransform(Autodesk.AutoCAD.GraphicsInterface.PositionBehavior.Screen, new Point2d(30, 30));

                    // Draw our screen-fixed text

                    wg2.Text(

                        new Point3d(0, 0, 0),  // Position

                        new Vector3d(0, 0, 1), // Normal

                        new Vector3d(1, 0, 0), // Direction

                        "Cell:" + STR,         // Text

                        true,                  // Rawness

                        _style                 // TextStyle

                        );


                    // Remember to pop our transforms off the stack

                    wg2.PopModelTransform();

                    wg2.PopModelTransform();
                }

                // END OF SHOW POSITION VALUE


                return(true);
            }