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 604 times and has 1 reply Next Thread
avnerm
Newbie




Joined: Apr 26, 2018
Post Count: 4
Status: Offline
Reply to this Post  Reply with Quote 
How to set the material file name programatically

Hi,
I have a home 3d model with many walls.
I added a image file as texture to one of the walls and exported the model to obj format
I noticed that a new material was created in the .mtl file with the name wall_74_212.
I want to to add texture to every wall and set the wall name programatically, from a script which is external to sh3d.

My questions:
What is the indexing logic in the material name? (why the name wall_74_212 ?)
Is there a way to programatically set the material name?

Thanks,
Avner
[Apr 26, 2018, 8:06:30 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: 9141
Status: Offline
Reply to this Post  Reply with Quote 
Re: How to set the material file name programatically

You shouldn't rely on these numbers.
In current implementation, "74" means that it's the material of the 74th wall in your home, and "212" is the 212th shape being exported in the OBJ file. If ever you remove or simply change a wall, you might get different numbers.
If you want to set the texture by program on each wall, either you read a SH3D file, update its content and save it with Sweet Home 3D Java API, or you study SH3D file format to update such files with other programming languages (quickly said, a SH3D file is a ZIP file with a Home.xml entry that respects SweetHome3D.dtd + 3D models + images).
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Apr 26, 2018, 2:43:14 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 2006-2024 eTeks - All rights reserved