Print multiple pages alocated on the same dwg file

Print multiple pages alocated on the same dwg file

Anonymous
Not applicable
3,829 Views
5 Replies
Message 1 of 6

Print multiple pages alocated on the same dwg file

Anonymous
Not applicable

I have like 20 electrical layouts on the same dwg file, all te times when I need to print, It´s necessary to plot and select wich one with window option. Its desgusting. I tried batch plot, but just works if I have one drawing in one file, so dont fit to me.

 

Im sending a shotscreen for reference from one file like this. Is preatty common electrical files like these. So I believe that someone has a smarter way to print.

0 Likes
3,830 Views
5 Replies
Replies (5)
Message 2 of 6

SENL1362
Advisor
Advisor
That's why they (Autodesk) invented Layout's in the drawing. Assign each Schematical area with a Layout using Viewports. Then the other tools such as BatchPlot, Publish or autosave Layout to PDF help you to get the data printed.

The alternative is to write Plot scripts who calculate the area to plot for each Schema.
Message 3 of 6

Anonymous
Not applicable

Do you know any script. Becaouse the file was not created by me.

0 Likes
Message 4 of 6

SENL1362
Advisor
Advisor

The functions to perform for the script depends on the contents of the drawing, so there is probably no generic solution.

 

So the first you need is that the set of drawings always are build up the same or follow certain pattern.

In you’re case you need the plotarea's to plot(the smaller green rectangles) --  among other plot params like the printer, papersiz, plotstyles etc.

So if you can find these green area's then to plot these schemas wouldn't be too complicated.

 

 

 

 

0 Likes
Message 5 of 6

SENL1362
Advisor
Advisor

A simple Program to Plot ModelSpace Area's would look like this:

 

        [CommandMethod("MP")]
        public static void MultiPlot()
        {
            Document doc = null;
            Database db = null;
            Editor ed = null;

            string plotAreaLayerName="PLOTAREA";
            string printerName = "DWG To PDF.pc3";
            string plotPaperName = "ISO A3 (420.00 x 297.00 MM)";
            string plotStyleName = "acad.ctb";


            try
            {
                doc = AcadApp.DocumentManager.MdiActiveDocument;
                if (doc == null)
                    throw new System.Exception("No MdiActiveDocument");
                db = doc.Database;
                ed = doc.Editor;



                //1. Calculate each ModelSpace PlotArea's based on Rectangle on Layer PlotArea
                var plotAreas=new List<Point3d[]>();
                using (Transaction tr=db.TransactionManager.StartTransaction())
                {

                    var lt=tr.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable;
                    if (!lt.Has(plotAreaLayerName))
                        throw new System.Exception("Layer not found: " + plotAreaLayerName);
                    var plotAreaLayerId=lt[plotAreaLayerName];

                    var ms = tr.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(db), OpenMode.ForRead) as BlockTableRecord;

                    foreach (ObjectId id in ms)
                    {
                        if (id.ObjectClass.DxfName == "POLYLINE")
                        {
                            var pl = tr.GetObject(id, OpenMode.ForRead) as Polyline;
                            if (pl.LayerId == plotAreaLayerId)
                            {
                                //Assume no rotated areas: PlotArea==BoundingBox
                                var plotArea = new Point3d[2];
                                plotArea[1] = pl.Bounds.Value.MinPoint;
                                plotArea[2] = pl.Bounds.Value.MaxPoint;
                                plotAreas.Add(plotArea);
                            }
                        }
                    }
                    tr.Commit();
                }

  
                //2. Plot each ModelSpace Area
                // Detailed plot configuration? [Yes/No] <No>: yes
                // Enter a layout name or [?] <Model>: Model
                // Enter an output device name or [?] <None>: dwg to pdf
                // Enter paper size or [?] <ANSI A (11.00 x 8.50 Inches)>: ISO A3 (420.00 x 297.00 MM)
                // Enter paper units [Inches/Millimeters] <Millimeters>: Millimeters
                // Enter drawing orientation [Portrait/Landscape] <Landscape>: Landscape
                // Plot upside down? [Yes/No] <No>: No
                // Enter plot area [Display/Extents/Limits/View/Window] <Display>: Window
                // Enter lower left corner of window <0.000000,0.000000>: PlotArea[0]
                // Enter upper right corner of window <0.000000,0.000000>: PlotArea[1]
                // Enter plot scale (Plotted Millimeters=Drawing Units) or [Fit] <Fit>: Fit
                // Enter plot offset (x,y) or [Center] <17.34,4.14>: Center
                // Plot with plot styles? [Yes/No] <Yes>: Yes
                // Enter plot style table name or [?] (enter . for none) <>: acad.ctb
                // Plot with lineweights? [Yes/No] <Yes>: Yes
                // Enter shade plot setting [As displayed/legacy Wireframe/legacy Hidden/Visual styles/Rendered] <As displayed>: As displayed
                // Enter file name <C:\temp\DwgName-Model.pdf>: c:/temp/dwgName-Scheme-1.dwg
                // Save changes to page setup [Yes/No]? <N> No
                // Proceed with plot [Yes/No] <Y>: Yes

                var docPath=Path.GetDirectoryName(doc.Name);
                if (!doc.IsNamedDrawing)
                    docPath=Path.GetTempPath();
                var docName=Path.GetFileNameWithoutExtension(doc.Name);

                Application.SetSystemVariable("FILEDIA",0);
                int pltNr=1;
                foreach (var plotArea in plotAreas)
                {

                    var plotPathname = Path.Combine(docPath, docName + "-Scheme_" + pltNr.ToString() + ".pdf");
                    while (File.Exists(plotPathname))
                    {
                        pltNr++;
                        plotPathname = Path.Combine(docPath, docName + "-Scheme_" + pltNr.ToString() + ".pdf");
                    }
                    ed.Command("-PLOT", "Yes", "Model", printerName, plotPaperName, "Millimeters", "Landscape", "No", "Window", plotArea[0], plotArea[1], "Fit", "Center", "Yes", plotStyleName, "Yes", "As displayed", plotPathname.Replace("\\", "/"), "No", "Yes");
                    if (!File.Exists(plotPathname))
                        ed.WriteMessage("Plot Failed: {0}..{1}, {2}", plotArea[0], plotArea[1], plotPathname);

                }
            }
            catch (System.Exception ex)
            {
                if (ed != null)
                    ed.WriteMessage("\n Error in MultiPlot: {0}", ex.Message);
            }
            Application.SetSystemVariable("FILEDIA",1);

        }

 

 

 

0 Likes
Message 6 of 6

Anonymous
Not applicable

use this : 
after load this lisp

MPL command 

0 Likes