Пример #1
0
            public override bool WorldDraw(AcGi.Drawable drawable, AcGi.WorldDraw wd)
            {
                var line = drawable as Line;

                if (line != null)
                {
                    //delta,这条直线所代表的三维向量
                    var vec = line.Delta.RotateBy(Math.PI / 2, Vector3d.ZAxis).GetNormal();
                    var pts = new Point3dCollection()
                    {
                        line.StartPoint + vec, line.EndPoint + vec,
                        line.EndPoint - vec, line.StartPoint - vec,
                    };
                    wd.Geometry.Polygon(pts);

                    var hatch = new Hatch();
                    var pts2d = new Point2dCollection();
                    var bulge = new DoubleCollection();

                    foreach (Point3d pt3d in pts)
                    {
                        pts2d.Add(new Point2d(pt3d.X, pt3d.Y));
                        bulge.Add(0);
                    }

                    hatch.AppendLoop(HatchLoopTypes.Default, pts2d, bulge);
                    hatch.SetHatchPattern(HatchPatternType.PreDefined, "ANGLE");

                    hatch.WorldDraw(wd);
                }

                return(base.WorldDraw(drawable, wd));
            }
Пример #2
0
            protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
            {
                Circle c = new Circle(CenterPoint, new Vector3d(0, 0, 1), 10);

                c.ColorIndex = 3;

                ConnectionPointEntity = c;

                draw.Geometry.Draw(ConnectionPointEntity);

                return(true);
            }
Пример #3
0
        protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
        {
            WorldGeometry wGeo = draw.Geometry;

            if (wGeo != null)
            {
                wGeo.PushModelTransform(UCS);
                wGeo.Polygon(corners);
                wGeo.PopModelTransform();
            }
            return(true);
        }
Пример #4
0
            protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
            {
                Entities.Clear();


                if (_CellCount != 0)
                {
                    int t = BaseLineLength / 2;

                    //header cabel
                    Point3dCollection Points = new Point3dCollection();
                    Points.Add(new Point3d(CenterPoint.X + (t - 10), CenterPoint.Y + 25, CenterPoint.Z));
                    Points.Add(new Point3d(CenterPoint.X + (t - 10) - 5, CenterPoint.Y + 20, CenterPoint.Z));
                    Points.Add(new Point3d(CenterPoint.X + (t - 10) + 5, CenterPoint.Y + 20, CenterPoint.Z));
                    Points.Add(new Point3d(CenterPoint.X + (t - 10), CenterPoint.Y + 25, CenterPoint.Z));
                    Entities.Add(CreateHeaderCable(Points));

                    Entities.Add(CreateLine(new Point3d(CenterPoint.X + (t - 10), CenterPoint.Y, CenterPoint.Z),
                                            new Point3d(CenterPoint.X + (t - 10), CenterPoint.Y + 20, CenterPoint.Z),
                                            0,
                                            0,
                                            0));

                    int CellCounter = 1;
                    for (int i = 1; i <= _CellCount; i++)
                    {
                        List <Entity> temp = GetDemo(new Point3d(CenterPoint.X + (CellCounter - 1) * 20, CenterPoint.Y, CenterPoint.Z));
                        foreach (Entity e1 in temp)
                        {
                            Entities.Add(e1);
                        }
                        CellCounter++;
                    }
                    //~~~~~~~~ SCALE ~~~~~~~~~~

                    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);
                }
                return(true);
            }
Пример #5
0
        public override bool WorldDraw(AcGi.Drawable drawable, AcGi.WorldDraw wd)
        {
            var wall = drawable as Line;

            if (wall != null)
            {
                var data = DBHelper.GetNODData(CommandJson.AppName, wall.Id.ToString())?.Data?.AsArray();

                var wallParam = JsonConvert.DeserializeObject <Wall>(
                    data[1].Value.ToString()
                    );

                var dir = new Vector2d(wallParam.Dir.X, wallParam.Dir.Y)
                          .GetNormal() * wallParam.Size.H;

                var vertDir = dir.RotateBy(Math.PI / 2)
                              .GetNormal() * wallParam.Size.W * 0.5;

                var startPt = new Point2d(wallParam.Pos.X, wallParam.Pos.Y);
                var endPt   = startPt + dir;

                var poly = new Polyline(4);

                poly.AddVertexAt(poly.NumberOfVertices, startPt + vertDir, 0, 0, 0);
                poly.AddVertexAt(poly.NumberOfVertices, startPt - vertDir, 0, 0, 0);
                poly.AddVertexAt(poly.NumberOfVertices, endPt - vertDir, 0, 0, 0);
                poly.AddVertexAt(poly.NumberOfVertices, endPt + vertDir, 0, 0, 0);
                poly.Closed = true;

                var hatch = new Hatch();

                hatch.SetHatchPattern(HatchPatternType.PreDefined, wallParam.Hatch);
                hatch.PatternAngle = dir.Angle - Math.PI / 2;

                var loop = new HatchLoop(HatchLoopTypes.Polyline);

                for (int i = 0; i < poly.NumberOfVertices; i++)
                {
                    loop.Polyline.Add(new BulgeVertex(poly.GetPoint2dAt(i), poly.GetBulgeAt(i)));
                }

                hatch.AppendLoop(loop);

                poly.WorldDraw(wd);
                hatch.WorldDraw(wd);
            }
            //return base.WorldDraw(drawable, wd);
            return(true);
        }
Пример #6
0
            /*重写该方法*/
            public override bool WorldDraw(AcGi.Drawable drawable, AcGi.WorldDraw wd)
            {
                Matrix3d matrix = Matrix3d.Rotation(Math.PI / 2, Vector3d.ZAxis, Point3d.Origin);

                Entity ent1 = drawable as Entity;

                if (ent1.ObjectId != ObjectId.Null)
                {
                    Entity copyEnt = ent1.GetTransformedCopy(matrix);
                    copyEnt.WorldDraw(wd);
                    copyCollection.Add(copyEnt);
                }

                return(base.WorldDraw(drawable, wd));
            }
Пример #7
0
        protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
        {
            mleader.EndPoint = mdragPT;
            Vector3d UserXaxis = db.Ucsxdir;
            Vector3d WXaxis    = new Vector3d(1, 0, 0);
            Vector3d Zaxis     = new Vector3d(0, 0, 1);
            double   Rangle    = UserXaxis.GetAngleTo(WXaxis);

            if (UserXaxis.Y < 0)
            {
                Zaxis = Zaxis.Negate();                                           //1.03版修改,修正角度旋转正负问题
            }
            Matrix3d Rmat = Matrix3d.Rotation(Rangle, Zaxis, mdragPT);            //旋转矩阵

            if (mdragPT.TransformBy(UCS.Inverse()).X >= mbasePT.TransformBy(UCS.Inverse()).X)
            {
                Matrix3d      mat = Matrix3d.Displacement(mbasePT.GetVectorTo(mdragPT)).PreMultiplyBy(Rmat); //旋转矩阵左乘位移矩阵
                WorldGeometry geo = draw.Geometry;
                if (geo != null)
                {
                    geo.Draw(mleader);
                    geo.PushModelTransform(mat);
                    foreach (Entity ent in mEntities)
                    {
                        geo.Draw(ent);
                    }
                    geo.PopModelTransform();
                }
            }
            else
            {
                Line          L   = (Line)mEntitiesL[0];
                Vector3d      Vt  = new Vector3d(L.Length, 0, 0);
                Matrix3d      mat = Matrix3d.Displacement(mbasePT.GetVectorTo(mdragPT) - Vt).PreMultiplyBy(Rmat);//旋转矩阵左乘位移矩阵
                WorldGeometry geo = draw.Geometry;
                if (geo != null)
                {
                    geo.Draw(mleader);
                    geo.PushModelTransform(mat);
                    foreach (Entity ent in mEntitiesL)
                    {
                        geo.Draw(ent);
                    }
                    geo.PopModelTransform();
                }
            }
            return(true);
        }
Пример #8
0
        protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
        {
            Matrix3d      mat3d = Matrix3d.Displacement(pnt3dRes - pnt3dBase);
            WorldGeometry wGeo  = draw.Geometry;

            if (wGeo != null)
            {
                wGeo.PushModelTransform(mat3d);
                foreach (Entity ent in entities)
                {
                    wGeo.Draw(ent);
                }
                wGeo.PopModelTransform();
            }
            return(true);
        }
Пример #9
0
            protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
            {
                Entities.Clear();

                Entities.Add(CreateCircle(new Point3d(CenterPoint.X + 10, CenterPoint.Y, CenterPoint.Z), 20, 90));
                Entities.Add(CreateCircle(new Point3d(CenterPoint.X - 10, CenterPoint.Y, CenterPoint.Z), 20, 210));
                Entities.Add(CreateLine(new Point3d(CenterPoint.X + 30, CenterPoint.Y, CenterPoint.Z),
                                        new Point3d(CenterPoint.X + 40, CenterPoint.Y, CenterPoint.Z),
                                        (int)Atend.Control.Enum.ProductType.Transformer, 0, 10));

                Entities.Add(CreateLine(new Point3d(CenterPoint.X - 30, CenterPoint.Y, CenterPoint.Z),
                                        new Point3d(CenterPoint.X - 40, CenterPoint.Y, CenterPoint.Z),
                                        (int)Atend.Control.Enum.ProductType.Transformer, 0, 10));


                Entities.Add(DrawKablsho(new Point3d(CenterPoint.X + 40, CenterPoint.Y, CenterPoint.Z)));
                //header cabel
                Point3dCollection Points = new Point3dCollection();

                Points.Add(new Point3d(CenterPoint.X - 45, CenterPoint.Y, CenterPoint.Z));
                Points.Add(new Point3d(CenterPoint.X - 40, CenterPoint.Y - 5, CenterPoint.Z));
                Points.Add(new Point3d(CenterPoint.X - 40, CenterPoint.Y + 5, CenterPoint.Z));
                Points.Add(new Point3d(CenterPoint.X - 45, CenterPoint.Y, CenterPoint.Z));
                Entities.Add(CreateHeaderCable(Points));

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

                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);
                }

                return(true);
            }
Пример #10
0
            protected override bool WorldDraw(AcGi.WorldDraw draw)
            {
                if (Step == 1)
                {
                    Circ1.WorldDraw(draw);
                    return(true);
                }

                if (Step == 2)
                {
                    Circ1.WorldDraw(draw);
                    Circ2.WorldDraw(draw);

                    while (Hatch.NumberOfLoops > 0)
                    {
                        Hatch.RemoveLoopAt(0);
                    }

                    Hatch.AppendLoop(HatchLoopTypes.Default, new Curve2dCollection()
                    {
                        new CircularArc2d(new Point2d(Circ1.Center.X, Circ1.Center.Y),
                                          Circ1.Radius),
                    }, new IntegerCollection()
                    {
                        0
                    });
                    Hatch.AppendLoop(HatchLoopTypes.Default, new Curve2dCollection()
                    {
                        new CircularArc2d(new Point2d(Circ2.Center.X, Circ2.Center.Y),
                                          Circ2.Radius),
                    }, new IntegerCollection()
                    {
                        0
                    });

                    Hatch.WorldDraw(draw);

                    return(true);
                }

                return(false);
            }
Пример #11
0
            protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
            {
                Entities.Clear();
                Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

                Entities.Add(CreateLine(StartPoint, EndPoint, (int)Atend.Control.Enum.ProductType.Ground, 0, 0));
                Matrix3d trans1     = Matrix3d.Scaling(MyScale, EndPoint);
                Matrix3d StartTrans = Matrix3d.Scaling(MyScale, StartPoint);


                Line     l        = new Line(StartPoint, EndPoint);
                double   newAngle = l.Angle;
                Matrix3d trans3   = Matrix3d.Rotation(newAngle, ed.CurrentUserCoordinateSystem.CoordinateSystem3d.Zaxis, EndPoint);

                Entity ent = CreateLine(new Point3d(EndPoint.X, EndPoint.Y - 2.5, EndPoint.Z), new Point3d(EndPoint.X, EndPoint.Y + 2.5, EndPoint.Z), (int)Atend.Control.Enum.ProductType.Ground, 0, 0);

                ent.TransformBy(trans1);
                ent.TransformBy(trans3);
                Entities.Add(ent);

                ent = CreateLine(new Point3d(EndPoint.X + 0.5, EndPoint.Y - 2, EndPoint.Z), new Point3d(EndPoint.X + 0.5, EndPoint.Y + 2, EndPoint.Z), (int)Atend.Control.Enum.ProductType.Ground, 0, 0);
                ent.TransformBy(trans1);
                ent.TransformBy(trans3);
                Entities.Add(ent);

                ent = CreateLine(new Point3d(EndPoint.X + 1, EndPoint.Y - 1.5, EndPoint.Z), new Point3d(EndPoint.X + 1, EndPoint.Y + 1.5, EndPoint.Z), (int)Atend.Control.Enum.ProductType.Ground, 0, 0);
                ent.TransformBy(trans1);
                ent.TransformBy(trans3);
                Entities.Add(ent);

                ent = CreateConsol(StartPoint, 5, 5);
                ent.TransformBy(StartTrans);
                Entities.Add(ent);

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

                return(true);
            }
        protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
        {
            Matrix3d mat = Matrix3d.Displacement(this.startPoint.GetVectorTo(this.insertPoint));

            mat = currentUCS.PreMultiplyBy(mat);

            WorldGeometry geo = draw.Geometry;

            if (geo != null)
            {
                geo.PushModelTransform(mat);
                foreach (var ent in this.entities)
                {
                    geo.Draw(ent);
                }

                geo.PopModelTransform();
            }

            return(true);
        }
Пример #13
0
            protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
            {
                Entities.Clear();
                int    AllCounter  = 0;
                double ShemshStart = BasePoint.X;

                for (int i = 1; i <= _feederCount; i++)
                {
                    //int FeederCount = 0;
                    //shemshFeeder.TryGetValue(i, out FeederCount);

                    Point3d CP = new Point3d(ShemshStart + (16 * (i - 1)), BasePoint.Y, BasePoint.Z);
                    CreateFeeder(CP);
                    AllCounter++;

                    //ShemshStart +=16// (16 * (FeederCount + 1));
                }
                AllCounter++;
                AllCounter--;
                Entities.Add(CreateStreetBoxBox(new Point3d((BasePoint.X - 8) + ((AllCounter * 16) / 2), (BasePoint.Y + 5) - (30 / 2), BasePoint.Z), (AllCounter * 16), 30));


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

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

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

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

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

                return(true);
            }
        protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
        {
            WorldGeometry geo = draw.Geometry;

            if (geo != null)
            {
                Point3dCollection tempPts = new Point3dCollection();
                foreach (Point3d pt in mAllVertexes)
                {
                    tempPts.Add(pt);
                }

                tempPts.Add(mLastVertex);
                if (tempPts.Count > 0)
                {
                    try
                    {
                        Database db = HostApplicationServices.WorkingDatabase;
                        Autodesk.AutoCAD.DatabaseServices.Polyline line = new Autodesk.AutoCAD.DatabaseServices.Polyline();
                        for (int i = 0; i < tempPts.Count; i++)
                        {
                            Point3d pt3d = tempPts[i];
                            Point2d pt2d = new Point2d(pt3d.X, pt3d.Y);
                            line.AddVertexAt(i, pt2d, 0, db.Plinewid, db.Plinewid);
                        }
                        Point2d final = new Point2d(tempPts[0].X, tempPts[0].Y);
                        line.AddVertexAt(tempPts.Count, final, 0, db.Plinewid, db.Plinewid);
                        line.ConstantWidth = HeatSourceLayoutApp.globalProperty.BuildingOutlineWidth;
                        line.Color         = Color.FromRgb(255, 0, 0);
                        draw.Geometry.Draw(line);
                    }
                    catch (System.Exception e)
                    {
                        Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(e.Message);
                    }
                }
            }
            return(true);
        }
Пример #15
0
        public override bool WorldDraw(AcGi.Drawable drawable, AcGi.WorldDraw wd)
        {
            var donut = drawable as Circle;

            if (donut != null)
            {
                var xdata = donut.GetXData(CommandClass.AppName);
                if (xdata != null && xdata.Length > 0)
                {
                    var outRad    = (double)xdata[0].Value;
                    var outCircle = new Circle(donut.Center, donut.Normal, outRad);
                    outCircle.WorldDraw(wd);

                    var hatch = new Hatch();
                    hatch.SetHatchPattern(HatchPatternType.PreDefined, "BOX");
                    hatch.AppendLoop(HatchLoopTypes.Default, new Curve2dCollection()
                    {
                        new CircularArc2d(new Point2d(donut.Center.X, donut.Center.Y),
                                          donut.Radius),
                    }, new IntegerCollection()
                    {
                        0
                    });
                    hatch.AppendLoop(HatchLoopTypes.Default, new Curve2dCollection()
                    {
                        new CircularArc2d(new Point2d(outCircle.Center.X, outCircle.Center.Y),
                                          outCircle.Radius),
                    }, new IntegerCollection()
                    {
                        0
                    });
                    hatch.WorldDraw(wd);

                    base.WorldDraw(drawable, wd);
                }
            }

            return(false);
        }
Пример #16
0
    protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
    {
        Vector3d UserXaxis = db.Ucsxdir;
        Vector3d WXaxis    = new Vector3d(1, 0, 0);
        Vector3d Zaxis     = new Vector3d(0, 0, 1);
        double   Rangle    = UserXaxis.GetAngleTo(WXaxis);
        Matrix3d Rmat      = Matrix3d.Rotation(Rangle, Zaxis, mdragPT);
        Vector3d VT        = new Vector3d(1, 1, 1);                                 //插入点转换向量

        if (mdragPT.TransformBy(UCS.Inverse()).X >= mbasePT.TransformBy(UCS.Inverse()).X&& mdragPT.TransformBy(UCS.Inverse()).Y >= mbasePT.TransformBy(UCS.Inverse()).Y)
        {
            VT = new Vector3d(0, 0, 0);
        }
        if (mdragPT.TransformBy(UCS.Inverse()).X < mbasePT.TransformBy(UCS.Inverse()).X&& mdragPT.TransformBy(UCS.Inverse()).Y >= mbasePT.TransformBy(UCS.Inverse()).Y)
        {
            VT = new Vector3d(-mtableob.Width, 0, 0);
        }
        if (mdragPT.TransformBy(UCS.Inverse()).X < mbasePT.TransformBy(UCS.Inverse()).X&& mdragPT.TransformBy(UCS.Inverse()).Y < mbasePT.TransformBy(UCS.Inverse()).Y)
        {
            VT = new Vector3d(-mtableob.Width, -mtableob.Height, 0);
        }
        if (mdragPT.TransformBy(UCS.Inverse()).X >= mbasePT.TransformBy(UCS.Inverse()).X&& mdragPT.TransformBy(UCS.Inverse()).Y < mbasePT.TransformBy(UCS.Inverse()).Y)
        {
            VT = new Vector3d(0, -mtableob.Height, 0);
        }
        Matrix3d      mat = Matrix3d.Displacement(mbasePT.GetVectorTo(mdragPT) + VT);
        WorldGeometry geo = draw.Geometry;

        if (geo != null)
        {
            geo.Draw(mleader);
            geo.PushModelTransform(mat.PreMultiplyBy(Rmat));
            geo.Draw(mtableob);
            geo.PopModelTransform();
        }
        return(true);
    }
Пример #17
0
 protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
 {
     Entities.Clear();
     return(true);
 }
Пример #18
0
 protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
 {
     return(true);
 }
Пример #19
0
            protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
            {
                //throw new System.Exception("The method or operation is not implemented.");

                Entitied.Clear();
                Entity enti = null;

                if (PartOneIsActive)
                {
                    //CenterPoint02 = new Point3d(CenterPoint01.X + 40, CenterPoint01.Y, CenterPoint01.Z);
                    //Matrix3d trans1 = Matrix3d.Scaling(MyScale, new Point3d(CenterPoint01.X, CenterPoint01.Y, 0));
                    //Matrix3d trans2 = Matrix3d.Scaling(MyScale, new Point3d(CenterPoint02.X, CenterPoint02.Y, 0));

                    //enti = DrawConsol(CenterPoint01, 10, 10);
                    //enti.TransformBy(trans1);
                    //Entitied.Add(enti);

                    //Entitied.Add(DrawLine(CenterPoint01, CenterPoint02));

                    //enti = DrawRod(CenterPoint02, 6, 6);
                    //enti.TransformBy(trans2);
                    //Entitied.Add(enti);

                    //enti = DrawTriangle(CenterPoint02);
                    //enti.TransformBy(trans2);
                    //Entitied.Add(enti);
                }
                else
                {
                    Line     l        = new Line(CenterPoint01, CenterPoint02);
                    double   newAngle = l.Angle;
                    Matrix3d trans1   = Matrix3d.Scaling(MyScale, new Point3d(CenterPoint01.X, CenterPoint01.Y, 0));
                    Matrix3d trans2   = Matrix3d.Scaling(MyScale, new Point3d(CenterPoint02.X, CenterPoint02.Y, 0));

                    //enti = DrawConsol(CenterPoint01, 10, 10);
                    //enti.TransformBy(trans1);
                    //Entitied.Add(enti);

                    Entitied.Add(DrawLine(CenterPoint01, CenterPoint02));

                    enti = DrawCircle(CenterPoint02, 6);
                    enti.TransformBy(trans2);
                    Entitied.Add(enti);

                    //enti = DrawTriangle(CenterPoint02);
                    //enti.TransformBy(trans2);
                    //Entitied.Add(enti);
                }

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

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

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


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


                return(true);
            }