end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

FloorplanToBlender3d による住宅間取り図の 2D -> 3D変換

https://github.com/grebtsew/FloorplanToBlender3d

今回は、とりあえず、windows11のminiconda環境で gitcloneし、サンプルを2D -> 3D変換するまで

FloorplanToBlender3dの参考url

FloorplanToBlender3dのdocsにありますが、 FloorplanToBlender3dを用い、更に以下のurlも参考にしているようです

その他の参考url

git gitclone , pip install

(base) C:\Users\end0t\dev> git clone https://github.com/grebtsew/FloorplanToBlender3d.git

使用したminicondaに付属するpythonは ver.3.9 。

しかし、FloorplanToBlender3d に付属する requirements.txt で指定される opencv-python ver.4.2.0.34 を pip install できませんでしたので、 ver.4.4.0.46 にした上で pip install しています

(base) C:\Users\end0t\dev> python --version
Python 3.9.21

(base) C:\Users\end0t\dev> cd FloorplanToBlender3d

(base) C:\Users\end0t\dev\FloorplanToBlender3d> vi requirements.txt

opencv-python==4.4.0.46
#opencv-python==4.2.0.34 
numpy==1.22.0
configparser==3.5.0
future-fstrings==1.2.0
requests==2.25.1
pyfiglet==0.7
setuptools==54.1.0
scipy==1.5.4
pillow==9.0.1
matplotlib==3.5.1
black==22.1.0
pytest==7.0.1


(base) C:\Users\end0t\dev\FloorplanToBlender3d> pip install -r requirements.txt

main.py で setup & sample実行

付属する main.py を実行すると、Configs/default.ini の作成などを行った後、 Images/Examples/example.png の2D間取り図が Target/floorplan.blend の blender用 3Dに変換されます。

※変換対象のファイルは、Configs/default.ini 内で指定されています。

    ________                       __               __           ____  __               __         _____     __
   / ____/ /___  ____  _________  / /___ _____     / /_____     / __ )/ /__  ____  ____/ /__  ____|__  /____/ /
  / /_  / / __ \/ __ \/ ___/ __ \/ / __ `/ __ \   / __/ __ \   / __  / / _ \/ __ \/ __  / _ \/ ___//_ </ __  /
 / __/ / / /_/ / /_/ / /  / /_/ / / /_/ / / / /  / /_/ /_/ /  / /_/ / /  __/ / / / /_/ /  __/ /  ___/ / /_/ /
/_/   /_/\____/\____/_/  / .___/_/\__,_/_/ /_/   \__/\____/  /_____/_/\___/_/ /_/\__,_/\___/_/  /____/\__,_/
                        /_/

----- CREATE BLENDER PROJECT FROM FLOORPLAN WITH DIALOG -----
Welcome to this program. Please answer the questions below to progress.
Remember that you can change data more efficiently in the config file.

Please enter your blender installation path [default = C:\Program Files\Blender Foundation\Blender 4.4\blender.exe]:
Do you want to build from StackingFile or ConfigFile list ? [default = ConfigFile]:
Use default config or import from file paths separated by space [default = ./Configs/default.ini]:
Do you want to set images to use in each config file? [N/y]:

This program is about to run and create blender3d project, continue? :

Generate datafiles in folder: Data

Clean datafiles

Clear all cached data before run: [default = yes] :
 ----- Generate  Images/Examples/example.png  at pos  [0 0 0]  rot  [ 0  0 90]  scale  [1, 1, 1]  -----
Approximated apartment size :  431494.0
Created file : Data/0/floor_verts.txt
Created file : Data/0/floor_faces.txt
Walls created :  113
Created file : Data/0/wall_vertical_verts.txt
Created file : Data/0/wall_vertical_faces.txt
Created file : Data/0/wall_horizontal_verts.txt
Created file : Data/0/wall_horizontal_faces.txt
Number of rooms detected :  4
Created file : Data/0/room_verts.txt
Created file : Data/0/room_faces.txt
Windows created :  7
Created file : Data/0/window_vertical_verts.txt
Created file : Data/0/window_vertical_faces.txt
Created file : Data/0/window_horizontal_verts.txt
Created file : Data/0/window_horizontal_faces.txt
Doors created :  5
Created file : Data/0/door_vertical_verts.txt
Created file : Data/0/door_vertical_faces.txt
Created file : Data/0/door_horizontal_verts.txt
Created file : Data/0/door_horizontal_faces.txt
Created file : Data/0/transform.txt

Creates blender project

Project created at: C:\Users\end0t\dev\FloorplanToBlender3d/Target/floorplan.blend

Done, Have a nice day!

FloorplanToBlender3d Copyright (C) 2022  Daniel Westberg
This program comes with ABSOLUTELY NO WARRANTY;
This is free software, and you are welcome to redistribute it under certain conditions;