Skip to content

Commit 2706614

Browse files
committed
Build
1 parent 39ac659 commit 2706614

File tree

104 files changed

+6440
-722
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+6440
-722
lines changed

CNAME

Lines changed: 0 additions & 1 deletion
This file was deleted.

_sources/guides/authoring/understanding_ifc.rst.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,22 @@ This section provides an overview of key IFC concepts and how they're implemente
4949

5050
.. container:: card
5151

52-
:doc:`ifc_concepts/spatial_objects`
52+
:doc:`spatial_objects`
5353
Basic spatial objects.
5454

5555
.. container:: card
5656

57-
:doc:`ifc_concepts/classification_and_types`
57+
:doc:`classification_and_types`
5858
IFC classification hierarchy and the concept of types and occurrences.
5959

6060
.. container:: card
6161

62-
:doc:`ifc_concepts/geometry_and_representations`
62+
:doc:`geometry_and_representations`
6363
Understanding IFC geometry, representations, and parametric materials.
6464

6565
.. container:: card
6666

67-
:doc:`ifc_concepts/working_with_representations`
67+
:doc:`working_with_representations`
6868
Representations in Bonsai.
6969

7070
.. container:: global-index-toc
@@ -74,7 +74,7 @@ This section provides an overview of key IFC concepts and how they're implemente
7474
:caption: Understanding IFC
7575
:maxdepth: 2
7676

77-
ifc_concepts/spatial_objects
78-
ifc_concepts/classification_and_types
79-
ifc_concepts/geometry_and_representations
80-
ifc_concepts/working_with_representations
77+
spatial_objects
78+
classification_and_types
79+
geometry_and_representations
80+
working_with_representations
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Code style
2+
============
3+
4+
5+
Black code formatter
6+
-------------------------------
7+
For Python code formatting, we use `Black code formatter <https://pypi.org/project/black/>`__,
8+
black settings are stored in the repository's pyproject.toml.
9+
10+
We have GitHub workflow `ci-black-formatting` to maintain black formatting across the repository.
11+
12+
``black`` can be installed using ``pip install black`` and files can be formatted with the following example command:
13+
14+
.. code-block:: bash
15+
16+
# Format the entire repository.
17+
# Should be used in 99% cases as the entire repository is already formatted using black.
18+
black .
19+
# Format only some specific file.
20+
black src/bonsai/bonsai/bim/module/qto/operator.py
21+
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
Debugging Bonsai
2+
================
3+
4+
This is a mini-guide to setting up an IDE and configuring it to debug Bonsai
5+
more easily. It is currently specific to this writers own system (Ubuntu) but
6+
this can be expanded by others.
7+
8+
1. **Install VSCode/VSCodium**: This will be system specific. I used the
9+
available snap package.
10+
11+
.. code-block:: bash
12+
13+
sudo snap install --classic codium
14+
15+
I chose VSCodium to avoid Microsoft telemetry and data harvesting, but
16+
VSCode is going to be similar, and even a bit easier (i.e. step 3).
17+
18+
2. **Activate Python language support**: Start VSCode/VSCodium, open the
19+
Extensions tab, find the Python language support and activate it.
20+
21+
3. **Install Blender Addon**: This step depends on which IDE you chose.
22+
23+
a. VSCode
24+
25+
Open up the Extensions tab on the left, and search for the *Blender
26+
Development* extension. Select it, and click Install.
27+
28+
I haven't actually tested this, but this should install the
29+
*ms-vscode.cpptools* dependancy for you. If not, you may need to search
30+
for, and install, this extension too.
31+
32+
b. VSCodium
33+
34+
It seems VSCodium is not allowed to direct access the Marketplace, and
35+
due to licensing it is not possible to install the *Blender Development*
36+
extension because of the *ms-vscode.cpptools* dependancy.
37+
38+
VSCodium's equivalent Marketplace does not (and could not due to
39+
licensing) provide a functioning *Blender Development* extension. (Or I'm
40+
an idiot... entirely possible).
41+
42+
I've created an alternative *Blender Development* extension with the
43+
*ms-vscode.cpptools* dependancy removed.
44+
45+
.. note::
46+
This alternative should also work in VSCode, but you may as well save
47+
yourself the hassle, and just use the original one.
48+
49+
Download the *Blender Development* ``.vsix`` file from my GitHub fork
50+
using your browser from `this <https://github.com/sboddy/blender_vscode>`_
51+
repository. The ``.vsix`` is available on the Releases page.
52+
53+
In VSCodium's Extensions sidebar install it with "**...**" ->
54+
"**Install from VSIX...**"
55+
56+
If you are squeamish about downloading my ``.vsix``, you can review the
57+
single commit, clone the repo and create your own.
58+
59+
4. **Set the Blender config directory**: In **Settings** -> **Extensions** ->
60+
**Blender** -> "**Environment Variables**"
61+
edit the json file to set the ``BLENDER_USER_RESOURCE`` to the config folder
62+
you installed Bonsai to. *For me*:
63+
64+
.. code-block:: json
65+
66+
{
67+
"blender.environmentVariables": {
68+
"BLENDER_USER_RESOURCES": "/home/steve/.config/blender/4.2bonsai"
69+
}
70+
}
71+
72+
.. warning::
73+
You `must` change that path to the correct value for your system.
74+
75+
5. **Unset the Just My Code flag**: In **Settings** -> **Extensions** ->
76+
**Blender** -> "**Just My Code**" by unchecking the box.
77+
78+
Again, this was advice found searching around in a github issue. If not
79+
done, the breakpoints do not work for me.
80+
81+
6. **Open the folder in VSCode/VSCodium**: This is the same folder set in step
82+
5. Again, *for me*:
83+
84+
``/home/steve/.config/blender/4.2bonsai``
85+
86+
This was a key point for me. Do `not` go deeper in the folder structure -
87+
that just doesn't work. (Thanks @theoryshaw) This feels a little like
88+
using a sledgehammer to crack a nut, and there might be a better, "proper"
89+
way of setting this up. If there is I'd love to hear it.
90+
91+
7. **Start Blender**: In VSCode/VSCodium press ``Ctrl+Shift+P``, and
92+
search/select **Blender: Start**.
93+
94+
8. **Set the Blender binary path**: The first time you try to start Blender the
95+
addon will ask for the path of the binary. Navigate to your Blender binary
96+
and select it. *For me*:
97+
98+
``/home/steve/Software/blender-git/build_linux/bin/blender``
99+
100+
.. warning::
101+
Do `not` try to use a binary installed using snap - it will `not` work.
102+
Either install a debian package of Blender, or build it from source, and
103+
use that.
104+
105+
All being well, Blender should start and show the usual Bonsai UI.
106+
107+
9. **Ensure Blender is behaving**: Exercise the interface a bit to be sure
108+
Bonsai is working normally. Add a demo project, add some walls, etc.
109+
110+
One issue I ran in to was opening the wrong folder in step 7. Due to the
111+
way VSCode/VSCodium works, I was getting two Bonsai plugins conflicting,
112+
and failing in interesting ways. One symptom of this was the modal user
113+
interface when adding walls was completely missing. Oh, and the debugger
114+
completely failed to work.
115+
116+
If you are happy, quit Blender, and try setting some breakpoints in
117+
VSCode/VSCodium then run Blender again, and try to trigger them. I set one
118+
on the ``bim.add_sheet`` operator at:
119+
``extensions/.local/lib/python3.11/site-packages/bonsai/bim/module/drawing/operator.py:1456``
120+
121+
.. note::
122+
I made the mistake of setting the breakpoint on the ``_execute``
123+
methods ``def`` line, which did not work. This probably helped confuse
124+
me when trying to get the addon to work.
125+
126+
If you get to this point, congratulations! You will now be 1000% more effective
127+
when troubleshooting issues, and able to make many more contributions, fixes
128+
and patches.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Getting Started
2+
===============
3+
4+
Bonsai is an open-source project, and its development is driven by the contributions of a dedicated community of developers,
5+
architects, engineers, and enthusiasts. If you're interested in contributing to the project, whether by submitting bug reports,
6+
suggesting new features, or contributing code, your involvement is highly encouraged and appreciated.
7+
8+
This part of the documentation covers various aspects of the Bonsai development process, including:
9+
10+
- :doc:`Writing User Documentation </contribute/writing_docs>`
11+
- :doc:`Translations and Internationalisation </contribute/translations>`
12+
- Contributing Code
13+
- :doc:`Installation and Setting up a Development Environment </guides/development/installation>`
14+
- Understanding the Project Structure and Codebase
15+
- :doc:`Hello, World! </guides/development/hello_world>`
16+
- :doc:`Undo System </guides/development/undo_system>`
17+
- :doc:`Code Style Guidelines and Best Practices </guides/development/code_style>`
18+
19+
..
20+
- :doc:`Submitting Pull Requests and Contributing Code </guides/development/contributing_code>`
21+
22+
- :doc:`Testing and Quality Assurance </guides/development/running_tests>`
23+
- :doc:`System Support and Multiplatform Compatibility </guides/development/installation>`
24+
- :doc:`User Experience and User Interface Guidelines </guides/development/ux_guidelines>`
25+
26+
The Bonsai Developer Documentation is a living resource maintained by the core development team and the open-source community. It serves as a central hub for developers who want to get involved in the project, ensuring a consistent and efficient development process.
27+
28+
By contributing to Bonsai, you'll not only be helping to improve and expand the capabilities of this powerful open-source BIM authoring platform but also be part of a vibrant community driving innovation in the AEC industry.

_sources/guides/development/index.rst.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ This chapter covers how you can help contribute to Bonsai.
1515
translations
1616
undo_system
1717
writing_docs
18+
debugging

_sources/guides/development/installation.rst.txt

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,17 @@ that they are typically updated every day. To install the **Unstable** version:
102102
.. image:: images/unstable-restart.png
103103

104104
If you wish to install an **Unstable** version offline, you can download a
105-
daily build from the `GitHub releases page
105+
daily or previous build from the `GitHub releases page
106106
<https://github.com/IfcOpenShell/IfcOpenShell/releases?q=bonsai&expanded=true>`__,
107107
then go to :menuselection:`Topbar --> Edit --> Preferences --> Get Extensions
108108
--> "V" Icon (top right) --> Install from Disk`.
109109

110+
.. tip::
111+
112+
Installing a previous build is a great way to roll back to previous versions. Uninstall the current version,
113+
then install the previous version from your disk. Make the install directory into the repo folder, and you can still
114+
update by the click of a button, when you are ready for the latest build.
115+
110116
Bundling for Blender
111117
--------------------
112118

@@ -153,25 +159,31 @@ our Blender installation (you will need to restart Blender to see changes).
153159

154160
For Linux or Mac:
155161

156-
.. literalinclude:: ../../scripts/installation/dev_environment.sh
162+
.. literalinclude:: ../../../scripts/installation/dev_environment.sh
157163
:language: bash
158164
:caption: dev_environment.sh
159165

160166
Or, if you're on Windows, you can use the batch script below. You need to run
161167
it as an administrator. Before running it follow the instructions descibed
162168
in the `rem` tags.
163169

164-
.. literalinclude:: ../../scripts/installation/dev_environment.bat
170+
.. literalinclude:: ../../../scripts/installation/dev_environment.bat
165171
:language: bat
166172
:caption: dev_environment.bat
167173

168174
After you modify your code in the Git repository, you will need to restart
169175
Blender for the changes to take effect.
170176

177+
If there are changes to the IfcOpenShell binaries, you may replace the two
178+
``*ifcopenshell_wrapper*`` files with new ones downloaded from the automated
179+
`IfcOpenShell builds directory <https://builds.ifcopenshell.org/>`__.
180+
171181
The downside with this approach is that if a new dependency is added, or a
172-
compiled dependency version requirement has changed, or the build system
173-
changes, you'll need to fix your setup manually. But this is relatively rare.
174-
Reviewing the Makefile history, `here <https://github.com/IfcOpenShell/IfcOpenShell/commits/v0.8.0/src/bonsai/Makefile>`__, is one quick way to see if a dependency has changed.
182+
compiled dependency has changed (that is not available via the build
183+
directory), or the build system changes, you'll need to fix your setup
184+
manually. But this is relatively rare. Reviewing the Makefile history, `here
185+
<https://github.com/IfcOpenShell/IfcOpenShell/commits/v0.8.0/src/bonsai/Makefile>`__,
186+
is one quick way to see if a dependency has changed.
175187

176188
.. seealso::
177189

0 commit comments

Comments
 (0)