//显示重载
        public override bool WorldDraw(Drawable drawable, WorldDraw wd)
        {
            LArrow3 la = new LArrow3(drawable);

            la.WorldDraw(wd);
            return(base.WorldDraw(drawable, wd));
        }
        //获取夹点,简单实体应重载该函数以获取更灵活的控制
        public override void GetGripPoints(Entity entity, GripDataCollection grips, double curViewUnitSize, int gripSize, Vector3d curViewDir, GetGripPointsFlags bitFlags)
        {
            LArrow3 la = new LArrow3(entity);

            base.GetGripPoints(entity, grips, curViewUnitSize, gripSize, curViewDir, bitFlags);
            grips.Remove(grips[2]);
            grips.Add(new LArrowGripData3(la.Position));
        }
        //移动夹点
        public override void MoveGripPointsAt(Entity entity, GripDataCollection grips, Vector3d offset, MoveGripPointsFlags bitFlags)
        {
            LArrow3 la = new LArrow3(entity);

            foreach (GripData gd in grips)
            {
                if (gd is LArrowGripData3)
                {
                    LArrowGripData3 lagd = (LArrowGripData3)gd;
                    lagd.Move(la, offset);
                }
            }
            for (int i = grips.Count - 1; i >= 0; i--)
            {
                if (grips[i] is LArrowGripData3)
                {
                    grips.Remove(grips[i]);
                }
            }
            if (grips.Count > 0)
            {
                base.MoveGripPointsAt(entity, grips, offset, bitFlags);
            }
        }
 public void Move(LArrow3 la, Vector3d vec)
 {
     la.Position += vec;
     la.SaveExtendedData();
 }
 void IExtensionApplication.Terminate()
 {
     LArrow3.OverruleEnd();
     Overrule.Overruling = false;
 }
        public static void DoIt()
        {
            Document            doc       = Application.DocumentManager.MdiActiveDocument;
            Editor              ed        = doc.Editor;
            PromptDoubleOptions optDouble = new PromptDoubleOptions("\n请输入箭头长度:");

            optDouble.AllowNone       = true;
            optDouble.AllowZero       = false;
            optDouble.DefaultValue    = CurrArrowLength;
            optDouble.UseDefaultValue = true;
            PromptDoubleResult resDouble = ed.GetDouble(optDouble);

            if (resDouble.Status == PromptStatus.OK)
            {
                //改变箭头长度设定值
                CurrArrowLength = resDouble.Value;
                PromptPointResult resStartPoint = ed.GetPoint("\n请输入起点:");
                if (resStartPoint.Status == PromptStatus.OK)
                {
                    PromptPointOptions optEndPoint = new PromptPointOptions("\n请输入终点:");
                    optEndPoint.BasePoint    = resStartPoint.Value;
                    optEndPoint.UseBasePoint = true;
                    PromptPointResult resEndPoint = ed.GetPoint(optEndPoint);
                    if (resEndPoint.Status == PromptStatus.OK)
                    {
                        Point3d  startpnt = resStartPoint.Value;
                        Point3d  endpnt   = resEndPoint.Value;
                        Database db       = doc.Database;
                        using (Transaction tr = db.TransactionManager.StartTransaction())
                        {
                            BlockTableRecord btr =
                                (BlockTableRecord)tr.GetObject(
                                    db.CurrentSpaceId,
                                    OpenMode.ForWrite,
                                    false);
                            Line line = new Line(startpnt, endpnt);
                            btr.AppendEntity(line);
                            tr.AddNewlyCreatedDBObject(line, true);
                            RegAppTable rat =
                                (RegAppTable)tr.GetObject(
                                    db.RegAppTableId,
                                    OpenMode.ForRead,
                                    false);
                            if (!rat.Has(RegAppName))
                            {
                                rat.UpgradeOpen();
                                RegAppTableRecord regapp = new RegAppTableRecord();
                                regapp.Name = RegAppName;
                                rat.Add(regapp);
                                tr.AddNewlyCreatedDBObject(regapp, true);
                            }
                            Point3d midpnt = (startpnt + endpnt.GetAsVector()) / 2;
                            LArrow3 la     = new LArrow3(line);
                            //附着当前设定的箭头长度
                            la.ArrowLength = CurrArrowLength;
                            la.Scale       = 0.5;
                            la.SaveExtendedData();
                            tr.Commit();
                        }
                    }
                }
            }
        }
 void IExtensionApplication.Initialize()
 {
     LArrow3.OverruleStart();
     Overrule.Overruling = true;
 }