/// <summary> /// Initializes the OpenCascade views and assigns them View handles. /// </summary> private static void Setup(ref V3dViewer viewer, ref AISInteractiveContext context, ref V3dPerspectiveView view, Control control) { // Initialize the Device var device = new Graphic3dWNTGraphicDevice(); // Create the V3d Viewer //QuantityColor color = new QuantityColor(70 / 255.0, 82 / 255.0, 102 / 255.0, QuantityTypeOfColor.Quantity_TOC_RGB); viewer = new V3dViewer(device, "Preview", "Render", 1000, V3dTypeOfOrientation.V3d_XposYnegZpos, QuantityNameOfColor.Quantity_NOC_GRAY30, V3dTypeOfVisualization.V3d_ZBUFFER, V3dTypeOfShadingModel.V3d_GOURAUD, V3dTypeOfUpdate.V3d_WAIT, true, true, V3dTypeOfSurfaceDetail.V3d_TEX_NONE); if (CreateLights(viewer)) { viewer.SetLightOn(); } // Create the Interactive Context context = new AISInteractiveContext(viewer); // Create an OpenCascade view for each visible Custom controls view = CreateView(device, viewer, control); SetVisualMode(context); }
private static V3dPerspectiveView CreateView(WNTGraphicDevice device, V3dViewer viewer, Control control) { // Assign to each Custom control an OpenCascade View var view = new V3dPerspectiveView(viewer); view.SetDegenerateModeOn(); view.Transparency = true; view.SurfaceDetail = V3dTypeOfSurfaceDetail.V3d_TEX_ALL; // Attach to the OpenCascade view a Custom control //IntPtr attachedViewHandle = (attachedView as Form).Handle; var aWntWindow = new WNTWindow(device, control.Handle, QuantityNameOfColor.Quantity_NOC_MATRAGRAY); view.SetWindow(aWntWindow); view.TriedronDisplay( AspectTypeOfTriedronPosition.Aspect_TOTP_LEFT_LOWER, QuantityNameOfColor.Quantity_NOC_WHITE, 0.02, V3dTypeOfVisualization.V3d_WIREFRAME); if (!aWntWindow.IsMapped) { aWntWindow.Map(); } //view.SetAntialiasingOn(); view.Redraw(); view.MustBeResized(); view.Reset(true); return(view); }