public CustomTrihedron(GeomAxis2Placement axisPlacement, AISInteractiveContext context) { _context = context; _axisPlacement = axisPlacement; BuildAxis(axisPlacement); }
/// <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 void SetVisualMode(AISInteractiveContext context) { if (context == null) { return; } context.SetDisplayMode(AISDisplayMode.AIS_Shaded, true); }
private void SetDocument(Document document) { var context = document.Root.Set <DocumentContextInterpreter>().Context; _context = context; _gizmoDocument.Root.Set <DocumentContextInterpreter>().Context = _context; _gizmoDocument.Root.Set <ActionGraphInterpreter>().ActionsGraph = ActionsGraph; _gizmoDocument.Transact(); }
/// <summary> /// Initializes the OpenCascade views and assigns them View handles. /// </summary> public static void Setup(ref Graphic3dWNTGraphicDevice device, ref V3dViewer viewer, ref AISInteractiveContext context, out V3dView view, IOccContainerMultiView attachedView) { // Initialize the Device try { device = new Graphic3dWNTGraphicDevice(); Debug.Assert(device != null); } catch (Exception ex) { Debug.Assert(false, ex.Message); } // Create the V3d Viewer try { //QuantityColor color = new QuantityColor(70 / 255.0, 82 / 255.0, 102 / 255.0, QuantityTypeOfColor.Quantity_TOC_RGB); viewer = new V3dViewer(device, "Visu3D", "", 1000, V3dTypeOfOrientation.V3d_XposYnegZpos, QuantityNameOfColor.Quantity_NOC_GRAY30, V3dTypeOfVisualization.V3d_ZBUFFER, V3dTypeOfShadingModel.V3d_GOURAUD, V3dTypeOfUpdate.V3d_WAIT, true, true, V3dTypeOfSurfaceDetail.V3d_TEX_NONE); Debug.Assert(viewer != null); if (CreateLights(viewer)) { viewer.SetLightOn(); } } catch (Exception ex) { Debug.Assert(false, ex.Message); } // Create the Interactive Context try { context = new AISInteractiveContext(viewer); Debug.Assert(context != null); context.HilightColor = (QuantityNameOfColor.Quantity_NOC_RED); } catch (Exception ex) { Debug.Assert(false, ex.Message); } // Create an OpenCascade view for each visible Custom controls CreateView(device, viewer, out view, attachedView); //PaintBackground(view, Color.LightBlue, Color.Blue); SetVisualMode(context); }
protected override void OnReceiveInputData(string inputName, DataPackage data) { base.OnReceiveInputData(inputName, data); switch (inputName) { case InputNames.Context: _context = data.Get <AISInteractiveContext>(); break; } }
private static void UpdateTransparency(AISInteractiveContext context, Node parent, AISInteractiveObject interactive) { // If the label has transparency information display the object with that transparency var value = 0.0; if (parent.Get <DrawingAttributesInterpreter>().HasTransparency) { value = parent.Get <DrawingAttributesInterpreter>().Transparency; } context.SetTransparency(interactive, value, false); }
public static int Main() { var confusion = Precision.Confusion; var mainWindow = new MainWindow(); var panel = mainWindow.panel1; Graphic3dWNTGraphicDevice device = null; V3dViewer viewer = null; AISInteractiveContext context = null; V3dView view; OccInitialize.Setup(ref device, ref viewer, ref context, out view, panel); //var point = new gpPnt(); //var secondPoint = point.Convert<gpPnt>(); //Console.WriteLine(point.X); return(0); }
private static void UpdateInteractiveColor(AISInteractiveContext context, Node parent, AISInteractiveObject interactive, bool setWireAspect) { var col = Color.DarkTurquoise; var colorInterpreter = parent.Get <DrawingAttributesInterpreter>(); if (colorInterpreter.HasNoColor) { context.Display(interactive, false); return; } if (colorInterpreter.HasColorSet) { col = colorInterpreter.Color; } var color = ShapeUtils.GetOccColor(col); var layerContainer = parent.Root.Get <LayerContainerInterpreter>(); if (layerContainer.UseLayerColors) { var layerIndex = parent.Get <LayerVisibilityInterpreter>().TagIndex; color = ShapeUtils.GetOccColor(layerContainer.LayerColors[layerIndex]); } context.SetColor(interactive, color, false); var drawer = interactive.Attributes; if (setWireAspect) { var wireAspect = drawer.WireAspect; wireAspect.SetColor(color.Name()); wireAspect.Width = (1.5); drawer.LineAspect = (new Prs3dLineAspect(QuantityNameOfColor.Quantity_NOC_GRAY70, AspectTypeOfLine.Aspect_TOL_DOT, 0.5)); var pointAspect = drawer.PointAspect; pointAspect.SetColor(color.Name()); pointAspect.Scale = (1); context.SetDisplayMode(interactive, (int)colorInterpreter.DisplayMode, false); } if (colorInterpreter.EnableSelection == false) { interactive.UnsetSelectionMode(); interactive.HilightMode = (3); } context.Display(interactive, false); }
private void SourceContextHandler(DataPackage data) { _context = data.Get <AISInteractiveContext>(); }
public SolverDrawer(AISInteractiveContext context) { SetContext(context); }
private static void SetVisualMode(AISInteractiveContext context) { context.SetDisplayMode(AISDisplayMode.AIS_Shaded, true); }
private void SetContext(AISInteractiveContext context) { _context = context; _solverDrawerDocument.Root.Set <DocumentContextInterpreter>().Context = _context; }
/// <summary> /// Initializes the OpenCascade views and assigns them View handles. /// </summary> private void InitializeOpenCascade() { // Initialize the Devices device3d = new Graphic3dWNTGraphicDevice(); // Create the V3d Viewer try { viewer3d = new V3dViewer(device3d, "Hello", "", 100, V3dTypeOfOrientation.V3d_XnegYpos, QuantityNameOfColor.Quantity_NOC_ALICEBLUE, V3dTypeOfVisualization.V3d_ZBUFFER, V3dTypeOfShadingModel.V3d_GOURAUD, V3dTypeOfUpdate.V3d_WAIT, true, true, V3dTypeOfSurfaceDetail.V3d_TEX_ALL); // manual default Debug.Assert(viewer3d != null); if (CreateLights()) { viewer3d.SetLightOn(); } } catch (Exception ex) { Debug.Assert(false, ex.Message); throw; //re-throw exception } // Create the 3D Interactive Context try { context3d = new AISInteractiveContext(this.viewer3d); Debug.Assert(context3d != null); if (context3d != null) { //context3d.HilightColor = NameOfColor.Quantity_NOC_DARKSLATEGRAY; //context3d.SelectionColor = NameOfColor.Quantity_NOC_WHITE; } } catch (Exception ex) { Debug.Assert(false, ex.Message); throw; // re-throw exception } // create the 2D interactive context //try //{ // context2d = new AIS2D_InteractiveContext(this.viewer2d); // Debug.Assert(context2d != null); // if (context2d != null) // { // //context.HilightColor = NameOfColor.Quantity_NOC_DARKSLATEGRAY; // //context.SelectionColor = NameOfColor.Quantity_NOC_WHITE; // } //} //catch (Exception ex) //{ // Debug.Assert(false, ex.Message); // throw; // re-throw exception //} // Create an OpenCascade view for each visible Custom controls CreateView3D(); //CreateView2D(); //SetVisualMode(); //bool executeTemporaryCode = true; //if (executeTemporaryCode) //{ // temporary code ------------------- // Draw a box for (int i = 0; i < 500; i += 10) { var pnt = new gpPnt(i, i, i); //OCBRepPrimAPI_MakeBox box = new BRepPrimAPI_MakeBox(pnt, 100, 100, 100); var box = new BRepPrimAPIMakeBox(pnt, 50, 50, 50); var shape = new AISShape(box.Shape); context3d.Display(shape, false); // manual default } view3d.FitAll(0.01, false, true); // manual default // ----------------------------------- //} // Build an XYZ axis trihedron and add it to Ocaf var coords = gp.ZOX; coords.Location = new gpPnt(0, 0, 0); var axis = new GeomAxis2Placement(coords); var trihedron = new AISTrihedron(axis) { Size = 200 }; context3d.Display(trihedron, false); }
private void SourceContextHandler(DataPackage data) { _context = data.Get <AISInteractiveContext>(); _mirrorDocument.Root.Set <DocumentContextInterpreter>().Context = _context; }
public ContextInput(AISInteractiveContext context) : base(InputNames.Context) { _context = context; }
public FacePickerMockPipe(AISInteractiveContext context, V3dView view) : base(InputNames.FacePickerPlane) { _context = context; _view = view; }
private void OnContext(DataPackage data) { _context = data.Get <AISInteractiveContext>(); }
public FacePickerVisualFeedbackPipe(AISInteractiveContext context) : base(InputNames.FacePickerVisualFeedbackPipe) { _context = context; }