예제 #1
0
        DisableEventsImp()
        {
            Utils.AcadUi.PrintToCmdLine("\nPublish Events Turned Off ...\n");

            Autodesk.AutoCAD.Publishing.Publisher pub = AcApp.Application.Publisher;

            pub.AboutToBeginBackgroundPublishing -= new Autodesk.AutoCAD.Publishing.AboutToBeginBackgroundPublishingEventHandler(event_AboutToBeginBackgroundPublishing);
            pub.AboutToBeginPublishing           -= new Autodesk.AutoCAD.Publishing.AboutToBeginPublishingEventHandler(event_AboutToBeginPublishing);
            pub.AboutToEndPublishing             -= new Autodesk.AutoCAD.Publishing.AboutToEndPublishingEventHandler(event_AboutToEndPublishing);
            pub.AboutToMoveFile             -= new Autodesk.AutoCAD.Publishing.AboutToMoveFileEventHandler(event_AboutToMoveFile);
            pub.BeginAggregation            -= new Autodesk.AutoCAD.Publishing.BeginAggregationEventHandler(event_BeginAggregation);
            pub.BeginEntity                 -= new Autodesk.AutoCAD.Publishing.BeginEntityEventHandler(event_BeginEntity);
            pub.BeginPublishingSheet        -= new Autodesk.AutoCAD.Publishing.BeginPublishingSheetEventHandler(event_BeginPublishingSheet);
            pub.BeginSheet                  -= new Autodesk.AutoCAD.Publishing.BeginSheetEventHandler(event_BeginSheet);
            pub.CancelledOrFailedPublishing -= new Autodesk.AutoCAD.Publishing.CancelledOrFailedPublishingEventHandler(event_CancelledOrFailedPublishing);
            pub.EndEntity  -= new Autodesk.AutoCAD.Publishing.EndEntityEventHandler(event_EndEntity);
            pub.EndPublish -= new Autodesk.AutoCAD.Publishing.EndPublishEventHandler(event_EndPublish);
            pub.EndSheet   -= new Autodesk.AutoCAD.Publishing.EndSheetEventHandler(event_EndSheet);
            pub.InitPublishOptionsDialog -= new Autodesk.AutoCAD.Publishing.InitPublishOptionsDialogEventHandler(event_InitPublishOptionsDialog);
        }
예제 #2
0
        static public void PublisherDSD()
        {
            try
            {
                DsdEntryCollection collection = new DsdEntryCollection();
                DsdEntry           entry;

                entry         = new DsdEntry();
                entry.Layout  = "Layout1";
                entry.DwgName = "c:\\Temp\\Drawing1.dwg";
                entry.Nps     = "Setup1";
                entry.Title   = "Sheet1";
                collection.Add(entry);

                entry         = new DsdEntry();
                entry.Layout  = "Layout1";
                entry.DwgName = "c:\\Temp\\Drawing2.dwg";
                entry.Nps     = "Setup1";
                entry.Title   = "Sheet2";
                collection.Add(entry);

                DsdData dsd = new DsdData();

                dsd.SetDsdEntryCollection(collection);

                dsd.ProjectPath     = "c:\\Temp\\";
                dsd.LogFilePath     = "c:\\Temp\\logdwf.log";
                dsd.SheetType       = SheetType.MultiDwf;
                dsd.NoOfCopies      = 1;
                dsd.DestinationName = "c:\\Temp\\PublisherTest.dwf";
                dsd.SheetSetName    = "PublisherSet";
                dsd.WriteDsd("c:\\Temp\\publisher.dsd");


                int nbSheets = collection.Count;

                using (PlotProgressDialog progressDlg =
                           new PlotProgressDialog(false, nbSheets, true))
                {
                    progressDlg.set_PlotMsgString(
                        PlotMessageIndex.DialogTitle,
                        "Plot API Progress");
                    progressDlg.set_PlotMsgString(
                        PlotMessageIndex.CancelJobButtonMessage,
                        "Cancel Job");
                    progressDlg.set_PlotMsgString(
                        PlotMessageIndex.CancelSheetButtonMessage,
                        "Cancel Sheet");
                    progressDlg.set_PlotMsgString(
                        PlotMessageIndex.SheetSetProgressCaption,
                        "Job Progress");
                    progressDlg.set_PlotMsgString(
                        PlotMessageIndex.SheetProgressCaption,
                        "Sheet Progress");

                    progressDlg.UpperPlotProgressRange = 100;
                    progressDlg.LowerPlotProgressRange = 0;

                    progressDlg.UpperSheetProgressRange = 100;
                    progressDlg.LowerSheetProgressRange = 0;

                    progressDlg.IsVisible = true;

                    Autodesk.AutoCAD.Publishing.Publisher publisher =
                        Application.Publisher;

                    Autodesk.AutoCAD.PlottingServices.PlotConfigManager.
                    SetCurrentConfig("DWF6 ePlot.pc3");

                    publisher.PublishDsd(
                        "c:\\Temp\\publisher.dsd", progressDlg);
                }
            }
            catch (Autodesk.AutoCAD.Runtime.Exception ex)
            {
                PGA.MessengerManager.MessengerManager.AddLog(ex.Message);
            }
        }