Beispiel #1
0
        public static void CreateBackgroundFromDrawing()
        {
            // Access and lock the current drawing document + database
            HostApplicationServices.WorkingDatabase = CADDatabaseUtilities.CurrentDatabase;

            /* If the drawing has any AEC or Proxy Objects, send out to
             * AECTOACAD, Audit, Purge and then start processing
             */

            ACADLayout[] layouts = { };

            // Create appropriate directories
            CADFileUtilities.CreateTypicalProjectDirectories();
            using (var locked = CurrentDocument.LockDocument())
            {
                // Gather a list of all necessary external references from document
                // Export each external reference to the file system
                CADDatabaseUtilities.ExportAllExternalReferences();

                // audit and purge the document of extraneous data
                CurrentDocument.CleanDocument();

                // Create a list of layouts in the document
                // Create a list of the viewports and their status/data
                layouts = CADDatabaseUtilities.CopyLayouts().ToArray();
            }

            // Save the consultant drawing to the file system
            SaveCurrentDrawing();

            // *************************************************

            // Create new drawing based on BR+A drawing template
            foreach (var layout in layouts)
            {
                var newDoc =
                    CurrentDocument.CreateNewDocument(DrawingTemplate, CADFileUtilities.NewBackgroundDirectory, layout.Name);

                Application.DocumentManager.MdiActiveDocument = newDoc;

                var newLayout = newDoc.CreateNewLayout("Work");

                newLayout.AddViewports(layout.Viewports);
            }

            // Insert consultant drawing as external reference

            // Create an appropiately sized layout based on Layout in Architectural Drawing

            // Place a BR+A Title Block and TBLKInfo on the Layout

            // audit and purge the document of extraneous data
            CurrentDocument.CleanDocument();
        }
Beispiel #2
0
        public ACADLayout Map(Layout layout)
        {
            var xMin = layout.Limits.MinPoint.X;
            var xMax = layout.Limits.MaxPoint.Y;
            var yMin = layout.Limits.MinPoint.X;
            var yMax = layout.Limits.MaxPoint.Y;

            var viewports = CADDatabaseUtilities.GetAllViewports(layout);

            return(new ACADLayout
            {
                Name = layout.LayoutName,
                Height = Math.Round(layout.PlotPaperSize.X / 25.4),
                Width = Math.Round(layout.PlotPaperSize.Y / 25.4),
                PaperSize = PaperUtilities.CalculatePaperSize(xMin, xMax, yMin, yMax),
                Orientation = PaperUtilities.CalculatePaperOrientation(xMin + xMax, yMin + yMax),
                Viewports = viewports.Select(vp => _vpMapper.Map(vp))
            });
        }
Beispiel #3
0
 public static IEnumerable <Layout> GetAllLayoutsFromDocument()
 {
     return(CADDatabaseUtilities.GetAllLayouts());
 }