HiddenLineDrawing recognizes segment visibility in a wrong way?!

Hi.
I’m trying to use HiddenLineDrawing to create make2D for geometries in c#. My problem is that it doesn’t recognizes the “segments visibility” state correctly. For example, as you can see in images, when I set the viewport to the Top view, It recognizes “visible” or “hidden” lines as “unset” lines. Does anyone know what’s the problem? Thanks.


This looks like really interesting work. Would you be happy to share the c# code?

Sure, but it’s not working correctly. Here’s the code:

        //"geometries" is the list of geometries to create make2D for.
        var doc = RhinoDoc.ActiveDoc;
        //****SET TOP VIEWPORT****//
        RhinoViewport topView = new RhinoViewport();
        foreach (RhinoView view in doc.Views.GetStandardRhinoViews())
        {
            if (view.MainViewport.Name == "Top") topView = view.MainViewport;
        }
        //****MAKE 2D****//
        HiddenLineDrawingParameters hdp = new HiddenLineDrawingParameters();
        hdp.AbsoluteTolerance = doc.ModelAbsoluteTolerance;
        for (int i = 0; i < geometries.Count; i++) hdp.AddGeometry(geometries[i], "");
        hdp.SetViewport(topView);
        var hld = HiddenLineDrawing.Compute(hdp, true);

        List<Curve> visMake2dCrvs = new List<Curve>();
        List<Curve> hidMake2dCrvs = new List<Curve>();
        List<Curve> proMake2dCrvs = new List<Curve>();
        List<Curve> dupMake2dCrvs = new List<Curve>();
        List<Curve> clipMake2dCrvs = new List<Curve>();
        List<Curve> unMake2dCrvs = new List<Curve>();

        var vis = HiddenLineDrawingSegment.Visibility.Visible;
        var hid = HiddenLineDrawingSegment.Visibility.Hidden;
        var un = HiddenLineDrawingSegment.Visibility.Unset;
        var pro = HiddenLineDrawingSegment.Visibility.Projecting;
        var clip = HiddenLineDrawingSegment.Visibility.Clipped;
        var dup = HiddenLineDrawingSegment.Visibility.Duplicate;

        for (int i = 0; i < hld.Segments.Count(); i++)
        {
            if (hld.Segments.ElementAt(i).SegmentVisibility == vis) visMake2dCrvs.Add(hld.Segments.ElementAt(i).CurveGeometry);
            if (hld.Segments.ElementAt(i).SegmentVisibility == hid) hidMake2dCrvs.Add(hld.Segments.ElementAt(i).CurveGeometry);
            if (hld.Segments.ElementAt(i).SegmentVisibility == un) unMake2dCrvs.Add(hld.Segments.ElementAt(i).CurveGeometry);
            if (hld.Segments.ElementAt(i).SegmentVisibility == pro) proMake2dCrvs.Add(hld.Segments.ElementAt(i).CurveGeometry);
            if (hld.Segments.ElementAt(i).SegmentVisibility == clip) clipMake2dCrvs.Add(hld.Segments.ElementAt(i).CurveGeometry);
            if (hld.Segments.ElementAt(i).SegmentVisibility == dup) dupMake2dCrvs.Add(hld.Segments.ElementAt(i).CurveGeometry);
        }