For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Zoom/Rotate after certain extent makes the graphics disappear

Ivy Monteiro's picture
Forums: 

Hello,

I am new to occ development so any help related to my topic would be helpful. Working in .net c# platform. Recently upgraded OCC to 7.2.0.

Here is my class containing code for adding line:

      public class MyAnnotationManager
    {
        private V3d_Viewer myViewer;
        private V3d_View myView;
        private AIS_InteractiveContext myAISContext;
        private Prs3d_Presentation prsPresentation;

        public MyAnnotationManager(V3d_View view, V3d_Viewer viewer, AIS_InteractiveContext context)
        {
            this.myView = view;
            this.myViewer = viewer;
            this.myAISContext = context;

            Graphic3d_StructureManager structureManager = myAISContext.MainPrsMgr().StructureManager();
            this.prsPresentation = new Prs3d_Presentation(structureManager);
        }

       public void AddLine(MathLine3D line, QuantityNameOfColor color,double width = 2, DisplayLineType displayLineType = DisplayLineType.Solid)
        {
            Quantity_NameOfColor lineColor = (Quantity_NameOfColor)color;

            Graphic3d_AspectLine3d lineAspect = new Graphic3d_AspectLine3d();
            lineAspect.SetColor(new Quantity_Color(lineColor));
            lineAspect.SetWidth(width);

            if(displayLineType == DisplayLineType.Line_Dash)
                lineAspect.SetType(Aspect_TypeOfLine.Aspect_TOL_DASH);
            else if(displayLineType == DisplayLineType.Line_Dotted)
                lineAspect.SetType(Aspect_TypeOfLine.Aspect_TOL_DOT);
                
            Graphic3d_Group polyLineGroup = Prs3d_Root.CurrentGroup(prsPresentation);
            polyLineGroup.SetPrimitivesAspect(lineAspect);

            gp_Pnt pt1 = OCCConvertor.gp_Pnt(line.Start);
            gp_Pnt pt2 = OCCConvertor.gp_Pnt(line.End);

            Graphic3d_ArrayOfPolylines grLine = new Graphic3d_ArrayOfPolylines(2);
            grLine.AddVertex(pt1);
            grLine.AddVertex(pt2);

            polyLineGroup.AddPrimitiveArray(grLine);

           prsPresentation.Display();

        }

}

The line gets added perfectly fine. Colour, Width, dashed/dotted/solid all works perfect. The problem that I have here is when I zoom/ rotate in the canvas, at certain extent the line disappears.

Has anyone come across this problem? Any help would be appreciated.

Thank you,

Ivy