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 6556 times and has 5 replies Next Thread
tfstdsi
Newbie




Joined: Jun 29, 2012
Post Count: 1
Status: Offline
Reply to this Post  Reply with Quote 
Adding new elements

hello,

I'm new in this project and I want to develop new tools, objects...
I learned how to develop a simple plugin from the tutorial,
now my objective is to add a new personalized element (for exemple in room "chambre" ) also how to create
a new category like the folder "chambre" in the application ,
the problem is that I' cant find the part of code in which i make these changes ,
so i participate in this forum hoping to find assistance .

thank you in advance.
[Jun 29, 2012, 5:26:36 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: 9423
Status: Offline
Reply to this Post  Reply with Quote 
Re: Adding new elements

Objects shown in the furniture catalog tree are CatalogPieceOfFurniture instances stored in FurnitureCategory and FurnitureCatalog objects. The furniture catalog in use in the program can be retrieved from UserPreferences instance that is proposed in plug-ins and many other places.
The best way to learn how catalog pieces are handled is to study the DefaultFurnitureCatalog and FileUserPreferences classes. Modifying the current catalog will be automatically reflected in the catalog tree component, so try to understand first how to create these pieces and add them in the user preferences catalog with these two classes.

By the way, it would be nice to explain what is your goal?
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
[Jul 1, 2012, 12:01:12 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
anandunadkat
Newbie




Joined: Jan 15, 2013
Post Count: 17
Status: Offline
Reply to this Post  Reply with Quote 
Re: Adding new elements

I am trying to do the same thing. I want to add new objects to the current library within my plugin. I am really struggling because i am new to sweet home 3d and java.

It would be a great help if someone knew how it can be done. I am basically trying to create a plugin to import a bathroom template with basic furniture but some furniture is not in the library so i want to import it through java code. i have a create new object method but it doesnt work
[Jan 16, 2013, 11:31:29 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Sajmmon
Member



Poland
Joined: Nov 10, 2010
Post Count: 50
Status: Offline
Reply to this Post  Reply with Quote 
Re: Adding new elements

So you wish to embed OBJ models in your plugin, so that your users did not need to download separatelly a plugin and a library of furniture. In my opinion you can either:

- use aformentioned classes,
- copy furniture library to a folder from which SH3D loads them

the first way gives you models immediatelly, but they disappear after startup. The second way is persistent, but models will be visible after restarting the application.

Hope I helped
[Jan 16, 2013, 11:28: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 
anandunadkat
Newbie




Joined: Jan 15, 2013
Post Count: 17
Status: Offline
Reply to this Post  Reply with Quote 
Re: Adding new elements

So to give you an idea, i have pasted the code below.

public static void addRightAngleRail(Home home,
UserPreferences preferences, Float homeLength, Float homeBreadth) {
HomePieceOfFurniture furniture;
furniture =createFurniture(preferences,7 , 2, homeLength,homeBreadth-100);
furniture.setColor(-255);
furniture.setAngle(1.57f);
home.addPieceOfFurniture(furniture);

As you can see i have created a new object, but it doesnt want to appear, are you saying that i copy the furniture library to my eclipse project folder?
[Jan 17, 2013, 10:15:41 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Sajmmon
Member



Poland
Joined: Nov 10, 2010
Post Count: 50
Status: Offline
Reply to this Post  Reply with Quote 
Re: Adding new elements

Please have a look at my reply in thread:

http://www.sweethome3d.com/support/forum/viewthread_thread,3776

Good luck!
[Jan 17, 2013, 9:14:34 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 2024 Space Mushrooms - All rights reserved