public void Display(bool updateViewer)
        {
            OCAIS2D_InteractiveContext context2d = GetContext();

            if (context2d.IsDisplayed(this))
            {
                context2d.Redisplay(this, updateViewer, false);
            }
            else
            {
                context2d.Display(this, updateViewer);
            }
        }
Exemple #2
0
        public void Project3DModel()
        {
            OCTopoDS_Shape topoShape = WorkItem.Services.Get <ILocalContextService>().CurrentSelectedShape;

            if (topoShape == null)
            {
                return;
            }

            // Project the selected 3d object in the 2D plane

            // Make the projector
            bool     isPerspective   = WorkItem.Services.Get <ILocalContextService>().IsPerspective;
            OCgp_Pnt viewPoint       = WorkItem.Services.Get <ILocalContextService>().ViewPointPosition;
            OCgp_Vec highPointVector = WorkItem.Services.Get <ILocalContextService>().HighPointVector;

            OCgp_Ax2 ax2 = GeomUtils.ExtractAxis(topoShape);

            OCgp_Dir direction;

            if (ax2 != null)
            {
                direction = ax2.Direction();
            }
            else
            {
                direction = new OCgp_Dir(0, 1, 0);
            }
            // Use as projection vector the direction of the plane of the selected shape
            OCPrs3d_Projector aPrs3dProjector = new OCPrs3d_Projector(isPerspective, 1, direction.X(), direction.Y(), direction.Z(),
                                                                      viewPoint.X(), viewPoint.Y(), viewPoint.Z(), highPointVector.X(), highPointVector.Y(), highPointVector.Z());

            // Display the 2D projection shape
            OCAIS2D_ProjShape projShape = new OCAIS2D_ProjShape(aPrs3dProjector.Projector(), 3, false, true);

            projShape.Add(topoShape);
            context2d.Display(projShape, true);
        }
        /// <summary>
        /// Shows the marker.
        /// </summary>
        /// <param name="updateViewer"></param>
        public void Display(bool updateViewer)
        {
            OCAIS2D_InteractiveContext context2d = GetContext();

            context2d.Display(this, updateViewer);
        }