Forum

Author Topic: 'Assign Class' bug when no point is selected?  (Read 1606 times)

yowich

  • Newbie
  • *
  • Posts: 42
    • View Profile
'Assign Class' bug when no point is selected?
« on: October 06, 2019, 11:02:54 PM »
Hi,
I wanted to select points having H=250, S = 25, V = 25 in a dense cloud and assign those selected points to 'ground' class. The codes I used are as follows:

Code: [Select]
1: chunk = Metashape.app.document.chunk
2: dense_cloud = chunk.dense_cloud
3: dense_cloud.selectPointsByColor(color=[250,25,25], tolerance=22, channels='HSV')
4: dense_cloud.assignClass(2)

I found that line number 3 didn't select any point but line number 4 assigned all points in the dense cloud to ground class. Why?

If I try to replace the line number 4 with the interactive menu system (Tools - Dense Cloud - Assign Class), I can't do it because 'Assign Class' is inactive in the menu. If there was no point selected, the assign class should not run, but why does it assign all points to the target class? Is it a bug?

I know there is 'assignClassToSelection' method as well. I am not sure what this English means but I believe it will assign selected points to the target class. But I can't use this method in my python script because this method pops up a message window and stops processing if there is no point selected.

Is there a python api that lets me find how many points are selected in a dense cloud? Then I can deal with this matter by skipping the 'Assign Class' procedure when no point is selected.

« Last Edit: October 06, 2019, 11:52:30 PM by yowich »