View Issue Details

IDProjectCategoryView StatusLast Update
0033664CommunityOCCT:Visualizationpublic2024-09-06 22:48
ReporterJerome Monaco Assigned Tomzernova  
PrioritynormalSeveritymajor 
Status assignedResolutionopen 
PlatformWindowsOSVC++ 2022 
Product Version7.8.0 
Target Version7.9.0 
Summary0033664: Visualization - Selection does not work for simple shape
DescriptionHi gentlemen, I just checked that picking and selection are not working for a simple shape (OCC 7.8.0, windows 10, VS 2022).
I wanted to register a bug in bug tracker but do not find a way, so I post it here.

Please find in the attached .zip a brep file and a small tcl script to reproduce on you systems.

When the brep is displayed, it is possible to pick and select all faces of the arrow except the cylindrical body face.
I do not know at which version this problem comes but I am quite sure it was OK in 7.6.0.

Thanks in advance.
Best regards.
Jerome.
Steps To ReproduceLoad the attached .brep and try to pick or select the arrow cylindrical body face. On my computer I can pick/select all faces except the cylindrical one.
I have this problem on OCC 7.8.0 (I cannot select the good version in product version combo box).
TagsNo tags attached.
Test case number

Attached Files

  • select-fails.brep (35,969 bytes)
  • select-fails.tcl (183 bytes)
  • cylinder_surface.brep (17,961 bytes)

Activities

Jerome Monaco

2024-04-04 18:08

reporter  

select-fails.brep (35,969 bytes)
select-fails.tcl (183 bytes)

git

2024-07-19 02:16

administrator   ~0116260

Branch CR33664 has been created by mzernova.

SHA-1: 70e6be168688b9c8c0d867f1b0a2dcefe07145a6


Detailed log of new commits:

Author: mzernova
Date: Fri Jul 19 00:16:11 2024 +0100

    0033664: Visualization - Selection does not work for simple shape
    
    Fixed direction calculation for Select3D_SensitiveCylinder created from Geom_CylindricalSurface

mzernova

2024-07-19 02:16

developer   ~0116261

cylinder_surface.brep (17,961 bytes)

mzernova

2024-07-19 02:31

developer   ~0116262

Please review CR33664

Tests: http://jenkins-test-10.nnov.opencascade.com/view/CR33664-master-mzernova/view/ALL/

dpasukhi

2024-07-30 16:41

administrator   ~0116322

It is not accepted to have std::vector<gp_Pnt>. There are 2 possible way: Using Ncollection_List/Sequence.
Or using vector with NCollection_Allocator as a second template argument.
@mzernova

dpasukhi

2024-07-30 16:43

administrator   ~0116323

Additionally looks like you need to have only 2 elements in that vector. That is very not economic :)
Please reorganize solution to not occupate memory.
@mzernova

git

2024-07-30 17:22

administrator   ~0116326

Branch CR33664 has been updated forcibly by mzernova.

SHA-1: 32d20529de06fb8239500588905aa687481c338a

dpasukhi

2024-07-30 17:40

administrator   ~0116327

Looks well. Could you please combine commits together (in the same branch, force push)
@mzernova

git

2024-07-30 18:21

administrator   ~0116328

Branch CR33664 has been updated by mzernova.

SHA-1: 4a63bc0af4718078b9066ab77f9fee1235bd51a9


Detailed log of new commits:

Author: mzernova
Date: Tue Jul 30 16:21:07 2024 +0100

    # remarks from @vtryputs

git

2024-07-30 18:42

administrator   ~0116329

Branch CR33664 has been updated forcibly by mzernova.

SHA-1: cb759ffe4b390d073e622dce5712431caa348544

dpasukhi

2024-07-30 18:52

administrator   ~0116330

Last edited: 2024-07-30 18:54

@mzernova there will be a warning when going from 2 to 1 case. Need to add macros in that case.
Probably needs to add default case for switch (to avoid warning, but not sure).
There are not breaks, in that case need to add macros to go to next case.
+    case 2:
+    {
+      if (!aPos[0].IsEqual (aPos[1], Precision::Confusion()))
+      {
+        theDirection = gp_Dir(aPos[1].XYZ() - aPos[0].XYZ());
+      }
+    }
+    case 1:
+    {

switch (mySize) {
    case 1:
        // Some code
        Standard_FALLTHROUGH;
    case 2:
        // Some code
        break;
    default:
        // Some code
        break;
}


Additionally, what about change from int to size_t?

git

2024-07-30 19:33

administrator   ~0116332

Branch CR33664 has been updated forcibly by mzernova.

SHA-1: c4a9239758b24f8710db6ea6a9f9540e61bc84d8

dpasukhi

2024-07-31 10:59

administrator   ~0116335

@mzernova please check remarks from Martin in #33755
The issue is not fully fixed.

git

2024-07-31 13:45

administrator   ~0116338

Branch CR33664 has been updated by mzernova.

SHA-1: 8a35073ed45825177feb52962661fdf8ef48a350


Detailed log of new commits:

Author: mzernova
Date: Wed Jul 31 11:44:11 2024 +0100

    # Remarks from @vtryputs

git

2024-07-31 14:40

administrator   ~0116341

Branch CR33664 has been updated by mzernova.

SHA-1: 02fe39f27acca83f6263c331b6cbc906d343e2ee


Detailed log of new commits:

Author: mzernova
Date: Wed Jul 31 12:39:56 2024 +0100

    # Fix cone

git

2024-07-31 15:54

administrator   ~0116342

Branch CR33664 has been updated by mzernova.

SHA-1: 8463e922d34bb0953f93886f2dffe2cb4b26cb5e


Detailed log of new commits:

Author: mzernova
Date: Wed Jul 31 13:51:43 2024 +0100

    # Add test for cone

dpasukhi

2024-07-31 16:56

administrator   ~0116343

It is not recommended to not initiate variable. Some scenarios have no else conditions that is why value can be a garbage.
Standard_Real aRad1;
         Standard_Real aRad2;
-        if (aRad1 == 0.0)
+        Standard_Real aHeight;

git

2024-07-31 17:33

administrator   ~0116345

Branch CR33664 has been updated by vtryputs.

SHA-1: 8dd135248c971ad3097843aaa828c48d2f2d8c77


Detailed log of new commits:

Author: Vitaut Tryputsin
Date: Wed Jul 31 17:33:12 2024 +0300

    #fix cone

vtryputs

2024-07-31 17:51

developer   ~0116346

Found that selection doesn't work properly because of optimization algo for selection for cones and cylinders it doesn't include holes on surfaces

vtryputs

2024-07-31 17:53

developer   ~0116348

probably we should disable optimization and create separate ticket for it if needed

git

2024-07-31 18:06

administrator   ~0116349

Branch CR33664 has been updated by mzernova.

SHA-1: 537d6974947a4697a6cebd77dff12796707b4d39


Detailed log of new commits:

Author: mzernova
Date: Wed Jul 31 16:04:36 2024 +0100

    # fix cone with holes

git

2024-07-31 18:21

administrator   ~0116350

Branch CR33664 has been updated by mzernova.

SHA-1: 595635716e26192a818ce68d210f77833c1acaaf


Detailed log of new commits:

Author: mzernova
Date: Wed Jul 31 16:20:55 2024 +0100

    # Check circles nb

git

2024-07-31 18:22

administrator   ~0116351

Branch CR33664_1 has been created by mzernova.

SHA-1: 3f4e53d27ec88c2616d0f409241de37f699a5296


Detailed log of new commits:

Author: mzernova
Date: Fri Jul 19 00:16:11 2024 +0100

    0033664: Visualization - Selection does not work for simple shape
    
    Fixed direction calculation for Select3D_SensitiveCylinder created from Geom_CylindricalSurface

git

2024-07-31 18:37

administrator   ~0116352

Branch CR33664_1 has been updated forcibly by mzernova.

SHA-1: e70cb12048298466c501a056d7da659cb4187696

mzernova

2024-08-01 11:56

developer   ~0116356

Please review CR33664_1

Tests: http://jenkins-test-10.nnov.opencascade.com/view/CR33664-master-mzernova/view/ALL/

vtryputs

2024-08-02 09:29

developer   ~0116358

looks ok to me

dpasukhi

2024-08-02 12:44

administrator   ~0116359

Last edited: 2024-08-02 13:01

Dear mzernova. The solution is not optimal for memory.
Sequence - bidirectional list, List - forward list. (You solution occupate more x2 memory based on incorrect container).
But in our case we don't need any special container. We fully don't need to use dynamic memory(it is very not optimal memory for fast operations).
I recommend to you 2 option:
 - Create a special internal structure to keep 3 field: gp_Pnt first, gp_Pnt Last and size.
 - Extend signature of method with new 3 out parameters and return nothing.
As for me first option looks better. Everything inside single source file and you are free to create a middle structure to improve your code.
As for a speed up for salome - no needs, they already create their own workaround.
(if you will create a struct, please put it into anonymous namespace together with internal functions in the top of the source file)

git

2024-09-06 17:49

administrator   ~0116597

Branch CR33664 has been updated forcibly by mzernova.

SHA-1: a425f3ade1a68b18f26c1d97593fe58dc9835af7

git

2024-09-06 17:49

administrator   ~0116598

Branch CR33664_1 has been updated forcibly by mzernova.

SHA-1: 31078ca832f18f46fed161ae84163340e5786f8c

dpasukhi

2024-09-06 22:48

administrator   ~0116599

NCollection_Array1 is better. But still use dynamic memory and keeps any circles. But in your case you never touch elements in the middle, only first or last.

Issue History

Date Modified Username Field Change
2024-04-04 18:08 Jerome Monaco New Issue
2024-04-04 18:08 Jerome Monaco Assigned To => sshutina
2024-04-04 18:08 Jerome Monaco File Added: select-fails.brep
2024-04-04 18:08 Jerome Monaco File Added: select-fails.tcl
2024-04-04 20:54 dpasukhi Summary Selection / picking does not work for simple shape => Visualization - Selection does not work for simple shape
2024-04-04 20:56 dpasukhi Product Version => 7.8.0
2024-04-04 20:56 dpasukhi Target Version => 7.9.0
2024-07-15 17:09 dpasukhi Assigned To sshutina => mzernova
2024-07-19 02:16 git Note Added: 0116260
2024-07-19 02:16 mzernova Note Added: 0116261
2024-07-19 02:16 mzernova File Added: cylinder_surface.brep
2024-07-19 02:31 mzernova Assigned To mzernova => iko
2024-07-19 02:31 mzernova Status new => resolved
2024-07-19 02:31 mzernova Note Added: 0116262
2024-07-30 16:36 mzernova Assigned To iko => vtryputs
2024-07-30 16:41 dpasukhi Note Added: 0116322
2024-07-30 16:43 dpasukhi Note Added: 0116323
2024-07-30 17:22 git Note Added: 0116326
2024-07-30 17:40 dpasukhi Note Added: 0116327
2024-07-30 18:21 git Note Added: 0116328
2024-07-30 18:42 git Note Added: 0116329
2024-07-30 18:52 dpasukhi Note Added: 0116330
2024-07-30 18:52 dpasukhi Note Edited: 0116330
2024-07-30 18:54 dpasukhi Note Edited: 0116330
2024-07-30 19:33 git Note Added: 0116332
2024-07-31 10:59 dpasukhi Note Added: 0116335
2024-07-31 12:42 dpasukhi Assigned To vtryputs => mzernova
2024-07-31 12:42 dpasukhi Status resolved => assigned
2024-07-31 13:45 git Note Added: 0116338
2024-07-31 14:40 git Note Added: 0116341
2024-07-31 15:54 git Note Added: 0116342
2024-07-31 16:56 dpasukhi Note Added: 0116343
2024-07-31 17:33 git Note Added: 0116345
2024-07-31 17:51 vtryputs Note Added: 0116346
2024-07-31 17:53 vtryputs Note Added: 0116348
2024-07-31 18:06 git Note Added: 0116349
2024-07-31 18:21 git Note Added: 0116350
2024-07-31 18:22 git Note Added: 0116351
2024-07-31 18:37 git Note Added: 0116352
2024-08-01 11:56 mzernova Assigned To mzernova => vtryputs
2024-08-01 11:56 mzernova Status assigned => resolved
2024-08-01 11:56 mzernova Note Added: 0116356
2024-08-02 09:29 vtryputs Assigned To vtryputs => bugmaster
2024-08-02 09:29 vtryputs Status resolved => reviewed
2024-08-02 09:29 vtryputs Note Added: 0116358
2024-08-02 12:44 dpasukhi Assigned To bugmaster => mzernova
2024-08-02 12:44 dpasukhi Status reviewed => assigned
2024-08-02 12:44 dpasukhi Note Added: 0116359
2024-08-02 13:01 dpasukhi Note Edited: 0116359
2024-09-06 17:49 git Note Added: 0116597
2024-09-06 17:49 git Note Added: 0116598
2024-09-06 22:48 dpasukhi Note Added: 0116599