Check if the bounded plane intersects the shell in HOOPS Visualize

Good day. I am new to Hoops Visualize. I am faced with a problem that I cannot solve. The task is to check if the bounded polygon (or bounded plane) intersects the shell (3D object).
I had two ideas for solving this problem:

  1. Use the HPS.Database.SelectByShell () method which was in the Collision detection example

This is how I create a shell:

geometrySegment.GetDrawingAttributeControl (). SetOverlay (Drawing.Overlay.Default);

        int [] face_list = new int [] {4, 0, 1, 2, 3};
        geometrySegment.InsertShell (points.ToArray (), face_list);

        geometrySegment.GetVisualEffectsControl (). SetSimpleReflection (false) .SetSimpleShadow (false) .SetSilhouetteEdgesEnabled (false) .SetPostProcessEffectsEnabled (false);
        geometrySegment.GetBoundingControl (). SetExclusion (true);

        geometrySegment.SetModellingMatrix (matrix);
        geometrySegment.SetIsHelperGeometryRecursively (true);

Here is my main code:
SelectionOptionsKit selectionOptions = new SelectionOptionsKit ();
selectionOptions.SetAlgorithm (Selection.Algorithm.Analytic);
selectionOptions.SetLevel (Selection.Level.Entity);
selectionOptions.SetScope (windowsSegmentKey);

        SearchResults searchShellResults = new SearchResults ();
        Search.Type [] types = new Search.Type [] {Search.Type.Shell};

        // geometrySegment is a segment to which I added a shell based on polygon points.
        geometrySegment.Find (types, Search.Space.Subsegments, out searchShellResults);
        SearchResultsIterator iterator = searchShellResults.GetIterator ();
        while (iterator.IsValid ())
            Key key = iterator.GetItem ();
            if (key.Type () == HPS.Type.ShellKey)
                ShellKey shellKey = new ShellKey (key);

                // Six objects are constantly returned
                ulong numSelectedItems = Database.SelectByShell (shellKey, selectionOptions, out SelectionResults selectionResults);
                SelectionResultsIterator srIterator = selectionResults.GetIterator ();
                while (srIterator.IsValid ())
                    SelectionItem selectionItem = srIterator.GetItem ();
                    selectionItem.ShowSelectedItem (out Key resultKey);
                    var typeOfObj = resultKey.Type ();
                    if (key.Type () == HPS.Type.ShellKey)

                    srIterator.Next ();

            iterator.Next ();

In numSelectedItems, six objects are always returned, although there is nothing on the stage except one shell for which I am looking for an intersection. I don’t know what I’m doing wrong. Please tell me, I will be grateful for any help.

  1. Use a cutting plane to define the intersection. I used the Extracting cutting plane geometry example at Here is my code:

// My cutting plane
Plane planeRes1 = new Plane (resultGearPoints);
workItemSegmentKey.GetVisibilityControl (). SetCutGeometry (true);
workItemSegmentKey.GetCuttingSectionAttributeControl (). SetCappingLevel (CuttingSection.CappingLevel.Segment) .SetCuttingLevel (CuttingSection.CuttingLevel.Local);
workItemSegmentKey.GetMaterialMappingControl (). SetCutEdgeColor (new RGBAColor (1, 0, 0));
workItemSegmentKey.InsertCuttingSection (planeRes1);

CutGeometryGatheringOptionsKit opt ​​= new CutGeometryGatheringOptionsKit ();
        opt.SetLevel (CuttingSection.GatheringLevel.Segment);

KeyPath path = new KeyPath ();
        path.Append (windowsSegmentKey);

        ulong cap_count = path.GatherCutGeometry (windowsSegmentKey.Subsegment ("caps"), opt);
        if (cap_count> 0)
             // my logic

When the workItemSegmentKey object was crossed by the cutting plane, a part of the object was cut off (everything is as it should be), but when the path.GatherCutGeometry () function was called to see how many objects would be cut off, cap_count is always equal to 0.
Tell me, I was thinking in the right direction when solving this problem. I would be very grateful for any help.

Best regards, Dmitry

Hi Dmitry,

sorry for the delay, it looks like you are evaluating or using HOOPS Visualize. This forum is dedicated to our Web Platform Product. You should be able to get some support from our team on our dedicated support channel for HOOPS Visualize, there:

If you do not know or have an account yet, please contact me in private message and provide me your name and the company you are working for so I can help you,

Best Regards,

Florian Maurice
Consulting Engineer, EMEA

Return to