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: 3
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 4423 times and has 2 replies Next Thread
enkonyito
Advanced Member




Joined: May 28, 2015
Post Count: 607
Status: Offline
Reply to this Post  Reply with Quote 
How to group furniture using a plug-in?

Using a plug-in, I want to group furniture added to the plan for a specific action.
My concern is that a new furniture group can only be defined by at least a furniture list and a name.
----------------------------------------
EnkoNyito
[Dec 30, 2020, 4:11:54 AM] 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: How to group furniture using a plug-in?

What other capabilities would you expect?
Look at FurnitureController class to understand how a furniture group is created and handled. The difficult thing is probably to allow undo / redo on groups, but maybe you won't need that?
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Dec 31, 2020, 1:33:56 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
enkonyito
Advanced Member




Joined: May 28, 2015
Post Count: 607
Status: Offline
Reply to this Post  Reply with Quote 
Re: How to group furniture using a plug-in?

What other capabilities would you expect?
I thought it would be possible to create an empty group and then add the furniture to it separately.

Look at FurnitureController class to understand how a furniture group is created and handled.
It was the addFurnitureToGroup method that caused me problems because it is necessary to have a list of furniture and a group of furniture as a parameter.

The difficult thing is probably to allow undo / redo on groups, but maybe you won't need that?
As it is to add new light sources in the plan, the undo/redo function is not negligible.

Even though it's not very intuitive, I was able to work around the issues by using the methods provided by the FurnitureController class.
getHomeController().getPlanController().setSelectedLevel(lightLevel);
List<HomePieceOfFurniture> singleLightSource = new ArrayList<HomePieceOfFurniture>();
singleLightSource.add(lightSourceClone);
getHomeController().getFurnitureController().addFurniture(singleLightSource);
severalLightSources.add(lightSourceClone);
...
getHomeController().getFurnitureController().setSelectedFurniture(severalLightSources);
getHomeController().getFurnitureController().groupSelectedFurniture();
HomeFurnitureGroup lightSourcesGroup = (HomeFurnitureGroup) getHome().getSelectedItems().get(0);

----------------------------------------
EnkoNyito
[Jan 3, 2021, 2:28:18 AM] 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