public CustomTrihedron(GeomAxis2Placement axisPlacement, AISInteractiveContext context)
        {
            _context       = context;
            _axisPlacement = axisPlacement;

            BuildAxis(axisPlacement);
        }
Beispiel #2
0
        private void ShowTrihedron()
        {
            _view.TriedronErase();

            // Build an XYZ axis trihedron and add it to Ocaf
            var coords = gp.XOY;

            coords.Location = new gpPnt(0, 0, 0);
            var axis = new GeomAxis2Placement(coords);
            //var trihedron = new AISTrihedron(axis);
            //trihedron.SetSize(15);
            //var aisDrawer = trihedron.Attributes();
            //var datumAspect = aisDrawer.DatumAspect();
            //var firstAxisAspect = datumAspect.FirstAxisAspect();
            //firstAxisAspect.SetColor(new QuantityColor(QuantityNameOfColor.Quantity_NOC_RED));
            //firstAxisAspect.SetWidth(2);
            //var secondAxisAspect = datumAspect.SecondAxisAspect();
            //secondAxisAspect.SetColor(new QuantityColor(QuantityNameOfColor.Quantity_NOC_GREEN));
            //secondAxisAspect.SetWidth(2);
            //var thirdAxisAspect = datumAspect.ThirdAxisAspect();
            //thirdAxisAspect.SetColor(new QuantityColor(QuantityNameOfColor.Quantity_NOC_BLUE1));
            //thirdAxisAspect.SetWidth(2);
            //trihedron.UnsetSelectionMode();

            //_context.Display(trihedron, false);

            var trihedron = new CustomTrihedron(axis, _context);

            trihedron.SetAxisLength(5);
            trihedron.Show();
        }
 private void BuildAxis(GeomAxis2Placement axisPlacement)
 {
     _xAxis = new AISAxis(axisPlacement, AISTypeOfAxis.AIS_TOAX_XAxis)
     {
         Width = 2
     };
     _xAxis.SetColor(QuantityNameOfColor.Quantity_NOC_RED);
     _yAxis = new AISAxis(axisPlacement, AISTypeOfAxis.AIS_TOAX_YAxis)
     {
         Width = 2
     };
     _yAxis.SetColor(QuantityNameOfColor.Quantity_NOC_GREEN);
     _zAxis = new AISAxis(axisPlacement, AISTypeOfAxis.AIS_TOAX_ZAxis)
     {
         Width = 2
     };
     _zAxis.SetColor(QuantityNameOfColor.Quantity_NOC_BLUE1);
 }
 public AISTrihedron(GeomAxis2Placement aComponent)
     :
     base(AIS_Trihedron_Ctor3B3DCDDA(aComponent.Instance))
 {
 }
Beispiel #5
0
 public void SetAxis2Placement(GeomAxis2Placement aComponent, AISTypeOfAxis anAxisType)
 {
     AIS_Axis_SetAxis2PlacementD1476D1E(Instance, aComponent.Instance, (int)anAxisType);
 }
Beispiel #6
0
 public AISAxis(GeomAxis2Placement aComponent, AISTypeOfAxis anAxisType)
     :
     base(AIS_Axis_CtorD1476D1E(aComponent.Instance, (int)anAxisType))
 {
 }
Beispiel #7
0
        /// <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);
        }
Beispiel #8
0
 public void SetAxis2Placement(GeomAxis2Placement aComponent, AISTypeOfPlane aPlaneType)
 {
     AIS_Plane_SetAxis2PlacementA35F2F3B(Instance, aComponent.Instance, (int)aPlaneType);
 }
Beispiel #9
0
 public AISPlane(GeomAxis2Placement aComponent, AISTypeOfPlane aPlaneType, bool aCurrentMode)
     :
     base(AIS_Plane_Ctor8C5294A9(aComponent.Instance, (int)aPlaneType, aCurrentMode))
 {
 }