Skip to content

Commit 7685dce

Browse files
committed
move blender stuff
1 parent d49ea0c commit 7685dce

File tree

4 files changed

+82
-102
lines changed

4 files changed

+82
-102
lines changed

docs/gettingstarted/blender.rst

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,85 @@ After that starting Blender from the command line is much simpler.
189189
.. code-block:: bash
190190
191191
blender
192+
193+
Scripting Interface
194+
===================
195+
196+
To switch to the scripting interface, simply select the "Scripting" tab of the main window.
197+
198+
The scripting interface has an embedded interactive Python terminal, which is located in the bottom half of the main window on the left.
199+
If COMPAS was successfully installed you can use it to directly access the ``conda`` environment from where the installation was executed.
200+
201+
.. code-block:: python
202+
203+
>>> import compas
204+
>>> import compas_blender
205+
>>> import numpy
206+
>>> import scipy
207+
>>> import bpy
208+
209+
The script editor is quite simple but good enough for basic development.
210+
Line numbers and syntax highlighting should be on by default, but if that is not the case,
211+
they can be turned on with toggle buttons at the top right of the area.
212+
Further customisation of the editor appearance is possible by opening the sidebar from the "View" menu of the editor.
213+
214+
Basic Usage
215+
===========
216+
217+
One of the main advantages of working in Blender is that Blender Python is CPython, and not IronPython like in Rhino and Grasshopper.
218+
This means that all cool Python libraries are directly available and do not need to be accessed through remote procedure calls (RPC).
219+
Especially for code that relies heavily on libraries such as Numpy and Scipy this simplifies the development process quite significantly.
220+
221+
.. code-block:: python
222+
223+
import compas
224+
import compas_blender
225+
from compas.datastructures import Mesh
226+
from compas_blender.artists import MeshArtist
227+
228+
compas_blender.clear()
229+
230+
mesh = Mesh.from_ply(compas.get('bunny.ply'))
231+
232+
artist = MeshArtist(mesh)
233+
artist.draw_mesh()
234+
235+
236+
Data Blocks
237+
-----------
238+
239+
Something worth explaining is the use of ``compas_blender.clear()`` in this script.
240+
Blender uses (and re-uses) something called "data blocks".
241+
Objects in the scene have instances of these data blocks assigned to them.
242+
Multiple objects can be linked to the same data block.
243+
As a result, simply deleting an object from the scene will delete the object but not the underlying data block.
244+
245+
If you run a script multiple times,
246+
even if you delete the scene objects between consecutive runs,
247+
you will accumulate the data blocks from previous runs and after a while Blender will become very slow.
248+
249+
``compas_blender.clear()`` attempts to clean up not only the scene objects but also the data blocks.
250+
If somehow you still experience a slowdown, restarting Blender will help (all unused data blocks are then automatically removed).
251+
252+
253+
Layers
254+
------
255+
256+
There are no real layers in Blender; at least not like the layers in, for example, Rhino.
257+
Therefore, the Blender artists have no optional ``layer`` parameter and no ``clear_layer`` method.
258+
Instead, objects are grouped in collections, which can be turned on and off in the Blender UI similar to layers in Rhino.
259+
260+
261+
Collections
262+
-----------
263+
264+
265+
Limitations
266+
===========
267+
268+
``compas_blender`` is not yet as well developed as, ``compas_rhino`` and ``compas_ghpython``.
269+
For example, COMPAS geometry objects do not yet have a corresponding artist in ``compas_blender``.
270+
Artists are currently only available for data structures and robots.
271+
272+
There is also no official system yet for making custom COMPAS tools in Blender.
273+
Therefore, COMPAS Blender development is somewhat limited to individual scripts.

docs/tutorial/blender.rst

Lines changed: 0 additions & 94 deletions
This file was deleted.

docs/tutorial/grasshopper.rst

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/tutorial/rhino.rst

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)