|
Sweet Home 3D Forum » List all forums » » Forum: Developers » » » Thread: Check if item is selected. |
|
| Print at Dec 16, 2025, 3:20:02 AM | View all posts in this thread on one page |
| Posted by jrmobile at Aug 16, 2020, 4:40:40 PM |
|
Check if item is selected. Good day everyone. Spent hours in developers guide, trying to find out, how do check in plugin if PieceOfFurniture is selected. Found only getSelectedItems() method, but maybe there is easier way to check it, intead of checking, if my items are in group? If there is no easier way, would you be so kind to show me the exact code to check if items are in selected group. I'm not expert in java, so would really appreciate it. Anyway thanks in advance. |
| Posted by jrmobile at Aug 17, 2020, 1:04:17 AM |
|
Re: Check if item is selected. I'm trying this way List<selectableItem> selectedItems = home.getSelectedItems(); List<HomePieceOfFurniture> furniture = selectedItems.getFurniture(); But it fires an error selectableItem cannot be resolved to a type. Same with type "Selectable". |
| Posted by Puybaret at Aug 17, 2020, 4:57:03 PM |
|
Re: Check if item is selected. There’s no easier way, because there’s no getParent method in HomePieceOfFurniture class. You’ll have to find the group of each selected item when it doesn’t belong to the list returned by home.getFurniture(). ---------------------------------------- Emmanuel Puybaret, Sweet Home 3D creator |
| Posted by jrmobile at Aug 17, 2020, 8:43:52 PM |
|
Re: Check if item is selected. Emmanuel, Thank you very much for your reply. I know that it is very brazenly, but i ask you to help in making a code piece to obtain a list за selected furniture, by the algorithm you've described? |
| Posted by jrmobile at Aug 17, 2020, 9:02:45 PM |
|
Re: Check if item is selected. I'm trying this one, but it still fires an error selectable cannot be resolved to a type List<Selectable> selectedItems = home.getSelectedItems(); List<HomePieceOfFurniture> furniture = selectedItems.getFurniture(); for (HomePieceOfFurniture homePiece : furniture) { if (selectedItems.contains(homepiece)) { continue; } } } |
| Posted by jrmobile at Aug 18, 2020, 12:35:44 AM |
|
Re: Check if item is selected. I've made it. Thanks for your help. |
|
|
Current timezone is GMT Dec 16, 2025, 3:20:02 AM |