FBX_to_STL_separator is a powerful two-step automation tool designed to streamline the process of extracting and converting architectural elements from FBX files into individual STL files. This toolset comprises two main components:
FBX to OBJS.blend
: A Blender file containing a Python script for FBX to OBJ conversion and element separation.OBJtoSTL.bat
: A batch file for converting OBJ files to STL format using CloudCompare.
This toolset is particularly useful for professionals and students working in Building Information Modeling (BIM), architectural visualization, and 3D printing preparation.
This project was conceptualized and performed during a research stay at the research group of Jun.-Prof. Dr. Reza Maalek, the GOLDBECK endowed chair in Digital Engineering and Construction (DEC) at the Institute of Technology and Management in Construction (TMB) of the Karlsruhe Institute of Technology (KIT).
FBXseperator.mp4
The primary purpose of this toolset is to automate the tedious task of manually separating and converting individual architectural elements from complex 3D models. It addresses the common challenge in architectural workflows where entire building models need to be broken down into their constituent parts and converted to a widely-compatible format for further analysis, modification, or 3D printing.
- FBX Import and Object Separation: Imports FBX files and automatically identifies specific architectural elements based on predefined keywords.
- Naming and Data Management: Applies consistent naming conventions and implements a hashing system for persistent object numbering across multiple runs and epochs.
- Geometry Processing: Calculates bounding box coordinates for spatial analysis and placement.
- File Conversion: Exports separated objects as individual OBJ files, then converts them to STL format using CloudCompare.
- Data Persistence: Stores object data in CSV files for easy reference and further processing.
- File Organization: Automatically organizes the resulting STL files into a designated folder structure.
- Windows operating system
- Blender 3.6 or later
- CloudCompare 2.13 or later (default path: C:\Program Files\CloudCompare\CloudCompare.exe)
- Python 3.7 or higher (included with Blender)
- Blender Python API (bpy) - included with Blender
- Standard Python libraries: os, csv, mathutils, hashlib - included in Python's standard library
- CloudCompare command-line interface - included in CloudCompare installation
No additional pip installations are required.
-
Download the Scripts
- Clone this repository or download both
FBX to OBJS.blend
andOBJtoSTL.bat
files.
- Clone this repository or download both
-
Blender Configuration
- Launch Blender
- Open the
FBX to OBJS.blend
file in Blender
-
CloudCompare Configuration
- Ensure CloudCompare is installed in the default location or update the path in
OBJtoSTL.bat
- Ensure CloudCompare is installed in the default location or update the path in
-
Configure File Paths
- In Blender, open the Text Editor window and locate the script within the
FBX to OBJS.blend
file - Update the following paths in the script:
CONFIG = { "fbx_path": r"C:\Path\To\Your\InputModel.fbx", "obj_dir": r"C:\Path\To\Your\OutputOBJs", "csv_file_path": r"C:\Path\To\Your\OutputData.csv", "numbering_dir": r"C:\Path\To\Your\NumberingCSVs" }
- Edit
OBJtoSTL.bat
if CloudCompare is installed in a non-default location:set "cloudcompare_executable=C:\Your\Custom\Path\To\CloudCompare.exe"
- In Blender, open the Text Editor window and locate the script within the
-
Verify Blender Script
- In Blender, with the
FBX to OBJS.blend
file open, run the script from the Text Editor window - If no errors occur, the setup is successful
- In Blender, with the
- Open the
FBX to OBJS.blend
file in Blender - Adjust the CONFIG dictionary in the script if necessary. Replace the example paths with your specific directories:
CONFIG = { "fbx_path": r"C:\Path\To\Your\InputModel.fbx", "obj_dir": r"C:\Path\To\Your\OutputOBJs", "csv_file_path": r"C:\Path\To\Your\OutputData.csv", "numbering_dir": r"C:\Path\To\Your\NumberingCSVs" }
3.Run the script to process the FBX file and generate separated OBJ files
- Place
OBJtoSTL.bat
in the same directory as your OBJ files. - Double-click
OBJtoSTL.bat
to run it. - The script will:
- Convert all OBJ files in the current directory to STL format.
- Move the resulting STL files to a new 'stls' subdirectory.
- Delete the original OBJ files.
The OBJ to STL conversion script deletes the original OBJ files after conversion. Ensure you have backups before running the script.
If the script fails to identify objects, check if your FBX file uses the expected keywords ("Column", "Wall", "Floor") in object names. Ensure all file paths in the CONFIG dictionary are correctly set and accessible. If CloudCompare fails to convert OBJ to STL, verify that CloudCompare is correctly installed and the path in the batch file is correct.
Contributions to improve FBX_to_STL_separator are welcome. Please feel free to submit pull requests or open issues to discuss proposed changes or report bugs.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.