Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 6
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 3455 times and has 5 replies Next Thread
jrmobile
Newbie



Россия
Joined: May 16, 2020
Post Count: 11
Status: Offline
Reply to this Post  Reply with Quote 
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.
[Aug 16, 2020, 2:40:40 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
jrmobile
Newbie



Россия
Joined: May 16, 2020
Post Count: 11
Status: Offline
Reply to this Post  Reply with Quote 
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".
[Aug 16, 2020, 11:04:17 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9178
Status: Offline
Reply to this Post  Reply with Quote 
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 developer
[Aug 17, 2020, 2:57:03 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
jrmobile
Newbie



Россия
Joined: May 16, 2020
Post Count: 11
Status: Offline
Reply to this Post  Reply with Quote 
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?
[Aug 17, 2020, 6:43:52 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
jrmobile
Newbie



Россия
Joined: May 16, 2020
Post Count: 11
Status: Offline
Reply to this Post  Reply with Quote 
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;
}
}
}
[Aug 17, 2020, 7:02:45 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
jrmobile
Newbie



Россия
Joined: May 16, 2020
Post Count: 11
Status: Offline
Reply to this Post  Reply with Quote 
Re: Check if item is selected.

I've made it. Thanks for your help.
[Aug 17, 2020, 10:35:44 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2024 eTeks - All rights reserved