Skip to content

Commit 3ea08e8

Browse files
committed
revit-meows
init revit acc extract data
0 parents  commit 3ea08e8

File tree

13 files changed

+934
-0
lines changed

13 files changed

+934
-0
lines changed

.github/workflows/ci.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- dev
8+
pull_request:
9+
10+
jobs:
11+
build:
12+
if: github.ref == 'refs/heads/dev' # Only runs on the dev branch
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
matrix:
17+
python-version: [3.11]
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v2
22+
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Install dependencies
29+
run: |
30+
# python -m pip install --upgrade pip
31+
pip install .
32+
33+
publish:
34+
if: github.ref == 'refs/heads/master' # Only runs on the master branch
35+
runs-on: ubuntu-latest
36+
needs: build
37+
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v2
41+
42+
- name: Set up Python
43+
uses: actions/setup-python@v2
44+
with:
45+
python-version: '3.x'
46+
47+
- name: Install build tools
48+
run: |
49+
python -m pip install --upgrade pip
50+
pip install build twine
51+
pip install setuptools
52+
pip install wheel
53+
54+
- name: Build package
55+
run: python setup.py sdist bdist_wheel
56+
57+
- name: Publish package to PyPI
58+
env:
59+
TWINE_USERNAME: __token__
60+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
61+
run: python -m twine upload dist/*

.gitignore

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# UV
98+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
#uv.lock
102+
103+
# poetry
104+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105+
# This is especially recommended for binary packages to ensure reproducibility, and is more
106+
# commonly ignored for libraries.
107+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108+
#poetry.lock
109+
110+
# pdm
111+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112+
#pdm.lock
113+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114+
# in version control.
115+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116+
.pdm.toml
117+
.pdm-python
118+
.pdm-build/
119+
120+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121+
__pypackages__/
122+
123+
# Celery stuff
124+
celerybeat-schedule
125+
celerybeat.pid
126+
127+
# SageMath parsed files
128+
*.sage.py
129+
130+
# Environments
131+
.env
132+
.venv
133+
env/
134+
venv/
135+
ENV/
136+
env.bak/
137+
venv.bak/
138+
139+
# Spyder project settings
140+
.spyderproject
141+
.spyproject
142+
143+
# Rope project settings
144+
.ropeproject
145+
146+
# mkdocs documentation
147+
/site
148+
149+
# mypy
150+
.mypy_cache/
151+
.dmypy.json
152+
dmypy.json
153+
154+
# Pyre type checker
155+
.pyre/
156+
157+
# pytype static type analyzer
158+
.pytype/
159+
160+
# Cython debug symbols
161+
cython_debug/
162+
163+
# PyCharm
164+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166+
# and can be added to the global gitignore or merged into this file. For a more nuclear
167+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
168+
#.idea/
169+
/test/config.json
170+
/test/output/
171+
/test/notebook/
172+
*.idea

License.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2024 chuognmep
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

Readme.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
2+
![](./docs/background.png)
3+
4+
## Description
5+
6+
The project simplifies data extraction from Revit model in [ACC](https://construction.autodesk.com/) using the Model [Derivative API](https://aps.autodesk.com/en/docs/model-derivative/v2). Leveraging powerful [Python](https://www.python.org/) libraries, it enables efficient visualization and analysis of [Revit](https://www.autodesk.com/sg/products/revit/overview) data.
7+
8+
## Installation
9+
10+
```bash
11+
pip install revit_meows
12+
```
13+
14+
## Simple Usage
15+
16+
- Get All Categories
17+
18+
```python
19+
from revit_meows import APSRevit
20+
from aps_toolkit import Auth
21+
token = Auth().auth3leg()
22+
urn = "<urn of item version>"
23+
revit_meows = APSRevit(urn,token)
24+
categories = revit_meows.get_all_categories()
25+
print(categories)
26+
```
27+
28+
- Export All Revit Data To CSV
29+
```python
30+
from revit_meows import APSRevit
31+
from aps_toolkit import Auth
32+
token = Auth().auth3leg()
33+
urn = "<urn of item version>"
34+
revit_meows = APSRevit(urn,token)
35+
df = revit_meows.get_all_data()
36+
df.to_csv("revit_data.csv")
37+
```
38+
Explore more in the [Examples](./docs/example.ipynb).
39+
40+
## Features
41+
42+
- [x] Get All Revit Categories
43+
- [x] Get Revit Data By Categories
44+
- [x] Get All Revit Data From Model In ACC
45+
- [x] Get Bounding Box of Revit Element data
46+
47+
## Development Usage
48+
49+
```
50+
pip install -e .
51+
```
52+
53+
## License
54+
55+
This project is licensed under the Apache License - see the [LICENSE](./License.md) file for details.
56+
57+
## Learning Resources
58+
- [Autodesk Platform Services](https://github.com/autodesk-platform-services)
59+
60+
- [Model Properties API v.s. Model Derivative API](https://aps.autodesk.com/blog/model-properties-api-vs-model-derivative-api)
61+
62+
## Q&A
63+
64+
<details><summary>How can I get URN input?</summary>
65+
66+
1. You can use `aps-toolkit` library to get URN of the item latest version.
67+
68+
```python
69+
from aps_toolkit import *
70+
token = Auth().auth2leg()
71+
bim360 = BIM360(token)
72+
urn = bim360.get_latest_derivative_urn("<project_id>","<folder_id>")
73+
```
74+
75+
2. You can batch report urn to dataframe from BIM360 class in `aps-toolkit` library.
76+
77+
```python
78+
url = "https://acc.autodesk.com/docs/files/projects/....?version=urn%3Aadsk.wipprod%3Afs.file%3A...."
79+
from aps_toolkit import BIM360
80+
from aps_toolkit import Auth
81+
token = Auth().auth3leg()
82+
bim360 = BIM360(token)
83+
df = bim360.batch_report_items("<project_id>","<folder_id>",['.rvt'],is_sub_folder=False)
84+
```
85+
</details>

__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .revit_meows import APSRevit

docs/background.png

924 KB
Loading

0 commit comments

Comments
 (0)