//-------------------------------------------------------------------------------------------------- public void InitV3dViewer() { if (V3dViewer == null) { var ocGraphicDriver = Occt.Helper.Graphic3d.CreateOpenGlDriver(); V3dViewer = new V3d_Viewer(ocGraphicDriver); } V3dViewer.SetDefaultViewSize(1000.0); V3dViewer.SetDefaultViewProj(V3d_TypeOfOrientation.V3d_XposYposZpos); V3dViewer.SetDefaultBackgroundColor(Quantity_NameOfColor.Quantity_NOC_GRAY30.ToColor()); V3dViewer.SetDefaultVisualization(V3d_TypeOfVisualization.V3d_ZBUFFER); V3dViewer.SetLightOn(new V3d_DirectionalLight(V3d_TypeOfOrientation.V3d_Zneg, Quantity_NameOfColor.Quantity_NOC_WHITE.ToColor(), true)); V3dViewer.SetLightOn(new V3d_AmbientLight(Quantity_NameOfColor.Quantity_NOC_WHITE.ToColor())); V3dViewer.Grid().SetColors(Quantity_NameOfColor.Quantity_NOC_GRAY45.ToColor(), Quantity_NameOfColor.Quantity_NOC_GRAY30.ToColor()); // Reinit viewer parameters _ApplyWorkingContext(); }
public void Run(IOccContainerMultiView sceneWorkspace, ActionsGraph actionsGraph, PartModelingView newView, ViewInfo viewInfo) { _attachedView = sceneWorkspace; _actionGraph = actionsGraph; var uiItems = _actionGraph[InputNames.UiElementsItem].GetData(NotificationNames.GetValue).Get <UiElementsItem.Items>(); _treeView = uiItems.TreeView; _wpfPropertyView = (PropertyGridView)uiItems.WpfPropertyView; _wpfLayerView = (LayerView)uiItems.LayerView; _helpView = uiItems.HelpView; _commandLineView = _actionGraph[InputNames.CommandLineView].GetData(NotificationNames.GetValue).Get <CommandLineView>(); _metaModifierContainer = new CommandList(_actionGraph); _actionGraph.OnSwitchAction += UpdateSwitchAction; Application.DoEvents(); _actionGraph.Register(new FunctionFactoryInput()); DefaultFunctions.Setup(_actionGraph); var defaultConstraintFunctions = new DefaultConstraintFunctions(); defaultConstraintFunctions.Setup(_actionGraph); OccInitialize.Setup(ref _device, ref _viewer, ref _context, out _view, _attachedView); InitDocument(); _solver = new Solver(_document); UpdateSolverOptions(); ViewInfoSetup(viewInfo); RegisterModifiers(); InitializeInputs(); DefineShapeConcepts(); SetupChangedShapeEvent(); ViewInfoPostSetup(); UserInterfaceSetup(); SwitchUserAction(ModifierNames.StartUp); var optionsSetup = actionsGraph[InputNames.OptionsSetupInput].Get <OptionsSetup>(); optionsSetup.Register(new AutoSaveOptionsItem()); var occSection = optionsSetup.UpdateSectionNode(OptionSectionNames.Background); var color = occSection.GetColorValue(0); _viewer.SetDefaultBackgroundColor((ShapeUtils.GetOccColor(color))); //SetGradientBackground(); ForceStartupViewUpdate(); OptionsEventMapping(optionsSetup); var presenter = newView.GetPresenter(); presenter.OnMouseMoveHandler += MouseMoveHandler; presenter.OnMouseDownHandler += MouseDownHandler; presenter.OnMouseUpHandler += MouseUpHandler; presenter.OnMouseWheelHandler += MouseWheelHandler; presenter.OnResizeEvent += ResizeView; ApplicationNotificationUtils.Instance.ExitingApplication += () => SwitchUserAction(ModifierNames.NaroExit); _view.SurfaceDetail = V3dTypeOfSurfaceDetail.V3d_TEX_ALL; new SketchSolveUpdater(_document); SetOriginalGradientBackground(); ResumeRunning(); }