Example #1
0
        private void Init()
        {
            if (!init && !disposed && !Disposing && !IsDesigner)
            {
                Autodesk.AutoCAD.GraphicsSystem.Manager gsm = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.GraphicsManager;

            #if REBARPOS2015
                Autodesk.AutoCAD.GraphicsSystem.KernelDescriptor descriptor = new Autodesk.AutoCAD.GraphicsSystem.KernelDescriptor();
                descriptor.addRequirement(Autodesk.AutoCAD.UniqueString.Intern("3D Drawing"));
                Autodesk.AutoCAD.GraphicsSystem.GraphicsKernel kernel = Autodesk.AutoCAD.GraphicsSystem.Manager.AcquireGraphicsKernel(descriptor);

                device = gsm.CreateAutoCADOffScreenDevice(kernel);
                device.DeviceRenderType = Autodesk.AutoCAD.GraphicsSystem.RendererType.Default;
                device.BackgroundColor = CellBackColor;

                view = new Autodesk.AutoCAD.GraphicsSystem.View();
                view.VisualStyle = new Autodesk.AutoCAD.GraphicsInterface.VisualStyle(Autodesk.AutoCAD.GraphicsInterface.VisualStyleType.Wireframe2D);
                model = gsm.CreateAutoCADModel(kernel);
            #elif REBARPOS2013
                device = gsm.CreateAutoCADOffScreenDevice();
                device.DeviceRenderType = Autodesk.AutoCAD.GraphicsSystem.RendererType.Default;
                device.BackgroundColor = CellBackColor;

                view = new Autodesk.AutoCAD.GraphicsSystem.View();
                view.VisualStyle = new Autodesk.AutoCAD.GraphicsInterface.VisualStyle(Autodesk.AutoCAD.GraphicsInterface.VisualStyleType.Wireframe2D);
                model = gsm.CreateAutoCADModel();
            #elif REBARPOS2010
                device = gsm.CreateAutoCADOffScreenDevice();
                device.DeviceRenderType = Autodesk.AutoCAD.GraphicsSystem.RendererType.Default;
                device.BackgroundColor = CellBackColor;

                view = new Autodesk.AutoCAD.GraphicsSystem.View();
                view.VisualStyle = new Autodesk.AutoCAD.GraphicsInterface.VisualStyle(Autodesk.AutoCAD.GraphicsInterface.VisualStyleType.Wireframe2D);
                model = gsm.CreateAutoCADModel();
            #endif
                device.Add(view);

                init = true;
            }
        }
Example #2
0
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (device != null)
                {
                    device.EraseAll();
                }
                if (view != null)
                {
                    view.EraseAll();
                    view.Dispose();
                    view = null;
                }
                if (model != null)
                {
                    model.Dispose();
                    model = null;
                }
                if (device != null)
                {
                    device.Dispose();
                    device = null;
                }

                init = false;
                disposed = true;
            }
            finally
            {
                base.Dispose(disposing);
            }
        }