-
Notifications
You must be signed in to change notification settings - Fork 7
/
ex08_wall_interfaces.py
55 lines (40 loc) · 1.41 KB
/
ex08_wall_interfaces.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""Add a support plate to a wll assembly and identify the interfaces.
Steps
-----
1. Load an assembly from a json file
2. Compute the footprint of the assembly
3. Add a support in the XY plane at least the size to the footprint
4. Compute the interfaces of the assembly
5. Serialise the result
Parameters
----------
NMAX : int
Maximum number of neighbors to be taken into account for the interface detection.
Due to the shape of the support and the width of the wall, this number needs
to be relatively high...
AMIN : float
The minimum area of overlap between two faces for them to be considered to
be in contact.
Exercise
--------
Change the values of ``NMAX`` and ``AMIN`` to understand their effect.
Notes
-----
Increasing ``NMAX`` is not necessary if the bottom blocks each have an individual support.
"""
import os
from compas_assembly.datastructures import Assembly
from compas_assembly.datastructures import assembly_interfaces_numpy
HERE = os.path.dirname(__file__)
DATA = os.path.join(HERE, '../data')
PATH_FROM = os.path.join(DATA, '07_wall_supported.json')
PATH_TO = os.path.join(DATA, '08_wall_interfaces.json')
# parameters
NMAX = 100
AMIN = 0.0001
# load assembly from JSON
assembly = Assembly.from_json(PATH_FROM)
# identify the interfaces
assembly_interfaces_numpy(assembly, nmax=100, amin=0.0001)
# serialise
assembly.to_json(PATH_TO)