コード例 #1
0
        /// <summary>
        /// Plot with override plot configuration
        /// </summary>
        /// <param name="pConfig"></param>
        public void Plot(AcadApplication acApp, EPlotConfig pConfig)
        {
            // Sort sheetset
            object[] sets = new object[m_sets.Count];

            foreach (object obj in m_sets)
            {
                if (obj is Sheet)
                {
                    Sheet s = obj as Sheet;
                    sets[s.Handle.Order] = obj;
                }
                else
                {
                    SheetSet s = obj as SheetSet;
                    sets[s.Handle.Order] = obj;
                }
            }

            // Plot without override config
            foreach (object obj in sets)
            {
                if (obj is Sheet)
                {
                    Sheet s = obj as Sheet;
                    s.Plot(acApp, pConfig);
                }
                else
                {
                    SheetSet s = obj as SheetSet;
                    s.Plot(acApp, pConfig);
                }
            }
            System.GC.Collect();
        }
コード例 #2
0
        /// <summary>
        /// Plot with override configuration
        /// </summary>
        /// <param name="acApp">AutoCAD application</param>
        /// <param name="plotConfig">Plot override Configuration</param>
        public void Plot(AcadApplication acApp, EPlotConfig pConfig)
        {
            AcadDocuments acDocs = acApp.Documents;
            int           opFlag = DocIndex(acDocs);

            if (Open(acApp))
            {
                AcadLayout acLot = acApp.ActiveDocument.ActiveLayout;

                // Store plot configuration of active layout
                double      numerator, denominator;
                EPlotConfig strConfig = new EPlotConfig(
                    acLot.ConfigName, acLot.CanonicalMediaName, acLot.StyleSheet,
                    acLot.PlotType, acLot.StandardScale, acLot.UseStandardScale,
                    1, acLot.CenterPlot, acLot.PlotRotation, false,
                    acLot.ScaleLineweights);//, acLot.PlotOrigin);
                acLot.GetCustomScale(out numerator, out denominator);

                try
                {
                    // Setting layout for plot
                    acLot.ConfigName         = pConfig.Plotter;
                    acLot.CanonicalMediaName = pConfig.CanonicalMediaName;
                    acLot.StyleSheet         = pConfig.PlotStyleTable;
                    acLot.PlotType           = pConfig.PlotType;
                    acLot.StandardScale      = pConfig.StandardScale;
                    acLot.UseStandardScale   = pConfig.UseStandardScale;
                    // NOTE: -----------------------------------------------------
                    // ROTATION AUTOMATICALLY FEATURE WILL BE WRITTEN IN NEXT TIME
                    // -----------------------------------------------------------
                    acLot.PlotRotation     = pConfig.PlotRotation;
                    acLot.ScaleLineweights = pConfig.IsScaleLineweight;
                    //acLot.PlotOrigin = pConfig.PlotOrigin;
                    acLot.SetCustomScale(pConfig.CustomScale, 1);

                    // Update plot config then Plot
                    acLot.RefreshPlotDeviceInfo();
                    acApp.ActiveDocument.Plot.PlotToDevice();
                }
                catch { }

                // Restore layout setting of plot
                acLot.ConfigName         = strConfig.Plotter;
                acLot.CanonicalMediaName = strConfig.CanonicalMediaName;
                acLot.StyleSheet         = strConfig.PlotStyleTable;
                acLot.PlotType           = strConfig.PlotType;
                acLot.StandardScale      = strConfig.StandardScale;
                acLot.UseStandardScale   = strConfig.UseStandardScale;
                acLot.PlotRotation       = strConfig.PlotRotation;
                acLot.ScaleLineweights   = strConfig.IsScaleLineweight;
                //acLot.PlotOrigin = strConfig.PlotOrigin;
                acLot.SetCustomScale(numerator, denominator);
            }

            // If sheet is not opened initially, closing this after plot finish
            if (opFlag == -1 && DocIndex(acDocs) != -1)
            {
                acDocs.Item(DocIndex(acDocs)).Close(false);
            }
        }