Beispiel #1
0
        private void Init()
        {
            if (!init && !disposed && !Disposing && !IsDesigner)
            {
                extents = new Extents3d();

                Autodesk.AutoCAD.GraphicsSystem.Manager gsm = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.GraphicsManager;

                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  = BackColor;

                view             = new Autodesk.AutoCAD.GraphicsSystem.View();
                view.VisualStyle = new Autodesk.AutoCAD.GraphicsInterface.VisualStyle(Autodesk.AutoCAD.GraphicsInterface.VisualStyleType.Wireframe2D);
                model            = gsm.CreateAutoCADModel(kernel);

                device.Add(view);

                init = true;
            }
        }
Beispiel #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);
            }
        }
Beispiel #3
0
        private void Init()
        {
            if (!init && !disposed && !Disposing && !IsDesigner)
            {
                extents = new Extents3d();

                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.CreateAutoCADDevice(kernel, this.Handle);
                device.DeviceRenderType = RendererType.Default;
                device.BackgroundColor = BackColor;

                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.CreateAutoCADDevice(this.Handle);
                device.DeviceRenderType = RendererType.Default;
                device.BackgroundColor = BackColor;

                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.CreateAutoCADDevice(this.Handle);
                device.DeviceRenderType = RendererType.Default;
                device.BackgroundColor = BackColor;

                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);
                device.Update();

                init = true;
            }
        }
Beispiel #4
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);
            }
        }