├── .gitignore
├── LICENSE
├── README.md
├── TODO.md
├── actions
└── AC20-FZK-Haus.json
├── buildings
└── .gitkeep
├── docs
├── actions.md
├── animations
│ ├── room_detect.gif
│ └── storey_animation.gif
├── images
│ ├── blender_activate_addon.png
│ ├── blender_install_addon.png
│ ├── blender_install_ifc.PNG
│ ├── blender_start_ifc_addon.png
│ ├── ifc_export_revit_1st_level.png
│ └── ifc_model_path.png
├── install.md
└── revit.md
├── ifc_blender
├── __init__.py
├── actions.py
├── blacklist.py
├── bpy_helper.py
├── cleanup.py
├── exporter.py
├── group.py
├── ifc_helper.py
├── ifc_to_json.py
├── importer.py
├── io.py
├── mesh.py
├── replace.py
└── visibility.py
├── out
└── .gitkeep
├── run.bat
└── run_blender.py
/.gitignore:
--------------------------------------------------------------------------------
1 | out/*.fbx
2 | out/*.blend
3 | out/*.blend1
4 | out/*.obj
5 | out/*.json
6 | out/*.mtl
7 | buildings/*.ifc
8 | buildings/*.blend
9 | buildings/*.blend1
10 |
11 | # Byte-compiled / optimized / DLL files
12 | __pycache__/
13 | *.py[cod]
14 | *$py.class
15 |
16 | # C extensions
17 | *.so
18 |
19 | # Distribution / packaging
20 | .Python
21 | build/
22 | develop-eggs/
23 | dist/
24 | downloads/
25 | eggs/
26 | .eggs/
27 | lib/
28 | lib64/
29 | parts/
30 | sdist/
31 | var/
32 | wheels/
33 | *.egg-info/
34 | .installed.cfg
35 | *.egg
36 | MANIFEST
37 |
38 | # PyInstaller
39 | # Usually these files are written by a python script from a template
40 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
41 | *.manifest
42 | *.spec
43 |
44 | # Installer logs
45 | pip-log.txt
46 | pip-delete-this-directory.txt
47 |
48 | # Unit test / coverage reports
49 | htmlcov/
50 | .tox/
51 | .coverage
52 | .coverage.*
53 | .cache
54 | nosetests.xml
55 | coverage.xml
56 | *.cover
57 | .hypothesis/
58 | .pytest_cache/
59 |
60 | # Translations
61 | *.mo
62 | *.pot
63 |
64 | # Django stuff:
65 | *.log
66 | local_settings.py
67 | db.sqlite3
68 |
69 | # Flask stuff:
70 | instance/
71 | .webassets-cache
72 |
73 | # Scrapy stuff:
74 | .scrapy
75 |
76 | # Sphinx documentation
77 | docs/_build/
78 |
79 | # PyBuilder
80 | target/
81 |
82 | # Jupyter Notebook
83 | .ipynb_checkpoints
84 |
85 | # pyenv
86 | .python-version
87 |
88 | # celery beat schedule file
89 | celerybeat-schedule
90 |
91 | # SageMath parsed files
92 | *.sage.py
93 |
94 | # Environments
95 | .env
96 | .venv
97 | env/
98 | venv/
99 | ENV/
100 | env.bak/
101 | venv.bak/
102 |
103 | # Spyder project settings
104 | .spyderproject
105 | .spyproject
106 |
107 | # Rope project settings
108 | .ropeproject
109 |
110 | # mkdocs documentation
111 | /site
112 |
113 | # mypy
114 | .mypy_cache/
115 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright 2018 Andreas Bresser
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # IFC-Blender
2 | import and manipulate an IFC in Blender based on IFCOpenShell
3 |
4 | A workflow could look like this:
5 | 1. You create some building in Revit (or get it from an architect).
6 | 1. You export your Model to IFC
7 | 1. You use IFC-Blender to import the model to Blender and do something with it (e.g. split by storey and export to FBX, so you have multiple files for each storey). See [actions.md](https://github.com/brean/ifc_blender/blob/master/docs/actions.md) for a list of all possible actions that you can use to manipulate the imported IFC in Blender. Also a small JSON-file will be generated storing infromation from the IFC (like storeys, rooms, ... - using [Python-IFC-Model](https://github.com/brean/python-ifc-model).
8 | 1. You use the FBX in a 3D-Engine like Unity to display the building. You can then add some logic to animate the building or just show it in VR/AR.
9 | 1. If you like to show specific data from the IFC or find single elements to highlight in your app you can simply load the JSON file and map the names of the objects in the fbx/obj with the data from the JSON-file.
10 |
11 | You can also combine this with other blender functionality, e.g. to animate single IFC types (like storeys):
12 |
13 | 
14 |
15 | Or use it in the browser, for example using [https://threejs.org/](three.js) to figure out which room an element is placed at. (In this web application for example we use the IfcSpace information from the JSON file to detect in which room our air condition is dragged - see room number in the up-right corner when the object is moved).
16 |
17 | 
18 |
19 | # Installation
20 | see [install](docs/install.md)
21 |
22 | # Export from Autodesk Revit
23 | see [revit](docs/revit.md)
24 |
25 | # Running the example
26 | There is an example json-file that creates separated .blend files for all storeys, based on the ["FZK Haus" from the IFC Wiki](http://www.ifcwiki.org/index.php?title=KIT_IFC_Examples)
27 | Just download this file, save it to the buildings/-folder and execute "run.bat".
28 |
29 | # JSON configuration
30 | What happens in Blender to the imported IFC can be configured in a JSON-file. When executing "run_blender.py" (e.g. by executing "run.bat") it will iterate over all files in actions/ and load all JSON-files saved there.
31 |
32 | An overview of all possible actions can be seen in [actions.md](docs/actions.md)
33 |
--------------------------------------------------------------------------------
/TODO.md:
--------------------------------------------------------------------------------
1 | # TODO
2 | - create easy-installer for Blender 3D
3 | - create a more complex example
4 | - more documentation
5 |
--------------------------------------------------------------------------------
/actions/AC20-FZK-Haus.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "load_ifc",
4 | "save": "out/AC20-FZK-Haus.json",
5 | "ifc_file": "buildings/AC20-FZK-Haus.ifc"
6 | },
7 | {
8 | "name": "mesh_remove",
9 | "mesh_name": "Cube",
10 | "description": "remove starting Cube"
11 | },
12 | {
13 | "name": "import",
14 | "description": "import ifc to blender",
15 | "ifc_file": "buildings/AC20-FZK-Haus.ifc"
16 | },
17 | {
18 | "name": "remove_site",
19 | "description": "remove base plate"
20 | },
21 | {
22 | "name": "create_group",
23 | "ifc_type": "storey",
24 | "description": "create groups for each single storey"
25 | },
26 | {
27 | "name": "create_group",
28 | "ifc_type": "space",
29 | "description": "create groups for each single storey"
30 | },
31 | {
32 | "name": "add_group",
33 | "ifc_type_group": "storey",
34 | "ifc_children": "spaces"
35 | },
36 | {
37 | "name": "group_by_elevation"
38 | },
39 | {
40 | "name": "save",
41 | "description": "save blend file",
42 | "filepath": "out/AC20-FZK-Haus"
43 | },
44 | {
45 | "name": "export",
46 | "filepath": "out/AC20-FZK-Haus",
47 | "filetype": ["obj", "fbx"]
48 | },
49 | {
50 | "name": "group_split",
51 | "description": "split into multiple groups",
52 | "ifc_type": "storey",
53 | "outpath": "out",
54 | "blend_file": "out/AC20-FZK-Haus",
55 | "export": ["obj", "fbx"]
56 | }
57 | ]
58 |
--------------------------------------------------------------------------------
/buildings/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brean/python-ifc-blender/f8382ad7f03235c58d2e327afff1aa8e5bda0ac3/buildings/.gitkeep
--------------------------------------------------------------------------------
/docs/actions.md:
--------------------------------------------------------------------------------
1 | # JSON-configuration
2 |
3 | |JSON|description|
4 | |---|---|
5 | |"name": "**load_ifc**",
"save": "out/AC20-FZK-Haus.json",
"ifc_file": "buildings/AC20-FZK-Haus.ifc"|loads an *ifc_file* and create its JSON-representation in the *save* location|
6 | |"name": **"mesh_remove"**,
"mesh_name": "Cube"|Blender helper-function to remove the mesh with *mesh_name*. Useful to remove the starting cube|
7 | |"name": **"import"**,
"ifc_file": "buildings/AC20-FZK-Haus.ifc"|Imports an IFC-file into blender using IfcOpenShell|
8 | |"name": "**load**",
"filepath": "buildings/AC20-FZK-Haus.blend"|load a .blend file that has been imported using IfcOpenShell (useful when the import takes long and you like to import manually on another machine)|
9 | |"name": **"show"**,
"ifc_type": "space"|sets all objects with the given IFC-type to visible (in this case all IfcSpaces)|
10 | |"name": **"remove_site"**|removes the mesh for the IfcSite|
11 | |"name": **"blacklist"**,
"ifc_type": "IfcBuildingElementProxy",
"regex": "ABZUGSK.*"|removes all objects of type *ifc_type* ("IfcBuildingElementProxy") with the name matching the *regex* (everything starting with "ABZUGSK")|
12 | |"name": **"remove_hidden"**|removes all invisible/disabled elements (you might to use this after "show")|
13 | |"name": **"replace"**,
"copy_dimensions": false,
,"regex": "Chair.*",
"blend_file": "lowpoly/simple_chair,
"ifc_type": "IfcFurnishingElement",
"object_name": "chair"|replaces every object with the type *ifc_type* that matches the given regex (starts with *Chair*) with the object *object_name* (chair) from the Blender file *blend_file*. Useful to replace elements from the IFC file with other elements that have a lower or higher level of detail. Either to enhance for VR-Environments or to lower the poly count on mobile devices|
14 | |"name": **"create_group"**,
"ifc_type": "storey"|creates a new group based on the *ifc_type*. Useful to create groups that can be exported later on in single .blend files and exported as single FBX/OBJ|
15 | |"name": **"add_group"**,
"ifc_type_group": "storey",
"ifc_children":"spaces"|add aditional objects to a group that has been created with *add_group*. In this example all spaces of a storey will also be added to their storey-group|
16 | |"name": **"group_children_by_regex"**,
"ifc_target_groups": "storey",
"target_regex": ".* (?P-?[0-9]\\d*)",
"source_regex": ".*\\.(?P-?[0-9]\\d*)\\..*",|add all elements of the group that matches the *source_regex* to the *ifc_target_group* type matching the *target_regex* regex|
17 | |"name": **"group_unlink"**,
"regex": "*^GROUP.*"|removes all objects from a group where the name mathes the *regex*|
18 | |"name": **"mesh_reposition"**,
"regex": "*^GROUP.*"|recalculate the vertice center position of all objects matching the group name. Useful in combination with *group_by_elevation*|
19 | |"name": **"group_by_elevation"**|add all elements to the group for their story. (reads story-height from IFC)|
20 | |"name": **"mesh_split"**,
"regex": "*^LOGO.*"
"split_z": 1.2|cuts the object in two objects, after given *split_z* value (in meters)|
21 | |"name": **"export"**,
"filepath": "out/House"
"filetype": ["obj", "fbx"]|export the building (in this case as fbx which works quite well in Unity3D and obj which is great for WebGL/THREE.js)|
22 | |"name": **"save"**,
"filepath": "out/House"|save as .blend file|
23 | |"name": **"group_split"**,
"ifc_type": "storey",
"outpath": "out",
"blend_file": "out/House",
"export": ["obj", "fbx"]|loads the given blend-file for every entry in the "ifc_type" (e.g. each storey) delete everything else and export it. Useful to get single files for each storey. **WARNING** because this needs to load the .blend-file make sure you save the building with *save* and do this as the last step!|
24 |
--------------------------------------------------------------------------------
/docs/animations/room_detect.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brean/python-ifc-blender/f8382ad7f03235c58d2e327afff1aa8e5bda0ac3/docs/animations/room_detect.gif
--------------------------------------------------------------------------------
/docs/animations/storey_animation.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brean/python-ifc-blender/f8382ad7f03235c58d2e327afff1aa8e5bda0ac3/docs/animations/storey_animation.gif
--------------------------------------------------------------------------------
/docs/images/blender_activate_addon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brean/python-ifc-blender/f8382ad7f03235c58d2e327afff1aa8e5bda0ac3/docs/images/blender_activate_addon.png
--------------------------------------------------------------------------------
/docs/images/blender_install_addon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brean/python-ifc-blender/f8382ad7f03235c58d2e327afff1aa8e5bda0ac3/docs/images/blender_install_addon.png
--------------------------------------------------------------------------------
/docs/images/blender_install_ifc.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brean/python-ifc-blender/f8382ad7f03235c58d2e327afff1aa8e5bda0ac3/docs/images/blender_install_ifc.PNG
--------------------------------------------------------------------------------
/docs/images/blender_start_ifc_addon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brean/python-ifc-blender/f8382ad7f03235c58d2e327afff1aa8e5bda0ac3/docs/images/blender_start_ifc_addon.png
--------------------------------------------------------------------------------
/docs/images/ifc_export_revit_1st_level.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brean/python-ifc-blender/f8382ad7f03235c58d2e327afff1aa8e5bda0ac3/docs/images/ifc_export_revit_1st_level.png
--------------------------------------------------------------------------------
/docs/images/ifc_model_path.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brean/python-ifc-blender/f8382ad7f03235c58d2e327afff1aa8e5bda0ac3/docs/images/ifc_model_path.png
--------------------------------------------------------------------------------
/docs/install.md:
--------------------------------------------------------------------------------
1 | # Installation
2 | ### Install Blender IFC Add-On
3 | 1. Install Blender using the graphical installer from [the Blender download page](https://www.blender.org/download/)
4 | 1. Download IFCOpenShell from [The IFCOpenShell download page](http://ifcopenshell.org/)
5 | Make sure you have the right version. For your Blender Version, the 0.5.0 preview 2 works fine with Blender 2.79. 
6 | 1. Start Blender and press CTRL-ALT-U to open the User Settings
7 | 1. click on "Add-ons" and then the "Install Add-on from File..." button
8 | .
9 | 1. Select the downloaded IfcOpenShell-zip file and import it.
10 | 1. Now the Import-Export IfcBlender-Add-On should be available. If you search for "ifc" you should see it. Activate it by clicking on the checkbox to the left of its entry:
11 | .
12 | 1. (optional) if you like to load the Add-on every time Blender starts click the "Save User Settings"-button.
13 | 1. Close the "User Preferences" window and make sure the installation was successful. Under "File" -> "Import" you should see "Industry Foundation Classes (.ifc)"
14 | .
15 | 1. Make sure to remove everything (cameras, lights, other meshes, ...) before you import a building! Just press `a` in 'Object Mode' to select everything (you might need to press it twice if there is something selected) and `x` and confirm by clicking on `Delete X`.
16 |
17 | ### Install IfcBlender
18 | 1. Quit Blender if it is running
19 | 1. Download/Checkout [python-ifc-model](https://github.com/brean/python-ifc-model)
20 | 1. Download [IfcOpenShell for python](http://www.ifcopenshell.org/python.html) for your blender version (for Blender 2.79 you can use "IfcOpenShell-python for python 3.5 64bit Windows")
21 | 1. Extract the downloaded files and copy the folders `ifc_model/ifc_model` (the sub-folder) and `ifcopenshell` to `\\python\lib`
22 | 
23 |
24 | (TODO: installing this as Blender Add-On from the UI would be nice...)
25 |
--------------------------------------------------------------------------------
/docs/revit.md:
--------------------------------------------------------------------------------
1 | # Information for Autodesk Revit
2 |
3 | It is the easiest when we export the 3D-representation of spaces (space boundaries), so we can use them as objects in Blender.
4 |
5 | When you like to import your Revit model you should select "1st level" in Revit when exporting:
6 |
7 | 
8 |
--------------------------------------------------------------------------------
/ifc_blender/__init__.py:
--------------------------------------------------------------------------------
1 | __all__ = ['ifc_helper', 'actions']
2 |
--------------------------------------------------------------------------------
/ifc_blender/actions.py:
--------------------------------------------------------------------------------
1 | '''
2 | load actions from config files
3 | '''
4 | import os
5 | import logging
6 | import glob
7 | import json
8 | import logging
9 | import bpy
10 |
11 | from . import ifc_to_json
12 | from . import cleanup
13 | from . import blacklist
14 | from . import group
15 | from . import visibility
16 | from . import io
17 | from . import mesh
18 | from . import replace
19 | from . import exporter
20 | from . import importer
21 |
22 | actions = {
23 | 'remove_site': cleanup.remove_site,
24 | 'blacklist': blacklist.remove,
25 | 'remove_hidden': cleanup.remove_hidden,
26 | 'create_group': group.create,
27 | 'show': visibility.show_hidden,
28 | 'save': io.save,
29 | 'load': io.load,
30 | 'add_group': group.add,
31 | 'create_group': group.create,
32 | 'group_split': group.split,
33 | 'group_children_by_regex': group.children_by_regex,
34 | 'group_by_regex': group.by_regex,
35 | 'group_by_elevation': group.by_elevation,
36 | 'replace': replace.replace,
37 | 'export': exporter.export,
38 | 'import': importer.run_import,
39 | 'load_ifc': ifc_to_json.load_ifc,
40 | 'group_unlink': group.unlink,
41 | 'mesh_split': mesh.split,
42 | 'mesh_remove': mesh.remove,
43 | 'mesh_reposition': mesh.reposition
44 | }
45 |
46 |
47 | def execute_action(data, project):
48 | name = data['name']
49 | if not name in actions:
50 | logging.warn('can not find action {}'.format(name))
51 | return
52 |
53 | description = ': {}'.format(data['description']) if 'description' in data else ''
54 | logging.info('execute action {}{}'.format(name, description))
55 |
56 | data['project'] = project
57 | return actions[name](**data)
58 |
59 |
60 | def load(path):
61 | project = None
62 | for filename in glob.glob(os.path.join(path, '*.json')):
63 | logging.info('loading {}'.format(filename))
64 | with open(filename) as json_file:
65 | for action in json.load(json_file):
66 | p = execute_action(action, project)
67 | if p:
68 | project = p
69 |
--------------------------------------------------------------------------------
/ifc_blender/blacklist.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | import re
3 | import logging
4 | from . import bpy_helper
5 | from .ifc_helper import elements_by_type
6 |
7 | '''
8 | check if this element matches the given ifc_type and regex
9 | use empty ifc_type to get all elements
10 | '''
11 | def blacklisted(obj, ifc_type=None, regex=None):
12 | if ifc_type and obj.ifc_type != ifc_type:
13 | return False
14 | return not regex or re.match(regex, obj.name) != None
15 |
16 |
17 | def remove(project, ifc_type=None, regex=None, **kwargs):
18 | i = 0
19 | objects = []
20 | if ifc_type:
21 | products = elements_by_type(project, 'product')
22 | for product in products:
23 | obj = bpy_helper.find_object(product)
24 | if obj:
25 | objects.append(obj)
26 | #else:
27 | # logging.warn('can not find ' + product.name)
28 | # product not in blend-file... (ignored)
29 |
30 | else:
31 | objects = bpy.data.objects
32 |
33 | for obj in objects:
34 | if blacklisted(obj, ifc_type, regex):
35 | i += 1
36 | # logging.warn('{}: remove blacklisted: {}'.format(i, obj.name))
37 | bpy.data.objects.remove(obj, True)
38 | logging.info("removed {} blacklisted objects".format(i))
39 |
--------------------------------------------------------------------------------
/ifc_blender/bpy_helper.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | import re
3 |
4 | '''
5 | find blender object (by name or mesh id)
6 | '''
7 | def find_object(product):
8 | blend_prod = bpy.data.objects.get(product.name)
9 | if blend_prod:
10 | return blend_prod
11 |
12 | # can not find the product by id
13 | # (probably because it is longer than 64 chars, try the mesh name)
14 | if hasattr(product, 'representations'):
15 | for obj in bpy.data.objects:
16 | if obj.type != 'MESH':
17 | continue
18 | for rep in product.representations:
19 | if obj.data.name == 'mesh'+str(rep.id):
20 | return obj
21 |
22 | # last option - maybe this is an "umlaut-fail"
23 | for obj in bpy.data.objects:
24 | m = re.match('.*\:(?P\d{3,9})[\:\d]*$', obj.name)
25 | if not m:
26 | continue
27 | name = m.group('name')
28 | if product.name.endswith(':{}'.format(name)):
29 | assert not product.name+'.001' in bpy.data.objects
30 | return obj
31 |
--------------------------------------------------------------------------------
/ifc_blender/cleanup.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | import logging
3 | from . import bpy_helper
4 |
5 | '''
6 | remove not selected objects
7 | '''
8 | def remove_hidden(project, **kwargs):
9 | i = 0
10 | for obj in bpy.data.objects:
11 | if obj.hide:
12 | i+=1
13 | # logging.warn('{}: remove invisible: {}'.format(i, obj.name))
14 | bpy.data.objects.remove(obj, True)
15 | logging.info("removed {} invisible objects".format(i))
16 |
17 | '''
18 | remove other sites, we just want the building
19 | '''
20 | def remove_site(project, **kwargs):
21 | i = 0
22 | for site in project.sites:
23 | obj = bpy_helper.find_object(site)
24 | if obj:
25 | i += 1
26 | logging.warn('{}: remove site: {}'.format(i, obj.name))
27 | bpy.data.objects.remove(obj, True)
28 |
--------------------------------------------------------------------------------
/ifc_blender/exporter.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | import logging
3 | from . import io
4 |
5 | # string checking for python 2 and 3
6 | try:
7 | isinstance("", basestring)
8 | def isstr(s):
9 | return isinstance(s, basestring)
10 | except NameError:
11 | def isstr(s):
12 | return isinstance(s, str)
13 |
14 | def export(project, filepath, filetype, **kwargs):
15 | if isstr(filetype):
16 | filetype = [filetype]
17 | for exp_type in filetype:
18 | _path = filepath
19 | if not _path.endswith('.'+exp_type):
20 | _path += '.'+exp_type
21 | if exp_type == 'obj':
22 | logging.info('export as obj to {}'.format(_path))
23 | bpy.ops.export_scene.obj(filepath=_path)
24 | elif exp_type == 'fbx':
25 | logging.info('export as fbx to {}'.format(_path))
26 | bpy.ops.export_scene.fbx(filepath=_path)
27 |
--------------------------------------------------------------------------------
/ifc_blender/group.py:
--------------------------------------------------------------------------------
1 | import os
2 | import re
3 | import bpy
4 | import logging
5 | import json
6 | from . import bpy_helper
7 | from . import ifc_helper
8 | from . import io
9 | from . import exporter
10 |
11 | def create(project, ifc_type=None, group_name='', prefix='', **kwargs):
12 | i = 0
13 |
14 | if ifc_type:
15 | for elem in ifc_helper.elements_by_type(project, ifc_type):
16 | i += 1
17 | grp_name = prefix + elem.name
18 | logging.info('{}: create group {}'.format(i, grp_name))
19 | grp = bpy.data.groups.new(grp_name)
20 | else:
21 | grp_name = prefix + group_name
22 | logging.info('{}: create group {}'.format(i, grp_name))
23 | grp = bpy.data.groups.new(grp_name)
24 |
25 | def children_by_regex(project, ifc_target_groups, source_regex, target_regex,
26 | force_int=False, source_prefix='', prefix='', **kwargs):
27 | i = 0
28 | # get all storeys
29 | target_names = {}
30 | for group in ifc_helper.elements_by_type(project, ifc_target_groups):
31 | m = re.match(target_regex, group.name)
32 | if m:
33 | name = m.group('name')
34 | if force_int:
35 | name = int(name)
36 | target_names[name] = prefix+group.name
37 |
38 | # find blender groups that are not assigned to the target
39 | for source_group in bpy.data.groups:
40 | source_name = source_group.name
41 | m = re.match(source_regex, source_name)
42 | if m:
43 | group_nr = m.group('name')
44 | if force_int:
45 | group_nr = int(group_nr)
46 | target_name = target_names[group_nr]
47 | logging.info('assign all elements of group {} to {}'.format(
48 | source_name, target_name
49 | ))
50 | for obj in bpy.data.groups[source_name].objects:
51 | if not obj.name in bpy.data.groups[target_name].objects:
52 | bpy.data.groups[target_name].objects.link(obj)
53 | i += 1
54 | #logging.info('assign {} to {}'.format(
55 | # obj.name, target_name
56 | #))
57 | logging.info("assigned {} objects to group {}".format(i, target_name))
58 |
59 |
60 | def _by_elevation(building, prefix=''):
61 | min_elevation = -20
62 | max_elevation = 1000
63 | elevations = {}
64 | for storey in building.storeys:
65 | elevations[storey.name] = [storey.elevation, 0]
66 | # calculate min and max for elevation
67 | ele = [e[0] for e in elevations.values()] + [max_elevation]
68 | for elevation in elevations.values():
69 | elevation[1] = min([e for e in ele if e > elevation[0]])
70 | min([x for x in elevations.values()])[0] = min_elevation
71 | logging.info("elevations: " + json.dumps(elevations, indent=2))
72 | i = 0
73 | for obj in bpy.data.objects:
74 | num_groups = sum([obj.name in g.objects for g in bpy.data.groups])
75 | if num_groups == 0:
76 | if obj.type != 'MESH':
77 | continue
78 | if not obj.data.vertices:
79 | continue
80 | vcos = [ obj.matrix_world * v.co for v in obj.data.vertices ]
81 | findCenter = lambda l: ( max(l) + min(l) ) / 2
82 |
83 | x,y,z = [ [ v[i] for v in vcos ] for i in range(3) ]
84 | center = [ findCenter(axis) for axis in [x,y,z] ]
85 |
86 | z = center[2]
87 | grp_name = [n for n, e in elevations.items() if e[0] <= z < e[1]]
88 | if grp_name:
89 | grp_name = prefix + grp_name[0]
90 | # logging.info('assign {} to {} - {}'.format(
91 | # obj.name, grp_name, z
92 | # ))
93 | bpy.data.groups[grp_name].objects.link(obj)
94 | i += 1
95 | logging.info("assigned {} objects to group by elevation".format(i))
96 |
97 |
98 |
99 | def by_elevation(project, prefix='', **kwargs):
100 | for site in project.sites:
101 | for building in site.buildings:
102 | _by_elevation(building, prefix)
103 |
104 |
105 | def by_regex(project, ifc_type_group, group_name, regex, **kwargs):
106 | i = 0
107 | for elem in ifc_helper.elements_by_type(project, ifc_type_group):
108 | m = re.search(regex, elem.name)
109 | if not m:
110 | continue
111 | obj = bpy_helper.find_object(elem)
112 | print(obj)
113 | print(elem.name)
114 | if not obj.name in bpy.data.groups[group_name].objects:
115 | bpy.data.groups[group_name].objects.link(obj)
116 | i += 1
117 | #logging.info('assign {} to {}'.format(
118 | # obj.name, group_name
119 | #))
120 | logging.info("assigned {} objects to group {}".format(i, group_name))
121 |
122 |
123 | def unlink(project, regex, **kwargs):
124 | i = 0
125 | for obj in bpy.data.objects:
126 | m = re.match(regex, obj.name)
127 | if not m:
128 | continue
129 | for grp in obj.users_group:
130 | grp.objects.unlink(obj)
131 | i += 1
132 | logging.info("unlinked {} objects from groups, {} '{}'".format(i, len(bpy.data.objects), regex))
133 |
134 |
135 | def add(project, ifc_type_group, prefix='', ifc_children=None, **kwargs):
136 | # get group
137 | for group in ifc_helper.elements_by_type(project, ifc_type_group):
138 | i = 0
139 | j = 0
140 | grp_name = prefix + group.name
141 | # assign self to group
142 | if not ifc_children:
143 | continue
144 | # assign item to group
145 | for elem in getattr(group, ifc_children):
146 | i += 1
147 | obj = bpy_helper.find_object(elem)
148 | if not obj:
149 | # logging.error('can not assign {} to group {}'.format(elem.name, grp_name))
150 | j += 1
151 | continue
152 | if obj.name in bpy.data.groups[grp_name].objects:
153 | logging.warn('DUPLICATE: object {} already in group {}'.format(elem.name, grp_name))
154 | continue
155 | # logging.info('{}: link {} to group {}'.format(i, elem.name, grp_name))
156 | bpy.data.groups[grp_name].objects.link(obj)
157 | logging.info("linked {} objects to group {}".format(i, grp_name))
158 | if j:
159 | logging.warn("could not assign {} objects to group {}".format(j, grp_name))
160 | # get all products
161 | #for elem in ifc_helper.elements_by_type(project, ifc_type_group):
162 | # # find out which room/storey they are assigned to
163 |
164 | #for item in ifc_helper.elements_by_type(project, ifc_type):
165 | # ifc_helper.elements_by_type(project, 'product')
166 |
167 |
168 | """
169 | split into multiple .blend-files based on blender groups and ifc_type
170 | """
171 | def split(project, ifc_type, outpath, blend_file, export=None, **kwargs):
172 |
173 | elements = ifc_helper.elements_by_type(project, ifc_type)
174 | for elem in elements:
175 | i = 0
176 | io.load(blend_file)
177 | logging.info('delete all but {}'.format(elem.name))
178 | for other in elements:
179 | if other == elem:
180 | continue
181 | # remove all other groups
182 | for obj in bpy.data.groups[other.name].objects:
183 | # logging.info('delete {} from group {}'.format(obj.name, other.name))
184 | i += 1
185 | bpy.data.objects.remove(obj, True)
186 | logging.info('delete {} objects from group {}, kept {}'.format(i, elem.name, len(bpy.data.objects)))
187 | filepath = os.path.join(outpath, elem.name)
188 | io.save(filepath)
189 | if export:
190 | exporter.export(project, filepath, export)
191 |
--------------------------------------------------------------------------------
/ifc_blender/ifc_helper.py:
--------------------------------------------------------------------------------
1 | import itertools
2 |
3 | def flatten(lst):
4 | return list(itertools.chain.from_iterable(lst))
5 |
6 | def elements_by_type(project, ifc_type):
7 | if ifc_type == 'project':
8 | return project
9 | elif ifc_type == 'site':
10 | return [s for s in project.sites]
11 | elif ifc_type == 'building':
12 | buildings = flatten([s.buildings for s in project.sites])
13 | return buildings
14 | elif ifc_type == 'storey':
15 | buildings = flatten([s.buildings for s in project.sites])
16 | storeys = flatten([b.storeys for b in buildings])
17 | return storeys
18 | elif ifc_type == 'space':
19 | buildings = flatten([s.buildings for s in project.sites])
20 | storeys = flatten([b.storeys for b in buildings])
21 | spaces = flatten([s.spaces for s in storeys])
22 | return spaces
23 | elif ifc_type == 'product':
24 | buildings = flatten([s.buildings for s in project.sites])
25 | storeys = flatten([b.storeys for b in buildings])
26 | spaces = flatten([s.spaces for s in storeys])
27 | products = []
28 | products += flatten([s.products for s in storeys])
29 | products += flatten([s.products for s in spaces])
30 | return products
31 |
--------------------------------------------------------------------------------
/ifc_blender/ifc_to_json.py:
--------------------------------------------------------------------------------
1 | """
2 | create temp-file
3 | (needs to be called before you can run any action)
4 | """
5 | import logging
6 | import tempfile
7 | import json
8 | import os
9 | from ifc_model.project import Project
10 |
11 | def dump(ifc_file, filename=None):
12 | if not filename:
13 | tmp_fd, filename = tempfile.mkstemp(prefix='ifc_exchange_', suffix='.json')
14 | os.close(tmp_fd)
15 | logging.info('store json to: {}'.format(filename))
16 | project = Project()
17 | project.open_ifc(ifc_file)
18 | data = project.to_json()
19 | json.dump(
20 | project.to_json(),
21 | open(filename, 'w'),
22 | indent=2,
23 | sort_keys=True
24 | )
25 | return project, filename
26 |
27 | def load_ifc(ifc_file, save=None, **kwargs):
28 | project, json_file = dump(ifc_file, save)
29 | if not save:
30 | os.remove(json_file)
31 | return project
32 |
--------------------------------------------------------------------------------
/ifc_blender/importer.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | import logging
3 | import os
4 |
5 | def run_import(project, ifc_file, **kwargs):
6 | if not os.path.exists(ifc_file):
7 | logging.error('file not found {}'.format(ifc_file))
8 | bpy.ops.import_scene.ifc(filepath=ifc_file)
9 |
--------------------------------------------------------------------------------
/ifc_blender/io.py:
--------------------------------------------------------------------------------
1 | """
2 | save blend file
3 | """
4 | import logging
5 | import bpy
6 |
7 | def save(filepath, **kwargs):
8 | logging.info('save as {}'.format(filepath))
9 | bpy.ops.wm.save_as_mainfile(filepath=filepath + '.blend')
10 |
11 | def load(filepath, **kwargs):
12 | logging.info('load {}'.format(filepath))
13 | bpy.ops.wm.open_mainfile(filepath=filepath + '.blend')
14 |
--------------------------------------------------------------------------------
/ifc_blender/mesh.py:
--------------------------------------------------------------------------------
1 | import re
2 | import bpy
3 | import bmesh
4 | import logging
5 | from mathutils import Vector
6 |
7 | """
8 | split mesh into different objects
9 | """
10 | def split(regex, split_z, **kwargs):
11 | for obj in bpy.data.objects:
12 | m = re.match(regex, obj.name)
13 | if not m:
14 | continue
15 | for ob in bpy.data.objects:
16 | ob.select = False
17 | bpy.context.scene.objects.active = obj
18 | bpy.ops.object.mode_set(mode='EDIT')
19 | dmesh = obj.data
20 | mesh = bmesh.from_edit_mesh(dmesh)
21 | for f in mesh.faces:
22 | f.select = f.calc_center_median().z > split_z
23 | bpy.ops.mesh.separate(type='SELECTED')
24 | bmesh.update_edit_mesh(dmesh)
25 | dmesh.update()
26 | bpy.ops.object.mode_set(mode='OBJECT')
27 |
28 | """
29 | remove mesh (e.g. starting cube)
30 | """
31 | def remove(mesh_name, **kwargs):
32 | for ob in bpy.context.scene.objects:
33 | ob.select = ob.type == 'MESH' and ob.name.startswith(mesh_name)
34 | bpy.ops.object.delete()
35 |
36 | """
37 | reposition by median
38 | """
39 | def reposition(regex, **kwargs):
40 | for obj in bpy.data.objects:
41 | m = re.match(regex, obj.name)
42 | if not m:
43 | continue
44 | me = obj.data
45 | verts = [v.co for v in me.vertices]
46 | pivot = sum(verts, Vector()) / len(verts)
47 | for v in me.vertices:
48 | v.co.z -= pivot.z
49 | obj.location.z = pivot.z
50 |
--------------------------------------------------------------------------------
/ifc_blender/replace.py:
--------------------------------------------------------------------------------
1 | import logging
2 | import bpy
3 | from . import bpy_helper
4 | from .ifc_helper import elements_by_type
5 | from .blacklist import blacklisted
6 |
7 | '''
8 | append object from other blender file
9 | '''
10 | def append_object(blend_file, object_name, section='/Object/'):
11 | blend_file = blend_file + '.blend'
12 | filepath = blend_file + section + object_name
13 | directory = blend_file + section
14 | filename = object_name
15 |
16 | state = bpy.ops.wm.append(
17 | filepath=filepath,
18 | filename=filename,
19 | directory=directory)
20 |
21 | obj = bpy.data.objects.get(object_name)
22 | return obj
23 |
24 | '''
25 | replace object with another object in blender (after append)
26 | and get its name/data
27 | '''
28 | def replace_object(obj, other, copy_dimensions=False):
29 | logging.warn('replace {} with {}'.format(obj.name, other.name))
30 | other.location = obj.location
31 | if copy_dimensions:
32 | other.dimensions = obj.dimensions
33 | name = obj.name
34 | mesh_name = obj.data.name
35 | obj.name = 'del_'+obj.name
36 | obj.data.name = 'del_'+obj.data.name
37 | bpy.data.objects.remove(obj, True)
38 | other.name = name
39 | other.data.name = mesh_name
40 |
41 | def replace(project, blend_file, object_name, ifc_type, regex=None, copy_dimensions=False, **kwargs):
42 | products = elements_by_type(project, 'product')
43 | for product in products:
44 | obj = bpy_helper.find_object(product)
45 | if not obj:
46 | # logging.warn('can not find ' + product.name)
47 | # product not in blend-file... (ignored)
48 | continue
49 | if blacklisted(obj, ifc_type, regex):
50 | other_obj = append_object(blend_file, object_name)
51 | replace_object(obj, other_obj, copy_dimensions)
52 |
--------------------------------------------------------------------------------
/ifc_blender/visibility.py:
--------------------------------------------------------------------------------
1 | import bpy
2 | import logging
3 | from . import bpy_helper
4 | from . import ifc_helper
5 |
6 | """
7 | show all elements by given IFC-type
8 | """
9 | def show_hidden(project, ifc_type, **kwargs):
10 | ifc_elems = ifc_helper.elements_by_type(project, ifc_type)
11 | ifc_names = [elem.name for elem in ifc_elems]
12 | i = 0
13 | for obj in bpy.data.objects:
14 | if obj.hide and obj.name in ifc_names:
15 | i += 1
16 | # logging.info('{}: show {}'.format(i, obj.name))
17 | obj.hide = False
18 | logging.info('show {} hidden objects'.format(i))
19 |
--------------------------------------------------------------------------------
/out/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/brean/python-ifc-blender/f8382ad7f03235c58d2e327afff1aa8e5bda0ac3/out/.gitkeep
--------------------------------------------------------------------------------
/run.bat:
--------------------------------------------------------------------------------
1 | "C:\Program Files\Blender Foundation\Blender\blender.exe" -b --python run_blender.py
2 |
--------------------------------------------------------------------------------
/run_blender.py:
--------------------------------------------------------------------------------
1 | # -*- coding: UTF-8 -*-
2 | # parse ifc file, create structure and store it into json file
3 | # please install/copy ifcopenshell-python for 3.5 and python-model to
4 | # C:\Program Files\Blender Foundation\Blender\2.78\python\lib\site-packages first
5 |
6 | import logging
7 | import sys
8 | import os
9 | import glob
10 | path = os.path.split(os.path.abspath(__file__))[0]
11 | sys.path.insert(0, path)
12 |
13 | from ifc_blender.actions import load
14 | #import ifcopenshell
15 | #from ifc_model.project import Project
16 |
17 |
18 | def log_setup():
19 | root = logging.getLogger()
20 | root.setLevel(logging.DEBUG)
21 |
22 | ch = logging.StreamHandler(sys.stdout)
23 | ch.setLevel(logging.DEBUG)
24 | formatter = logging.Formatter('IFC;%(name)s;%(levelname)s;%(message)s')
25 | ch.setFormatter(formatter)
26 | root.addHandler(ch)
27 |
28 | def main():
29 | #log_setup()
30 | load('actions/')
31 |
32 | main()
33 |
--------------------------------------------------------------------------------