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: 3
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 4409 times and has 2 replies Next Thread
fparmenter
Newbie




Joined: Apr 22, 2017
Post Count: 1
Status: Offline
Reply to this Post  Reply with Quote 
Batch files for loading plans

Instead of using the graphics interface, does SweetHome 3D have a way of importing batch files? In other words, say I have a plan with 100 walls and I know the beginning and ending point of each wall and their thicknesses. Instead of using the graphics interface to draw all 100 walls I'd like it if SweetHome 3D could read a file like:

Object,X1,Y1,X2,Y2,Thickness
Wall,10.2",12.8",10.2",24.6",5"
Wall,24.1",22.0",20.0",24.6",5"
Wall,42.3",32.6",89.7",24.6",5"
.
.
.

and generate the plan for me. Does SweetHome 3D have anything like that?
[Apr 22, 2017, 9:30:20 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
okh
Advanced Member




Joined: May 12, 2013
Post Count: 1545
Status: Offline
Reply to this Post  Reply with Quote 
Re: Batch files for loading plans

..draw all 100 walls I'd like it if SweetHome 3D could read a file like...
Interesting question, nice idea. Short answer is, no, but ... thanks to SH3D .xml there are workarounds (for 100 walls, you may be better off doing it manually using CTRL-SHIFT-move with some template walls, though).

Long answer is, extract Home.xml from a simple .sh3d file and edit. The XML is nicely formatted and straightforward to read. For instance, a simple home with four walls (and corners) and one wall across, will have some introductory stuff and walls specified at the end:

...snip...
<wall id='wall0' wallAtStart='wall3' wallAtEnd='wall1' xStart='0.0' yStart='0.0' xEnd='1000.0' yEnd='0.0' height='240.0' thickness='30.0' pattern='hatchUp'/>
<wall id='wall1' wallAtStart='wall0' wallAtEnd='wall2' xStart='1000.0' yStart='0.0' xEnd='1000.0' yEnd='800.0' height='240.0' thickness='30.0' pattern='hatchUp'/>
<wall id='wall2' wallAtStart='wall1' wallAtEnd='wall3' xStart='1000.0' yStart='800.0' xEnd='0.0' yEnd='800.00006' height='240.0' thickness='30.0' pattern='hatchUp'/>
<wall id='wall3' wallAtStart='wall2' wallAtEnd='wall0' xStart='0.0' yStart='800.0' xEnd='0.0' yEnd='0.0' height='240.0' thickness='30.0' pattern='hatchUp'/>
<wall id='wall4' xStart='0.0' yStart='300.0' xEnd='1000.0' yEnd='300.0' height='220.0' thickness='10.0' pattern='hatchUp'/>
...snip...

If this XML does not look frightening, you will probably also know what to do to batch import (use cm!). To be more specific, for instance like this, step by step.:

  • Make a simple home with one wall in SH3D.
  • Save and compress.
  • Rename file to .zip.
  • Open .zip and extract Home.xml for editing.
  • Create a spreadsheet with . decimal separator.
  • Enter/paste the required values for each wall in A1 to I1
  • (convert units from imperial to metric)
  • Use =concatenate("<wall id='",A2,"' wallAtStart='",B2,"' wallAtEnd='",C2,"' xStart='",D2,"' yStart='",E2,"' xEnd='",F2,"' yEnd='",G2,"' height='",H2,"' thickness='",I2,"' pattern='hatchUp'/>")
  • Copy and add (paste) the result to add lines in Home.xml
  • .zip Home and rename yourfilename.sh3d
  • Open file with SH3D
This works (tried quick spreadsheet smile ), but getting hundreds of walls right (and possibly with rooms etc), will require some coffee.

ok
[Apr 23, 2017, 10:17:10 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: Batch files for loading plans

If you know Java, you could also try to program a plug-in that would read a file at the format you want, parse it and call Sweet Home 3D API to add the matching walls to the edited home.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Apr 24, 2017, 3:40:13 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