Exemple #1
0
        protected override bool WorldDraw(WorldDraw draw)
        {
            WorldGeometry geo = draw.Geometry;

            if (geo != null)
            {
                if (jigUpdate)
                {
                    stair = MyFunctions.CreateStair3D(steps, riser, tread, landing, width, slope);
                }
                switch (jigStatus)
                {
                case 0:
                    geo.PushModelTransform(matDisplacement);
                    geo.Draw(stair);
                    geo.PopModelTransform();
                    break;

                case 1:
                    geo.PushModelTransform(matDisplacement.PreMultiplyBy(matRotation));
                    geo.Draw(stair);
                    geo.PopModelTransform();
                    break;;

                default: return(false);
                }
            }
            return(true);
        }
Exemple #2
0
        protected override bool WorldDraw(WorldDraw draw)
        {
            WorldGeometry geo = draw.Geometry;

            if (geo != null)
            {
                Vector3d vec  = basePoint.GetVectorTo(secondPoint);
                Matrix3d disp = Matrix3d.Displacement(this.basePoint.GetVectorTo(this.secondPoint));
                //geo.PushModelTransform(disp);
                for (int i = 0; i < blockPosition.Count; i++)
                {
                    Point3d tempPoint = blockPosition[i] + vec;
                    brefs[i].Position = tempPoint;
                    geo.Draw(brefs[i]);
                }

                for (int i = 0; i < linesPosition.Count; i++)
                {
                    Point3d tempStartPoint = linesPosition[i].Item1 + vec;
                    Point3d tempEndPoint   = linesPosition[i].Item2 + vec;

                    lines[i].StartPoint = tempStartPoint;
                    lines[i].EndPoint   = tempEndPoint;
                    geo.Draw(lines[i]);
                }
                //geo.PopModelTransform();
                return(true);
            }
            return(false);
        }
Exemple #3
0
        protected override bool WorldDraw(WorldDraw draw)
        {
            WorldGeometry geo = draw.Geometry;

            if (geo != null)
            {
                Vector3d vec  = basePoint.GetVectorTo(secondPoint);
                Matrix3d disp = Matrix3d.Displacement(this.basePoint.GetVectorTo(this.secondPoint));
                //geo.PushModelTransform(disp);
                for (int i = 0; i < blockPosition.Count; i++)
                {
                    Point3d tempPoint = blockPosition[i] + vec;
                    brefs[i].Position = tempPoint;
                    geo.Draw(brefs[i]);
                }

                for (int i = 0; i < linesPosition.Count; i++)
                {
                    Point3d tempStartPoint = linesPosition[i].Item1 + vec;
                    Point3d tempEndPoint   = linesPosition[i].Item2 + vec;

                    lines[i].StartPoint = tempStartPoint;
                    lines[i].EndPoint   = tempEndPoint;
                    geo.Draw(lines[i]);
                }

                if (plinesPosition.Count != 0)
                {
                    for (int i = 0; i < plinesPosition.Count; i++)
                    {
                        List <Point3d> tempVertext = new List <Point3d>();
                        for (int j = 0; j < plinesPosition[j].Count; j++)
                        {
                            Point3d newVert    = plinesPosition[i][j] + vec;
                            double  bulge      = plines[i].GetBulgeAt(j);
                            double  startWidth = plines[i].GetStartWidthAt(j);
                            double  endWidth   = plines[i].GetEndWidthAt(j);
                            plines[i].RemoveVertexAt(j);
                            plines[i].AddVertexAt(j, new Point2d(newVert.X, newVert.Y), bulge, startWidth, endWidth);
                        }
                        geo.Draw(plines[i]);
                    }
                }


                //geo.PopModelTransform();
                return(true);
            }
            return(false);
        }
Exemple #4
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);
        }
Exemple #5
0
        protected override bool WorldDraw(WorldDraw draw)
        {
            WorldGeometry geo = draw.Geometry;

            if (geo != null)
            {
                table.Position = insertionPoint;
                geo.Draw(table);
                return(true);
            }
            return(false);
        }
Exemple #6
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);
    }
Exemple #7
0
        protected override bool WorldDraw(WorldDraw draw)
        {
            WorldGeometry geo = draw.Geometry;

            if (geo != null)
            {
                // Отрисовка линий.
                _lines = getLines();
                foreach (var line in _lines)
                {
                    geo.Draw(line);
                }
            }
            return(true);
        }
Exemple #8
0
        protected override bool WorldDraw(WorldDraw draw)
        {
            WorldGeometry geo = draw.Geometry;

            if (geo != null)
            {
                Vector3d vec  = basePoint.GetVectorTo(secondPoint);
                Matrix3d disp = Matrix3d.Displacement(this.basePoint.GetVectorTo(this.secondPoint));
                //geo.PushModelTransform(disp);

                Point3d tempPoint = brefPosition + vec;
                bref.Position = tempPoint;
                geo.Draw(bref);
            }
            return(true);
        }
Exemple #9
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);
        }
        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);
        }
Exemple #11
0
        protected override bool WorldDraw(WorldDraw draw)
        {
            try
            {
                WorldGeometry geometry = draw.Geometry;
                if (geometry != null)
                {
                    geometry.PushModelTransform(transforms);
                    foreach (Entity entity in entityList)
                    {
                        geometry.Draw(entity);
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                ProxyCAD.Editor.WriteMessage(ex.Message);
                return(false);
            }
        }
        public override bool WorldDraw(Drawable drawable, WorldDraw wd)
        {
            if (wd.RegenAbort || wd.IsDragging)
            {
                return(base.WorldDraw(drawable, wd));
            }

            RebarPos pos = drawable as RebarPos;

            if (pos == null)
            {
                return(base.WorldDraw(drawable, wd));
            }

            PosShape  shape    = PosShape.GetPosShape(pos.Shape);
            Extents3d?shapeExt = shape.Bounds;

            if (!shapeExt.HasValue)
            {
                return(base.WorldDraw(drawable, wd));
            }
            Extents3d ext = shapeExt.Value;

            WorldGeometry   g     = wd.Geometry;
            SubEntityTraits s     = wd.SubEntityTraits;
            TextStyle       style = new TextStyle();

            // Get geometry
            Point3d  pt   = pos.BasePoint;
            Vector3d dir  = pos.DirectionVector;
            Vector3d up   = pos.UpVector;
            Vector3d norm = pos.NormalVector;

            double w = pos.Width / dir.Length;
            double h = pos.Height / dir.Length;

            // Draw bound dimension lines
            foreach (RebarPos.BoundDimension dim in pos.GetBoundDimensions())
            {
                Line line = new Line(dim.TextPosition, pos.BasePoint);
                g.Draw(line);
            }

            // Draw shape
            double xmin = ext.MinPoint.X, ymin = ext.MinPoint.Y, xmax = ext.MaxPoint.X, ymax = ext.MaxPoint.Y;

            // Scale
            double scale = 0.025;
            // Client offsets
            double xoff = (w - scale * (xmax - xmin)) / 2.0;
            double yoff = 2.0 * h;//(h - scale * (ymax - ymin)) / 2.0;

            // Transform
            Matrix3d trans = Matrix3d.AlignCoordinateSystem(new Point3d(xmin, ymin, 0), Vector3d.XAxis / scale, Vector3d.YAxis / scale, Vector3d.ZAxis / scale, pt + dir * xoff + up * yoff, dir, up, norm);

            g.PushModelTransform(trans);

            // Draw shapes
            shape.SetShapeTexts(pos.A, pos.B, pos.C, pos.D, pos.E, pos.F);
            g.Draw(shape);
            shape.ClearShapeTexts();

            // Reset transform
            g.PopModelTransform();

            return(base.WorldDraw(drawable, wd));
        }