MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / CSGTree

Class CSGTree

python/pymesh/CSGTree.py:5–145  ·  view source on GitHub ↗

Contructive Solid Geometry Tree. Perhaps the best way of describing supported operations is using context free grammar: * ``mesh`` operation: This operation is always a leaf node of the tree. >>> tree = pymesh.CSGTree({"mesh": mesh}) * ``union`` operation: >>> t

Source from the content-addressed store, hash-verified

3from .meshio import form_mesh
4
5class CSGTree:
6 """ Contructive Solid Geometry Tree.
7
8 Perhaps the best way of describing supported operations is using context
9 free grammar:
10
11 * ``mesh`` operation: This operation is always a leaf node of the tree.
12
13 >>> tree = pymesh.CSGTree({"mesh": mesh})
14
15 * ``union`` operation:
16
17 >>> tree = pymesh.CSGTree({"union":
18 ... [TREE_1, TREE_2, ..., TREE_N]
19 ... })
20
21 * ``intersection`` operations:
22
23 >>> tree = pymesh.CSGTree({"intersection":
24 ... [TREE_1, TREE_2, ..., TREE_N]
25 ... })
26
27 * ``difference`` operations:
28
29 >>> tree = pymesh.CSGTree({"difference":
30 ... [TREE_1, TREE_2]
31 ... })
32
33 * ``symmetric_difference`` operations:
34
35 >>> tree = pymesh.CSGTree({"symmetric_difference":
36 ... [TREE_1, TREE_2]
37 ... })
38
39 Where ``TREE_X`` could be any of the nodes defined above.
40
41 A tree can be build up incrementally:
42
43 >>> left_tree = pymesh.CSGTree({"mesh": mesh_1})
44 >>> right_tree = pymesh.CSGTree({"mesh": mesh_2})
45 >>> tree = pymesh.CSGTree({"union": [left_tree, right_tree]})
46 >>> mesh = tree.mesh
47
48 Or constructed from a dict:
49
50 >>> tree = pymesh.CSGTree({"union":
51 ... [{"mesh": mesh_1}, {"mesh": mesh_2}]
52 ... })
53 >>> mesh = tree.mesh
54 """
55 def __init__(self, tree):
56 """
57 Args:
58 tree: dictionary describing the csg tree
59
60 """
61
62 if isinstance(tree, CSGTree):

Callers 2

test_single_meshMethod · 0.90
__init__Method · 0.70

Calls

no outgoing calls

Tested by 1

test_single_meshMethod · 0.72