The FastAPI based python app for handling IFC file (Under construction)
Used Library : IfcOpenShell
Actually, I've created this server for local use first.
When I first used Jupyter Notebook before, I've realized that it's a kind of Client-Server based application.
The local server of Jupyter Notebook is running on the local, and the user can access services via browser.
After that, I've designed this server app as parsing server of IFC File, using IfcOpenShell.
- Before run server, please make your .env file on the root direct. This app uses dotenv.
#src/config.py
import os
from dotenv import load_dotenv
load_dotenv()
ENVIRONMENT = os.getenv("ENVIRONMENT", "production")
SERVER_PORT = int(os.getenv("SERVER_PORT"))
SERVER_HOST = os.getenv("SERVER_HOST")
#src/main.py
...
#Server On
if __name__ == "__main__":
import uvicorn
if ENVIRONMENT == "dev":
uvicorn.run("main:app", host=SERVER_HOST, port=SERVER_PORT, reload=True)
else:
uvicorn.run("main:app", host=SERVER_HOST, port=SERVER_PORT)
#.env
ENVIRONMENT=dev #if you set this as dev, you can see the log on the python console.
SERVER_PORT=<YOUR PORT>
SERVER_HOST=<YOUR HOST>
- Please add your client host to pass CORS.
...
#src/main.py
#Server Setting
app = FastAPI()
origins = [
#Add your host here
"http://localhost:3000",
]
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"]
)
...
- Run src/main.py
- Slab (IfcSlab)
Parsable elements will be updated gradually.
FrontEnd (Next.js + React) repository : https://github.com/JakkeLab-AEC/amountslicer-fe/tree/main