|
Sweet Home 3D Forum » List all forums » » Forum: Sweet Home 3D bar » » » Thread: Problem with optimisation |
|
| Print at Feb 28, 2026, 2:16:24 AM | View all posts in this thread on one page |
| Posted by Waldemar.Hersacher at Feb 22, 2026, 6:55:08 PM |
|
Problem with optimisation When creating a series of models I tried to optimise the number of used files. I created one mtl-file and several obj-files. the structure of the files is: doors.mtl Door1 (subfolder) Door1.obj Door2 (subfolder) Doors2.obj Each Door*.obj file is referencing the mtl-file with mtllib ../Doors.mtl . I created a furniture library. Placing the door in the plan the door consists of all material in the right colour and texture. Even modifying colours for some parts is working. But when saving the plan the mtl-file got lost. It will not be located directly in the root folder where I expected it to be. When loading the plan again all material is in default colour and any parts are not displayed in the Modify materials dialogue. ---------------------------------------- MSI GP60, Linux Mint 21.3 Virginia base: Ubuntu 22.04 jammy, SH3D 7.5 with Photo-video rendering 2.8 |
| Posted by Keet at Feb 22, 2026, 8:06:34 PM |
|
Re: Problem with optimisation As long as you load an individual .obj file, referring to a shared .mtl file will work. This is because both the .obj file and the correct .mtl are read during the import. Any other way will fail. The only optimization is a few less mtl files but there are better ways to do that. If your goal is to reduce the number of files then zip an .obj and a .mtl file and any texture images listed in the mtl file, then delete the .obj and .mtl file (and the textures if they are not needed for another file). You can import the .zip file just as you import an .obj file and you will only have a single file (the zip) on your drive. You can even select different .obj files and zip with the same .mtl file. Just wait with deleting the .mtl file until you created all zips using that mtl file. Keep the .mtl file in the same directory as the .obj file(s). Although specifying a path should work it often causes problems after wards, especially if there also texture images to load. You can further limit the number of files by creating a library and then zip all obj/mtl zips into a single zip file. Or simply delete them all since they are already in a .sh3f library file. If you open a .sh3f file with a zip program you can see that all obj and mtl files (and textures) are included in that zip (.sh3f) file. You can extract them from the library or export them after you added them to your 2D pane. I doubt that drive space is the problem, more likely that so many files become a mess and you loose overview. Solve that by working with a directory structure that organizes your files and delete unused or no longer needed files. ---------------------------------------- Dodecagon.nl 1300+ 3D models, manuals, and projects |
| Posted by Waldemar.Hersacher at Feb 23, 2026, 10:10:11 PM |
|
Re: Problem with optimisation My intention was when I need to change a material only to do that in one file. I can open the folder in VS Code and make a Replace in files. This will also be a one act replacement hopping that all materials have a unique colour. I know I can use regular expressions but I'm not a guru in that. Packing into a furniture library is standard. ---------------------------------------- MSI GP60, Linux Mint 21.3 Virginia base: Ubuntu 22.04 jammy, SH3D 7.5 with Photo-video rendering 2.8 |
| Posted by Keet at Feb 24, 2026, 8:20:32 AM |
|
Re: Problem with optimisation My intention was when I need to change a material only to do that in one file. While developing you can do that (as you did) with one mtl file that is used by multiple obj files. I am currently doing that with multiple LED numbers that all use the same mtl file: Ten object files LED0...LED9 and a single LED.mtl file. What happens when you add your obj file to a Sweet Home 3D project or a library file: Importing all object files stores all these in the Home.xml file of the Sweet Home 3D project. But it also creates a new mtl file for each obj file with the same name as the obj file: there is no longer a shared mtl file once imported. Exactly the same happens when you import in a library file: each obj file gets its own mtl file with the same name as the obj file. With a mtl file that is not in the same directory the same happens: after import each obj file has its own mtl file with the same name as the obj file stored in the project or library file (together in a single directory). If the importer can't find the referenced mtl file it creates a new mtl file for the obj file with a single material 'default'. That is likely what happened to your obj files. You can check that by opening the .sh3f library file with a zip program. It will list numbered directories that hold the objects stored in the library. Check these directories and the containing obj/mtl files and the contents of the mtl file will tell you if there are correct materials listed. It's the same for the Sweet Home 3D .sh3d project file. The one thing to remember is that once imported each obj file has its own mtl file. ---------------------------------------- Dodecagon.nl 1300+ 3D models, manuals, and projects |
| Posted by Waldemar.Hersacher at Feb 24, 2026, 8:17:16 PM |
|
Re: Problem with optimisation I'm coming from Windows and I'm not familiar with the bash file syntax. Otherwise I would have automated the process distributing the mtl-file to the folder where the obj files reside, pack the folders, the icons and the property files and copy the sh3f to the furniture folder of the SH3D. ---------------------------------------- MSI GP60, Linux Mint 21.3 Virginia base: Ubuntu 22.04 jammy, SH3D 7.5 with Photo-video rendering 2.8 |
| Posted by Keet at Feb 24, 2026, 9:00:25 PM |
|
Re: Problem with optimisation Windows has PowerShell scripts, almost as powerful as Bash scripts. Look it up. For basic functions like copy, move, etc it's pretty simple. A loop (iteration) is also not that difficult. If you use this type of actions often or you have a whole lot of objects to go through than it is worth the effort. I usually just create a little C# routine, basically the same, just another language. ---------------------------------------- Dodecagon.nl 1300+ 3D models, manuals, and projects |
| Posted by Waldemar.Hersacher at Feb 25, 2026, 8:06:38 PM |
|
Re: Problem with optimisation Doing it in C# would be easy for me because since 2011 I'm programming in C#. I'm stuck with VS 2008 because the device I'm responsible for is using Windows CE. But I didn't to start to setup a development system on Linux. ---------------------------------------- MSI GP60, Linux Mint 21.3 Virginia base: Ubuntu 22.04 jammy, SH3D 7.5 with Photo-video rendering 2.8 |
|
|
Current timezone is GMT Feb 28, 2026, 2:16:24 AM |