Exemple #1
0
        public override object Execute(vdControls.vdFramedControl vdFramedControl)
        {
            if (_setList == null)
            {
                return(null);
            }

            if (_moveNothingCount >= 1)
            {
                _setIndex = -1;
            }

            ++_setIndex;
            if (_setIndex <= _setList.Count - 1)
            {
                _moveNothingCount = 0;
                var entities = _setList[_setIndex];
                VdActionUtil.SelectFigures(vdFramedControl.BaseControl.ActiveDocument, entities);
                VdActionUtil.LocateFigures(vdFramedControl.BaseControl.ActiveDocument, entities);
                VdActionUtil.RefreshVectorDraw(vdFramedControl.BaseControl.ActiveDocument);
            }
            else
            {
                ++_moveNothingCount;
            }
            return(null);
        }
Exemple #2
0
        public override object Execute(vdControls.vdFramedControl vdFramedControl)
        {
            var document = vdFramedControl.BaseControl.ActiveDocument;
            var layout   = vdFramedControl.BaseControl.ActiveDocument.ActiveLayOut;

            var gripSelection    = VdActionUtil.GetGripSelection(layout);
            var srcList          = layout.Entities.Cast <vdFigure>().ToList();
            var entitiesOfSample = gripSelection.Cast <vdFigure>().ToList();

            var processor = new MatchProcessor(document);

            return(processor.Match(srcList, entitiesOfSample));
        }
        public override object Execute(vdControls.vdFramedControl vdFramedControl)
        {
            var document       = vdFramedControl.BaseControl.ActiveDocument;
            var vdGrid         = vdFramedControl.vdGrid;
            var selectedObjArr = vdGrid.SelectedObject as object[];

            if (selectedObjArr == null)
            {
                return(null);
            }
            VdActionUtil.LocateFigures(document, selectedObjArr.OfType <vdFigure>().ToList());
            VdActionUtil.RefreshVectorDraw(document);
            return(null);
        }
        public override object Execute(vdControls.vdFramedControl vdFramedControl)
        {
            var document  = vdFramedControl.BaseControl.ActiveDocument;
            var selection = VdActionUtil.GetGripSelection(document.ActionLayout);

            if (selection.Count == 0)
            {
                return(string.Empty);
            }
            var sb = new StringBuilder();

            foreach (vdFigure figure in selection)
            {
                sb.AppendLine($"{figure.GetType().Name}, Handle={figure.HandleId}");
            }
            return(sb);
        }
        private Box GetBoundingBox(vdControls.vdFramedControl vdFramedControl)
        {
            var    document = vdFramedControl.BaseControl.ActiveDocument;
            gPoint gp1;

            if (document.ActionUtility.getUserPoint(out gp1) != StatusCode.Success)
            {
                return(null);
            }
            Box box;

            if (document.ActionUtility.getUserRectViewCS(gp1, out box) != StatusCode.Success)
            {
                return(null);
            }
            return(box);
        }
        public override object Execute(vdControls.vdFramedControl vdFramedControl)
        {
            var commandLine = vdFramedControl.CommandLine;

            while (true)
            {
                var box = GetBoundingBox(vdFramedControl);
                if (box == null)
                {
                    commandLine.History.AppendText("\r\n");
                    commandLine.History.AppendText("Quit");
                    break;
                }
                ExecuteLoop(vdFramedControl, box);
            }
            return(null);
        }
Exemple #7
0
        public static void SmartVisibleLayout(vdControls.vdFramedControl vd, vdControls.vdFramedControl.LayoutStyle layoutStyle)
        {
            var visible = vd.GetLayoutStyle(layoutStyle);

            vd.SetLayoutStyle(layoutStyle, !visible);
            if (visible)
            {
                return;
            }
            if (layoutStyle == vdControls.vdFramedControl.LayoutStyle.PropertyGrid)
            {
                var selection = VdActionUtil.GetGripSelection(vd.BaseControl.ActiveDocument.ActionLayout);
                if (selection.Count > 0)
                {
                    vd.vdGrid.SelectedObject = selection;
                }
                else
                {
                    vd.vdGrid.SelectedObject = vd.BaseControl.ActiveDocument;
                }
            }
        }
        private void ExecuteLoop(vdControls.vdFramedControl vdFramedControl, Box box)
        {
            var commandLine = vdFramedControl.CommandLine;
            var document    = vdFramedControl.BaseControl.ActiveDocument;
            var layout      = document.ActiveLayOut;

            commandLine.History.AppendText("\r\n");
            commandLine.History.AppendText($"BoundingBox = {box}");
            commandLine.History.AppendText("\r\n");

            var emfWidth  = 500;                                      //fixed width
            var emfHeight = (int)(emfWidth * box.Height / box.Width); // keep propotions

            var fileDir = Path.Combine(Application.StartupPath, "Print Results");

            if (!Directory.Exists(fileDir))
            {
                Directory.CreateDirectory(fileDir);
            }
            var filePath = Path.Combine(fileDir, DateTime.Now.ToFileTime() + ".wmf");

            commandLine.History.AppendText($"File Path = {filePath}");
            commandLine.History.AppendText("\r\n");

            //导出EMF
            layout.Printer.InitializeProperties();
            layout.Printer.PrinterName = filePath;
            layout.Printer.Resolution  = 96; //Screen DPI
            layout.Printer.paperSize   = new Rectangle(0, 0,
                                                       emfWidth * 100 / layout.Printer.Resolution,
                                                       emfHeight * 100 / layout.Printer.Resolution);
            layout.Printer.PrintWindow = box;
            layout.Printer.PrintOut();
            commandLine.History.AppendText($"File Exist = {File.Exists(filePath)}");
            commandLine.History.AppendText("\r\n");
        }
Exemple #9
0
 public abstract object Execute(vdControls.vdFramedControl vdFramedControl);