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: 2
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 1310 times and has 1 reply Next Thread
ThisOne
Newbie




Joined: Nov 23, 2020
Post Count: 1
Status: Offline
Reply to this Post  Reply with Quote 
Easiest way to change furniture data in an actively running desktop instance (maybe through a plugin)?

So what I'm trying to do is, have a plugin, that allows me to load
positional data from somewhere (sql, REST, w/e) in real time every x time units, and then immediately apply it to the currently loaded furniture so that they are also immediately updated in the 3D view.

I want to make use of the desktop client, NOT The java browser version, which I want to put back into its coffin asap.

I have done some research and so far have found 2 APIs.

1) A javascript api

2) A java api

Are these interchangable and can they even do what I need them to do?

Do you use these APIs to write plugins?

Which one is better suited for which purpose?

Is what I am looking for even possible in sweet home 3d?

Can you point me to some tutorials on how to start?


I wish you the best of luck in these difficult times and am eagerly awaiting your answers.
[Nov 23, 2020, 2:37: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 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 7375
Status: Offline
Reply to this Post  Reply with Quote 
Re: Easiest way to change furniture data in an actively running desktop instance (maybe through a plugin)?

I guess you meant the link http://www.sweethome3d.com/jsdoc for JavaScript API wink

The JavaScript API is closed to the Java API but is not exactly the same of course. First, two different languages with programming styles and different libraries can't lead to the same API. For example, Java lists were replaced by JavaScript arrays and Java BigDecimal class was replaced by Big class in big.js.
Then, Sweet Home 3D JS isn't as complete as Sweet Home Java yet, so the JavaScript API contains less classes at the moment.

Almost all Java classes of com.eteks.sweethome3d.model and com.eteks.sweethome3d.viewcontroller packages + HomeXMLHandler class are automatically translated with JSweet which helps to keep a similar API (even if the Java package names weren't kept in JavaScript).
Other classes like 3D classes and UI classes are manually translated and use a similar API too when possible.

Plug-ins are written in Java. They don't have any counterpart in JavaScript but I don't think it would have some meaning. You can program any additional feature in JavaScript by just using Sweet Home 3D JS API in a customized web page.

Which one is better suited for which purpose?
Quickly said, Java API is for the desktop installer version of Sweet Home 3D and JS API for the online web version.

To help you start writing Java plug-ins, read plug-in developer's guide.
If you target a web version, read that guide too because it will give you a general idea of Sweet Home 3D API, download SweetHome3DJS source code, build the project reading README.TXT included in the source code, and inspire yourself from testHomeModifications in testHome.js. You could also have a look at Sweet Home 3D Online guide if you don't want to handle the server part yourself.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Nov 27, 2020, 12:29:34 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [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-2021 eTeks - All rights reserved