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.
Check if item is selected.
This topic has been viewed 4764 times and has 5 replies
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".
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".
Re: Check if item is selected.
There’s no easier way, because there’s no [font=courier new]getParent[/font] method in [font=courier new]HomePieceOfFurniture[/font] class. You’ll have to find the group of each selected item when it doesn’t belong to the list returned by [font=courier new]home.getFurniture()[/font].
Emmanuel Puybaret, Sweet Home 3D creator
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?
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?
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;
}
}
}
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;
}
}
}
Re: Check if item is selected.
I've made it. Thanks for your help.
Who is online
Users browsing this forum: No registered users and 1 guest