Skip to content

Commit e9f9595

Browse files
authored
Merge pull request #8 from diffCheckOrg/RhDFExporter
Rhino2DFChecker Exporter
2 parents 1c8bba6 + 95a810b commit e9f9595

File tree

22 files changed

+7448
-3
lines changed

22 files changed

+7448
-3
lines changed

.github/workflows/gh-build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: gh-build
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
jobs:
10+
build_ghuser_components:
11+
runs-on: windows-latest
12+
name: Build components
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: NuGet/setup-nuget@v1.0.5
16+
17+
- name: Install CPython and pythonnet package
18+
run: |
19+
choco install python --version=3.9.10
20+
python -m pip install pythonnet==3.0.3
21+
22+
- uses: compas-dev/compas-actions.ghpython_components@v5
23+
with:
24+
source: src/gh/components
25+
target: build
26+
interpreter: cpython
27+
28+
- uses: actions/upload-artifact@v2
29+
with:
30+
name: ghuser-components
31+
path: build

.gitignore

Lines changed: 165 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,168 @@ _deps
7777
temp/
7878

7979
# temporary logging file
80-
*.log
80+
*.log
81+
82+
#######################################
83+
## Python
84+
#######################################
85+
# Byte-compiled / optimized / DLL files
86+
__pycache__/
87+
*.py[cod]
88+
*$py.class
89+
90+
# C extensions
91+
*.so
92+
93+
# Distribution / packaging
94+
.Python
95+
build/
96+
develop-eggs/
97+
dist/
98+
downloads/
99+
eggs/
100+
.eggs/
101+
lib/
102+
lib64/
103+
parts/
104+
sdist/
105+
var/
106+
wheels/
107+
share/python-wheels/
108+
*.egg-info/
109+
.installed.cfg
110+
*.egg
111+
MANIFEST
112+
113+
# PyInstaller
114+
# Usually these files are written by a python script from a template
115+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
116+
*.manifest
117+
*.spec
118+
119+
# Installer logs
120+
pip-log.txt
121+
pip-delete-this-directory.txt
122+
123+
# Unit test / coverage reports
124+
htmlcov/
125+
.tox/
126+
.nox/
127+
.coverage
128+
.coverage.*
129+
.cache
130+
nosetests.xml
131+
coverage.xml
132+
*.cover
133+
*.py,cover
134+
.hypothesis/
135+
.pytest_cache/
136+
cover/
137+
138+
# Translations
139+
*.mo
140+
*.pot
141+
142+
# Django stuff:
143+
*.log
144+
local_settings.py
145+
db.sqlite3
146+
db.sqlite3-journal
147+
148+
# Flask stuff:
149+
instance/
150+
.webassets-cache
151+
152+
# Scrapy stuff:
153+
.scrapy
154+
155+
# Sphinx documentation
156+
docs/_build/
157+
158+
# PyBuilder
159+
.pybuilder/
160+
target/
161+
162+
# Jupyter Notebook
163+
.ipynb_checkpoints
164+
165+
# IPython
166+
profile_default/
167+
ipython_config.py
168+
169+
# pyenv
170+
# For a library or package, you might want to ignore these files since the code is
171+
# intended to run in multiple environments; otherwise, check them in:
172+
# .python-version
173+
174+
# pipenv
175+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
176+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
177+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
178+
# install all needed dependencies.
179+
#Pipfile.lock
180+
181+
# poetry
182+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
183+
# This is especially recommended for binary packages to ensure reproducibility, and is more
184+
# commonly ignored for libraries.
185+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
186+
#poetry.lock
187+
188+
# pdm
189+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
190+
#pdm.lock
191+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
192+
# in version control.
193+
# https://pdm.fming.dev/#use-with-ide
194+
.pdm.toml
195+
196+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
197+
__pypackages__/
198+
199+
# Celery stuff
200+
celerybeat-schedule
201+
celerybeat.pid
202+
203+
# SageMath parsed files
204+
*.sage.py
205+
206+
# Environments
207+
.env
208+
.venv
209+
env/
210+
venv/
211+
ENV/
212+
env.bak/
213+
venv.bak/
214+
215+
# Spyder project settings
216+
.spyderproject
217+
.spyproject
218+
219+
# Rope project settings
220+
.ropeproject
221+
222+
# mkdocs documentation
223+
/site
224+
225+
# mypy
226+
.mypy_cache/
227+
.dmypy.json
228+
dmypy.json
229+
230+
# Pyre type checker
231+
.pyre/
232+
233+
# pytype static type analyzer
234+
.pytype/
235+
236+
# Cython debug symbols
237+
cython_debug/
238+
239+
# PyCharm
240+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
241+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
242+
# and can be added to the global gitignore or merged into this file. For a more nuclear
243+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
244+
#.idea/

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ if(NOT GIT_SUBMOD_RESULT EQUAL "0")
1616
message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
1717
endif()
1818

19-
2019
#--------------------------------------------------------------------------
2120
# pre-compiled definitions
2221
#--------------------------------------------------------------------------

CONTRIBUTING.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,108 @@ git add .gitmodules
4848
git commit -m "Remove a submodule name"
4949
```
5050

51+
---
52+
# Python
53+
DiffCheck is distributed as a Python Grasshopperr plug-in via yak and its source code via PyPI. The plug-in is composed by a series of `.ghuser` components.
54+
55+
There are 3 ways you can contribute to the Python GH plug-in:
56+
1. By adding new components to the plug-in.
57+
2. By fixing bugs of existing components in the plug-in.
58+
3. By adding new functionalities to existing components in the plug-in.
59+
60+
Before committing to the repository you need to have tested the components in the Grasshopper environment and be sure that this is working correctly. Also, provide a sufficient documentation in the PR (for now) please.
61+
62+
Follow these steps to develop and test the Python GH plug-in:
63+
- [GHPy: A) preparation](#ghpy-a-preparation)
64+
- [GHPy: B) development/debug](#ghpy-b-developmentdebug)
65+
- [GHPy: C) Release](#ghpy-c-release)
66+
- [GHPy: D) Documentation](#ghpy-d-documentation)
67+
68+
## GHPy: A) preparation
69+
Download this repo if you haven't already.
70+
```terminal
71+
git clone https://github.com/diffCheckOrg/diffCheck.git
72+
```
73+
74+
Next, if you used diffCheck before as an end-user clean all the `diffCheck folders` in the following directory (the last name will change):
75+
```terminal
76+
C:\Users\<user-name>\.rhinocode\py39-rh8\site-envs\default-wMh5LZL3
77+
```
78+
> note that if you drop an official released diffCheck component from yak, this one will have the `#r : diffCheck==<version_number>` notation at the top of the script. Get rid of all these release components before to start and be sur to erase again the previous folders (they recreated each time `#r : diffCheck` is called).
79+
80+
Lastly, install the pip pacakge from the repository in editable mode. This way, all the modifications made to the source code of the repository will be reflected in the installed package. Open a terminal and run the following command (replace the path with where you download the repository):
81+
```terminal
82+
C:\Users\<your-username>\.rhinocode\py39-rh8\python.exe -m pip install -e "<path-to-repository-root>\src\gh\diffCheck"
83+
```
84+
85+
For your info the packages is installed in `C:\Users\andre\.rhinocode\py39-rh8\Lib\site-packages`.
86+
87+
That's it you are now a contributor to the diffCheck! We raccomand to not download anymore from yak package but rather use the source code in the repository. If you want the latest diffCheck, checkout and pull the main.
88+
89+
## GHPy: B) development/debug
90+
91+
### B.1) Code structure
92+
For DiffCheck there are 2 main folders in the repository:
93+
* `src/gh/diffCheck/components` here you can add new components or modify existing ones (for more info on how to create one we point you to [this documentation](https://github.com/compas-dev/compas-actions.ghpython_components)). Here we call the
94+
* `src/gh/diffCheck/diffCheck` this is our package where the core functionalities are implemented.
95+
96+
### B.2) Developing component's content
97+
The idea is to start by developing the content of the component in the file `src/gh/diffCheck/diffCgeck_app.py`. This would be a simple script that contains the logic of the component. Once the script `diffCheck_app.py` is working correctly, you can move the code to the component file in the `src/gh/diffCheck/components` folder. This is because the component file is the one that will be componentized and distributed via yak.
98+
99+
We reccomand to use `VSCode` as IDE for developing the components. This is because it has a good integration with the `Grasshopper` environment and it is easy to debug the components. To set up the IDE follow these steps:
100+
1. Install the `ScriptSync` extension for `VSCode`.
101+
2. Install the `ScriptSync` from the yak manager in Rhino.
102+
3. Open the `diffCheckApp.py` from the `src/gh/diffCheck/components` folder you are working on in `VSCode`, and set its path to the ScriptSync ghcomponent.
103+
4. If you modify the code in `VSCode`, the changes will be reflected in the Grasshopper component as soon as you save in `VSCode` again the `code.py`.
104+
5. Once your code is working, prepare the code and componentize it.
105+
106+
If you want to use the GHEditor it's ok but everytime you modify the pakcage or the component's code, after any modifications you need to restart the Python interpreter from the ScriptEditor (`Tools > Reload Python3 (CPython) Engine`) and recompute the solution in Grasshopper.
107+
108+
### B.3) Componentize the code
109+
Prepare your component as explained here. You can componentize it locally and test it in Grasshopper. Here's how to componentize:
110+
```terminal
111+
python f:\diffCheck\src\gh\util\componentizer_cpy.py --ghio "C:\Users\andre\.nuget\packages\grasshopper\8.2.23346.13001\lib\net48\" .\src\gh\components\ .\build\gh
112+
```
113+
> Note that you need to find the path to your GHIO folder. This is the folder where the `Grasshopper.dll` is located. E.g. You can find it in the `nuget` folder in the Rhino installation directory.
114+
115+
Once you are sure that the component is working correctly, you can push the changes to the repository.
116+
117+
## GHPy: C) Release
118+
The release will be made via CI from main. As a contributor you don't need to worry about this. The plug-in is componentized, pushed to yak/PyPI and the user can download the latest version from yak.
119+
120+
## GHPy: D) Documentation
121+
More to come.
122+
123+
124+
<!-- ## PyPI
125+
To push the package to PyPI, you need to:
126+
1. Install the package `twine`:
127+
```bash
128+
pip install twine
129+
```
130+
2. Build the package:
131+
```bash
132+
python setup.py sdist bdist_wheel
133+
```
134+
3. Check the package:
135+
```bash
136+
twine check dist/*
137+
```
138+
4. Upload the package:
139+
```bash
140+
twine upload dist/*
141+
```
142+
Be sure to have the right to upload the package to the PyPI repository.
143+
To do so you need to set the `~/.pypirc` file with the following content:
144+
```bash
145+
[distutils]
146+
index-servers=pypi
147+
148+
[pypi]
149+
username = __token__
150+
password = pypi-<your-TOKEN>
151+
``` -->
152+
51153
---
52154
# C++
53155

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# diffCheck
22
<p align="left">
33
<img src="https://github.com/diffCheckOrg/diffCheck/actions/workflows/win-build.yml/badge.svg">
4+
<img src="https://github.com/diffCheckOrg/diffCheck/actions/workflows/gh-build.yml/badge.svg">
5+
<img src="https://img.shields.io/pypi/v/diffCheck" href="https://pypi.org/project/diffCheck/">
46
</p>
57

8+
69
Temporary repository for diffCheck
710

811
## Roadmap

0 commit comments

Comments
 (0)