I was playing with it today and I’m very happy. You’ve done a really good job.
It takes like 2-3 sec to load my ground level of the house (150 MB) on my laptop.
But once loaded it is instant play. Even if one changes the tab and comes back there’s no reload.
Firefox is just a little bit faster than chrome.
There is a little bit annoying the object ID changing with obj change. Especially when one has 50+ lights in the house like mine.
Thanks uss, I need this kind of extensive tests. Also any kind of suggestions to improve. The object ID changing is really something I cannot change (unless I build a custom export). Only way to reduce the impact, is to never delete objects. But I agree, it is annoying
In old Laptop it may also be necessary to activate the HW acceleration provided by the GPU in Chrome / Firefox. The browser itself has to be in the list of GPU enabled executables and inside Chrome / Firefox there are settings for HW acceleration. I will give ore hints in the README
Hello Jampez, I’m not familiar about the animation in Three.js; for sure it is not coming from SweetHome3D. For basic things like rotating a window pane when the windows is opened, this can be achieved (i’m actually working at it). But all type of animations need specific coding. To make an example: if you want to put a mannequin in a scene and you want it to move from room to room depending on the room presence, this requires a lot of coding and modeling (which point in the model is representing the room, etc.).
I’ve seen that you approved the inclusion of my repository as default in HACS, can you push the rest of the community to approve ? It is not urgent…
I created a tutorial with a step to step configuration of the card: from the SweetHome3D modeling to the binding of the model to the entities in a custom card. Here it is:
Andy,
I’ve been thinking to the problem of object name change. Been looking into SweetHome3D’s code.
I understand why the problem appears.
As far as I can see, there is a way to solve it.
Make SweetHome3D export the o [object name] tag (it doesn’t do it now, one reason might be the fact that SweetHome3D accepts the same name for several different instances of the same object).
If you look into the file
SweetHome3D-6.5.2-src\src\com\eteks\sweethome3d\j3d\OBJWriter.java
from line 335:
private void writeNode(Node node, String nodeName, Transform3D parentTransformations)
basically it parses the objects by calling itself and goes down for the children of the Group (see lines 343-347). Tests can be made to make it export the “o” tag.
If export is ok, eventually, a SweetHome3D plugin can be written, basically the same code in plugin format.
On the other side, floor3d-card has to get the o tag (which btw. has to have unique name) and use it as object name. In this way an object will always have the same name no matter what changes to the SweetHome3D design is made.
I can go into some details if I wasn’t clear enough.
very well spotted. I have to admit, I did not dare to go into SweetHome3D code, but now that you have pointed me to the file, we can work something out. This is the bad guy;
ShapeIndex is recalculated at each export and it is not local to one tree branch. You are right it is a brute force way to ensure the o tags are unique.
Using the name of the root object (in the modify furniture dialog) as the root of the o tag and a ShapeIndex local to the branch, may solve the problem.
Are you looking into how to build a plugin ? I think that I would need some spare time to set myself into it…
I will look into, but after I finish preparing and seeding the lawn . I’m already late!
In the mean time, will you check something on floor3d-card side?
Export a simple 2 objects obj from SweetHome3D.
Edit and insert o tags.
Can you do object select (defined by o tag) in floor3d-card?
Hello uss, the o tag is well managed by the three.js library but it is not the one that can be used to build interaction with (build light, hide, etc.) I need more timeto confirm what I’m saying, with further testing. On the other hand if someone is up to develop the plugin, it is possible to use the g tag (I’m currently doing some discovery, but it will take a few weeks).
First of all, we need to define our goal.
What do we actually want to accomplish.
From my point of view the group (object) name change is part of the problem.
It can be solved by writing a plugin based on the already existing code in SweetHome3D export .obj without much change on your side of the code.
But, thinking further, I reckon we need to find a way to get an action by clicking (double clicking, hold, whatever) associated with the object one is clicking on. The object can be any object, a light, a TV, a camera etc.
Like I am doing now in the picture element floor plan.
You do get an action now by double clicking a group to get the group name.
Another possible issue (using g instead of o) is the position of the light source you are turning on.
I don’t know how you do that (didn’t have time to check the code) but when you select a group you actually select the top most group of the object and associate the light source with it. If there are groups (part of the same object) underneath the top group, the light source might be obscured.
Please let me know what you are thinking.
Cheers,
us
Hello uss, I do agree about setting goals.
Here what we are trying to achieve is the following:
Preserve the name of the objects across multiple export of the same models;
Still be able to bind objects to entities to visualize state or trigger actions
It will be impossible to achieve both without touching the OBJWriter class you pointed me to.
Sweethome3D is not natively exporting O tags and the G tags are built diregarding the pesistency of the names. As far as I could test, the O tag are not searchable by name in the Three.js library.
The light is not a problem, I create it by setting a point light at the center of the box containing the object. That is working in all contexts. Actions on objects can be achieved easily (I can do it by clicking on the object representing the light or by creating a new switch object that can be positioned somewhere else). What I propose is to redesign the OBJWriter (unfortunately we will loose forward compatibility): thanks to your help I’m getting some knowledge on the Plugin development. Not yet there but I’m definetly progressing
I also have a car object that is far more complex and it would balloon my card code. Is there a way to select a single object id and it hide any object nested in it / associated to it?
Unfortunately the Export to OBJ function in Sweethome3D does not group together the elements of an object. I’m checking how we can improve the export by building a specific Export to HASS plugin. See above discussion with uss. Not an easy one. You can always edit the obj file but it is a tedious activity…
I can suggest you a dirty workaround, waiting for a better solution.
In Sweethome3D put your car in a new model (only the car), click on Export to OBJ format.
Retrieve the file.obj. Open it in an advanced editor such as Visual Studio Code.
Then follow these steps:
In place of the first "g " tag put something like “g_your_car_name”
Cmd-F to open find.
Paste the string "g "
Alt-Enter to select all of the instances of the string on the page.
Cmd-L to broaden the selection to the entire line of each instance on the page.
Delete/Backspace to remove those lines.
change the first g line to “g your_car_name”
Save your file as car.obj and reimport it as furniture (from the menu, Furniture, Import Furniture) give it a new name and insert it into your catalog of objects.
Satrting from your car will be made of only one object when adding it to your home model.
Hmmm. I must have messed it up somehow because after having followed the instructions and importing back into SH3D the id’s have just been swapped by my new one followed by some numbers
It also changed some of the models colours. Going to have to revisit this one. Thanks though!
That is normal after the export of the full home containing your new car, the car gets renamed to something like your_car_name_1_1, but you now have only one object representing your car.
You just have to change your hide element to the object_id your_car_name_1_1…