Beispiel #1
0
        protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
        {
            lock (Entities)
            {
                Entities.Clear();
                Entities.AddRange(_arrow.Explode().Select(x =>
                {
                    if (x is DBText)
                    {
                        return(_convertToAttribute((DBText)x));
                    }
                    return(x);
                }));

                ObjectId btrId = AcadBlocks.BlockTools.CreateBlockTableRecordEx(_insertPoint, "*U", Entities.Select(x => (Entity)x.Clone()).ToList(), AnnotativeStates.True);
                ObjectId brId  = AcadBlocks.BlockTools.AddBlockRefToModelSpace(btrId, null, _insertPoint, _ucs);

                Tools.StartTransaction(() =>
                {
                    BlockReference br = brId.GetObjectForWrite <BlockReference>();
                    br.SetDatabaseDefaults(HostApplicationServices.WorkingDatabase);
                    br.RecordGraphicsModified(true);

                    Entity inMemoryEntity = (Entity)br.Clone();
                    draw.Geometry.Draw(inMemoryEntity);

                    var btr = br.BlockTableRecord.GetObjectForWrite <BlockTableRecord>();
                    br.Erase();
                    btr.EraseBolckTableRecord();
                    inMemoryEntity.Dispose();
                });
            }

            return(true);
        }
Beispiel #2
0
            protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
            {
                Circle c = new Circle(CenterPoint, new Vector3d(0, 0, 1), 10);

                //c.Annotative = AnnotativeStates.True;
                //c.Annotative
                c.ColorIndex = 151;

                ConnectionPointEntity = c;

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

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

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

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

                draw.Geometry.Draw(ConnectionPointEntity);

                return(true);
            }
Beispiel #3
0
        //更新
        protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
        {
            Entity ent = ents[0];

            ent.UpgradeOpen();
            if (ent is BlockReference)
            {
                BlockReference br = ent as BlockReference;
                br.Position = newPt;
                draw.Geometry.Draw(br);
            }

            v = newPt.GetVectorTo(oldPt);

            for (int i = 1; i < ents.Count; i++)
            {
                Entity entity = ents[i];
                entity.UpgradeOpen();
                if (entity is BlockReference)
                {
                    BlockReference br = entity as BlockReference;
                    br.Position = oldPts[i - 1] + v;
                    draw.Geometry.Draw(entity);
                }
            }

            return(true);
        }
Beispiel #4
0
            protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
            {
                _inMemorySet.Add(_setToBlock(Explode()));
                foreach (var ent in _inMemorySet)
                {
                    draw.Geometry.Draw(ent);
                }

                foreach (var ent in _inMemorySet)
                {
                    /*ent.Dispose();*/
                    var btrId            = ((BlockReference)ent).BlockTableRecord;
                    BlockTableRecord btr = btrId.GetObjectForRead <BlockTableRecord>();
                    BlockReference   br  = ent.Id.GetObjectForRead <BlockReference>();
                    ent.UpgradeOpen();
                    ent.Erase(true);
                    ent.DowngradeOpen();

                    //btr.UpgradeOpen();
                    foreach (var item in btr)
                    {
                        DBObject obj = item.GetObjectForWrite <DBObject>();
                        obj.Erase(true);
                    }
                    //btr.DowngradeOpen();
                }
                _inMemorySet.Clear();
                return(true);
            }
Beispiel #5
0
        protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
        {
            lock (_entitiesInMemory)
            {
                bool res = base.WorldDraw(draw);

                if (_endPointComplete)
                {
                    var slopeLines = Calculate(_slopeMode);

                    if (slopeLines.Count > 0)
                    {
                        foreach (var ent in _entitiesInMemory)
                        {
                            if (!ent.IsDisposed)
                            {
                                ent.Dispose();
                            }
                        }
                        _entitiesInMemory.Clear();
                        _entitiesInMemory.AddRange(slopeLines);
                    }

                    foreach (var ent in _entitiesInMemory)
                    {
                        draw.Geometry.Draw(ent);
                    }
                }
                return(res);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 現在の場所にブロックを表示する
        /// (このメソッドをオーバーライドする必要があります)
        /// </summary>
        /// <param name="draw"></param>
        /// <returns></returns>
        protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
        {
            using (var inMemoryBlockInsert = new BlockReference(Point, _blockId))
            {
                draw.Geometry.Draw(inMemoryBlockInsert);
            }

            return(true);
        }
Beispiel #7
0
        /// <summary>
        /// 現在の場所に円を表示する
        /// (このメソッドをオーバーライドする必要があります)
        /// </summary>
        /// <param name="draw"></param>
        /// <returns></returns>
        protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
        {
            using (var inMemoryBlockInsert = new Circle(Center, Normal, Radius))
            {
                draw.Geometry.Draw(inMemoryBlockInsert);
            }

            return(true);
        }
Beispiel #8
0
            /// <summary>
            /// 绘制拉的直线,如果可能,可以绘制与几个边界线的交点
            /// </summary>
            /// <param name="draw"></param>
            /// <returns></returns>
            protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
            {
                Document acadDocument = m_cadEditor.Document;
                Database acadDatabase = acadDocument.Database;



                return(true);
            }
Beispiel #9
0
            // Need to override this method.
            // We are showing our block in its current position here.
            //--------------------------------------------------------------
            protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
            {
                BlockReference inMemoryBlockInsert = new BlockReference(_point, _blockId);

                draw.Geometry.Draw(inMemoryBlockInsert);
                inMemoryBlockInsert.Dispose();

                return(true);
            } // WorldDraw()
Beispiel #10
0
            protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
            {
                DBText inMemoryText = _getMirrorClone();

                draw.Geometry.Draw(inMemoryText);

                inMemoryText.Dispose();

                return(true);
            }
 protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
 {
     if (list != null)
     {
         foreach (var ent in list)
         {
             draw.Geometry.Draw(ent);
         }
     }
     return(true);
 }
Beispiel #12
0
        public override bool WorldDraw(
            Autodesk.AutoCAD.GraphicsInterface.Drawable drawable,
            Autodesk.AutoCAD.GraphicsInterface.WorldDraw wd)
        {
            base.WorldDraw(drawable, wd);

            Polyline pline = (Polyline)drawable;

            double length = pline.Length;

            #region Size label
            double  dist = length / 2;
            Point3d pt   = pline.GetPointAtDist(dist);
            int     dn   = PropertySetManager.ReadNonDefinedPropertySetInt(pline, "DriGasDimOgMat", "Dimension");
            string  mat  = PropertySetManager.ReadNonDefinedPropertySetString(pline, "DriGasDimOgMat", "Material");

            if (mat.IsNoE() && dn == 0)
            {
                return(true);
            }
            if (!mat.IsNoE())
            {
                mat = " " + mat;
            }

            string label = $"{dn}{mat}";

            if (
                pline.Layer == "GAS-ude af drift" ||
                pline.Layer == "GAS-ude af drift-2D"
                )
            {
                label += " UAD";
            }

            Vector3d deriv = pline.GetFirstDerivative(pt);
            deriv = deriv.GetNormal();

            Vector3d perp = deriv.GetPerpendicularVector();

            wd.Geometry.Text(
                pt + perp * labelOffset, Vector3d.ZAxis, deriv, label, true, style);
            //pt + perp * labelOffset, Vector3d.ZAxis, deriv, labelHeight, 1.0, 0.0, label);

            //wd.Geometry.Text(
            //    pt + perp * labelOffset, Vector3d.ZAxis, deriv, labelHeight, 1.0, 0.0, label);
            #endregion


            return(true);
        }
Beispiel #13
0
 protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
 {
     pts = new Point3dCollection();
     pts.Add(startPt + new Vector3d(-3, 0, 0));
     pts.Add(startPt + new Vector3d(3, 0, 0));
     pts.Add(startPt + new Vector3d(3, 0, 6));
     pts.Add(startPt + new Vector3d(2.5, 0, 6));
     pts.Add(startPt + new Vector3d(2.5, 0, 1));
     pts.Add(startPt + new Vector3d(-2.5, 0, 1));
     pts.Add(startPt + new Vector3d(-2.5, 0, 6));
     pts.Add(startPt + new Vector3d(-3, 0, 6));
     pts.Add(startPt + new Vector3d(-3, 0, 0));
     return(draw.Geometry.Polygon(pts));
 }
Beispiel #14
0
 protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
 {
     try
     {
         Update();
         if (mline != null)
         {
             draw.Geometry.Draw(mline);
         }
     }
     catch (System.Exception ex)
     {
         ex.ToString();
         return(false);
     }
     return(true);
 }
        //与Entity最大不同的在这里(Update->WorldDraw)
        protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
        {
            Vector3d lineV = m_AcquirePt - m_BasePt;
            Vector3d perpV = lineV.RotateBy(Math.PI / 2.0f, Vector3d.ZAxis);

            perpV = perpV.GetNormal() * m_gap;

            line_1.StartPoint = m_BasePt + perpV;
            line_2.StartPoint = m_BasePt - perpV;
            line_1.EndPoint   = m_AcquirePt + perpV;
            line_2.EndPoint   = m_AcquirePt - perpV;

            line_1.WorldDraw(draw);//需要调用WorldDraw将想要绘制的实体绘制到模型空间
            line_2.WorldDraw(draw);

            return(true);
        }
Beispiel #16
0
        protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
        {
            lock (_safeObject)
            {
                if (_entityInMemory != null)
                {
                    if (!_entityInMemory.IsDisposed)
                    {
                        _entityInMemory.Dispose();
                    }
                }

                /*if (_jigPoint.IsEqualTo(_jigBasePoint))
                 *  return false;*/

                //Polyline pline = _baseCurve.ConvertToPolyline();

                //Line line = pline.GetOrthoNormalLine(_jppr.Value, null, false);
                Line line = new Line(_jppr.Value, _baseCurve.GetClosestPointTo(_jppr.Value, false));
                if (line != null)
                {
                    _jigPoint     = line.StartPoint;
                    _jigBasePoint = line.EndPoint;
                }
                else
                {
                    //throw new ArgumentNullException();
                    return(false);
                }

                /*_jigBasePoint = _jppr.Value;
                 * _jigPoint = _baseCurve.GetClosestPointTo(_jigBasePoint, false);*/

                try
                {
                    _entityInMemory = new Line(_jigPoint, _jigBasePoint);
                    _entityInMemory.SetDatabaseDefaults();
                    return(draw.Geometry.Draw(_entityInMemory));
                }
                catch (Exception ex)
                {
                    return(false);
                }
            }
        }
Beispiel #17
0
            protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
            {
                List <Entity> inMemorySet = Explode();

                foreach (var ent in inMemorySet)
                {
                    draw.Geometry.Draw(ent);
                }

                foreach (var ent in inMemorySet)
                {
                    ent.Dispose();
                }

                inMemorySet.Clear();

                return(true);
            }
Beispiel #18
0
 protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
 {
     //return draw.Geometry.Draw(_br);
     return(true);
 }
Beispiel #19
0
        public override bool WorldDraw(
            Autodesk.AutoCAD.GraphicsInterface.Drawable drawable,
            Autodesk.AutoCAD.GraphicsInterface.WorldDraw wd)
        {
            base.WorldDraw(drawable, wd);

            Polyline pline = (Polyline)drawable;

            double length         = pline.Length;
            int    numberOfLabels = (int)(length / labelDist);

            if (numberOfLabels == 0)
            {
                numberOfLabels = 1;
            }

            for (int i = 0; i < numberOfLabels + 1; i++)
            {
                #region Size label
                double dist = labelDist * i;
                if (numberOfLabels == 1)
                {
                    dist = length / 2;
                }
                Point3d pt     = pline.GetPointAtDist(dist);
                int     dn     = IntersectUtilities.PipeSchedule.GetPipeDN(pline);
                string  system =
                    IntersectUtilities.PipeSchedule.GetPipeType(pline) == IntersectUtilities.PipeSchedule.PipeTypeEnum.Twin ?
                    "T" : "E";
                string label = $"DN{dn}-{system}";

                Vector3d deriv = pline.GetFirstDerivative(pt);
                deriv = deriv.GetNormal();

                Vector3d perp = deriv.GetPerpendicularVector();

                wd.Geometry.Text(
                    pt + perp * labelOffset, Vector3d.ZAxis, deriv, label, true, style);
                //pt + perp * labelOffset, Vector3d.ZAxis, deriv, labelHeight, 1.0, 0.0, label);

                //wd.Geometry.Text(
                //    pt + perp * labelOffset, Vector3d.ZAxis, deriv, labelHeight, 1.0, 0.0, label);
                #endregion
            }

            #region Buerør label
            int nrOfVertices = pline.NumberOfVertices;

            for (int j = 0; j < pline.NumberOfVertices - 1; j++)
            {
                //Guard against already cut out curves
                double b = pline.GetBulgeAt(j);
                if (b == 0)
                {
                    continue;
                }
                Point2d fP = pline.GetPoint2dAt(j);
                Point2d sP = pline.GetPoint2dAt(j + 1);

                double u           = fP.GetDistanceTo(sP);
                double radius      = u * ((1 + b.Pow(2)) / (4 * Math.Abs(b)));
                double minRadius   = IntersectUtilities.PipeSchedule.GetPipeMinElasticRadius(pline, false);
                bool   isInSituBuk = IntersectUtilities.PipeSchedule.IsInSituBent(pline);
                //If radius is less than minRadius a buerør is detected
                //Split the pline in segments delimiting buerør and append

                Point3d fP3d = new Point3d(fP.X, fP.Y, 0);
                Point3d sP3d = new Point3d(sP.X, sP.Y, 0);

                double fL = pline.GetDistAtPoint(fP3d);
                double sL = pline.GetDistAtPoint(sP3d);

                Vector3d vec = pline.GetFirstDerivative(fP3d);
                vec = vec.GetNormal();
                vec = vec.GetPerpendicularVector();
                Point3d pt1 = fP3d + vec;
                Point3d pt2 = fP3d - vec;
                wd.Geometry.WorldLine(pt1, pt2);

                vec = pline.GetFirstDerivative(sP3d);
                vec = vec.GetNormal();
                vec = vec.GetPerpendicularVector();
                pt1 = sP3d + vec;
                pt2 = sP3d - vec;
                wd.Geometry.WorldLine(pt1, pt2);

                string label;
                if (radius > minRadius)
                {
                    label = $"Elastisk R{radius.ToString("0.##")}";
                }
                else
                {
                    double arcLength = sL - fL;

                    if (isInSituBuk)
                    {
                        label = $"In-situ buk R{radius.ToString("0.##")} L{arcLength.ToString("0.##")}";
                    }
                    else
                    {
                        double angle = arcLength / ((Math.PI / 180) * radius);
                        label = $"Buerør R{radius.ToString("0.##")} L{arcLength.ToString("0.##")} A{angle.ToString("0.##")}";
                    }
                }

                CircularArc2d arc     = pline.GetArcSegment2dAt(j);
                Point2d[]     samples = arc.GetSamplePoints(3);
                Point3d       midPt   = new Point3d(samples[1].X, samples[1].Y, 0);

                Vector3d deriv = pline.GetFirstDerivative(midPt);
                deriv = deriv.GetNormal();

                Vector3d perp = deriv.GetPerpendicularVector();
                if (b > 0)
                {
                    perp = -perp;
                }

                //wd.Geometry.Text(
                //    midPt + perp * (labelOffset + labelHeight + 0.7), Vector3d.ZAxis, deriv, labelHeight, 1.0, 0.0, label);
                wd.Geometry.Text(
                    midPt + perp * (labelOffset + labelHeight + 0.7), Vector3d.ZAxis, deriv, label, true, style);
            }
            #endregion

            return(true);
        }
Beispiel #20
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);
            }
Beispiel #21
0
        public override bool WorldDraw(
            Autodesk.AutoCAD.GraphicsInterface.Drawable drawable,
            Autodesk.AutoCAD.GraphicsInterface.WorldDraw wd)
        {
            base.WorldDraw(drawable, wd);

            Polyline pline = (Polyline)drawable;

            double length         = pline.Length;
            int    numberOfLabels = (int)(length / labelDist);

            if (numberOfLabels == 0)
            {
                numberOfLabels = 1;
            }

            for (int i = 0; i < numberOfLabels + 1; i++)
            {
                #region Direction arrow
                if (numberOfLabels != 1 && i == 0)
                {
                    continue;
                }

                double dist = labelDist * i;
                if (numberOfLabels == 1)
                {
                    dist = length / 2;
                }
                Point3d pt = pline.GetPointAtDist(dist);

                Vector3d deriv = pline.GetFirstDerivative(pt);
                deriv = deriv.GetNormal();
                Vector3d perp = deriv.GetPerpendicularVector();

                Point3d p1 = pt - deriv.RotateBy(0.785398, Vector3d.ZAxis) * arrowSideL;
                Point3d p2 = pt - deriv.RotateBy(-0.785398, Vector3d.ZAxis) * arrowSideL;

                wd.Geometry.WorldLine(pt, p1);
                wd.Geometry.WorldLine(pt, p2);
                #endregion
            }

            #region Last tick
            {
                Point3d  pt    = pline.EndPoint;
                Vector3d deriv = pline.GetFirstDerivative(pt);
                deriv = deriv.GetNormal();
                Vector3d perp = deriv.GetPerpendicularVector();

                Point3d p1 = pt - deriv.RotateBy(0.785398, Vector3d.ZAxis) * arrowSideL;
                Point3d p2 = pt - deriv.RotateBy(-0.785398, Vector3d.ZAxis) * arrowSideL;

                wd.Geometry.WorldLine(pt, p1);
                wd.Geometry.WorldLine(pt, p2);
            }
            #endregion

            #region End cirkel
            Point3d p = pline.EndPoint;

            int               nrOfPoints = 16;
            double            phiDelta   = 2 * Math.PI / nrOfPoints;
            Vector3d          vec        = Vector3d.XAxis;
            Point3dCollection points     = new Point3dCollection();

            for (int i = 0; i < nrOfPoints; i++)
            {
                double  phi = phiDelta * i;
                Point3d pC  = p + vec.RotateBy(phi, Vector3d.ZAxis) * arrowSideL;
                points.Add(pC);
            }

            //wd.SubEntityTraits.FillType = Autodesk.AutoCAD.GraphicsInterface.FillType.FillAlways;
            wd.Geometry.Polygon(points);
            #endregion

            //Start and End labels

            //Point3d p = pline.StartPoint;
            //Vector3d derivP = pline.GetFirstDerivative(p);
            //wd.Geometry.Text(p, Vector3d.ZAxis, derivP, 2.0, 1.0, 0.0, "S");

            //p = pline.EndPoint;
            //derivP = pline.GetFirstDerivative(p);
            //wd.Geometry.Text(p, Vector3d.ZAxis, derivP, 2.0, 1.0, 0.0, "E");

            return(true);
        }
Beispiel #22
0
        protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw wd)
        {
            // Update the dummy vertex to be our 3D point
            // projected onto our plane
            if (_isArcSeg)
            {
                Point3d  lastVertex = _pline.GetPoint3dAt(_pline.NumberOfVertices - 2);
                Vector3d refDir;
                if (_pline.NumberOfVertices < 3)
                {
                    refDir = new Vector3d(1.0, 1.0, 0.0);
                }
                else
                {
                    // Check bulge to see if last segment was an arc or a line
                    if (_pline.GetBulgeAt(_pline.NumberOfVertices - 3) != 0)
                    {
                        CircularArc3d arcSegment = _pline.GetArcSegmentAt(_pline.NumberOfVertices - 3);
                        Line3d        tangent    = arcSegment.GetTangent(lastVertex);
                        // Reference direction is the invert of the arc tangent
                        // at last vertex
                        refDir = tangent.Direction.MultiplyBy(-1.0);
                    }
                    else
                    {
                        Point3d pt = _pline.GetPoint3dAt(_pline.NumberOfVertices - 3);
                        refDir = new Vector3d(lastVertex.X - pt.X, lastVertex.Y - pt.Y, lastVertex.Z - pt.Z);
                    }
                }
                double angle = Class1.JigUtils.ComputeAngle(lastVertex, _tempPoint, refDir, _ucs);
                // Bulge is defined as tan of one fourth of included angle
                // Need to double the angle since it represents the included
                // angle of the arc
                // So formula is: bulge = Tan(angle * 2 * 0.25)
                double bulge = Math.Tan(angle * 0.5);
                _pline.SetBulgeAt(_pline.NumberOfVertices - 2, bulge);
            }
            else
            {
                // Line mode. Need to remove last bulge if there was one
                if (_pline.NumberOfVertices > 1)
                {
                    _pline.SetBulgeAt(_pline.NumberOfVertices - 2, 0);
                }
            }
            _pline.SetPointAt(_pline.NumberOfVertices - 1, _tempPoint.Convert2d(_plane));

            if (_pline.NumberOfVertices == 3)
            {
                _pline.Closed = true;
                ObjectIdCollection ids = new ObjectIdCollection();
                ids.Add(_pline.ObjectId);
                // Add the hatch loops and complete the hatch
                _hat.Associative = true;
                _hat.AppendLoop(HatchLoopTypes.Default, ids);
            }
            if (!wd.RegenAbort)
            {
                wd.Geometry.Draw(_pline);
                if (_pline.NumberOfVertices > 2)
                {
                    _hat.EvaluateHatch(true);
                    if (!wd.RegenAbort)
                    {
                        wd.Geometry.Draw(_hat);
                    }
                }
            }
            return(true);
        }
Beispiel #23
0
 protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
 {
     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);
            }
 protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
 {
     Entities.Clear();
     return(true);
 }
Beispiel #26
0
 WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
 {
     return(false);
 }
Beispiel #27
0
            protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
            {
                //throw new System.Exception("The method or operation is not implemented.");

                return(true);
            }