construct an assembly :param obj: root object of the assembly (default: None) :param loc: location of the root object (default: None, interpreted as identity transformation) :param name: unique name of the root object (default: None, resulting in an UUID being gener
(
self,
obj: AssemblyObjects = None,
loc: Optional[Location] = None,
name: Optional[str] = None,
color: Optional[Color] = None,
material: Optional[Material] = None,
metadata: Optional[Dict[str, Any]] = None,
)
| 117 | _solve_result: Optional[Dict[str, Any]] |
| 118 | |
| 119 | def __init__( |
| 120 | self, |
| 121 | obj: AssemblyObjects = None, |
| 122 | loc: Optional[Location] = None, |
| 123 | name: Optional[str] = None, |
| 124 | color: Optional[Color] = None, |
| 125 | material: Optional[Material] = None, |
| 126 | metadata: Optional[Dict[str, Any]] = None, |
| 127 | ): |
| 128 | """ |
| 129 | construct an assembly |
| 130 | |
| 131 | :param obj: root object of the assembly (default: None) |
| 132 | :param loc: location of the root object (default: None, interpreted as identity transformation) |
| 133 | :param name: unique name of the root object (default: None, resulting in an UUID being generated) |
| 134 | :param color: color of the added object (default: None) |
| 135 | :param material: material (for visual and/or physical properties) of the added object (default: None) |
| 136 | :param metadata: a store for user-defined metadata (default: None) |
| 137 | :return: An Assembly object. |
| 138 | |
| 139 | |
| 140 | To create an empty assembly use:: |
| 141 | |
| 142 | assy = Assembly(None) |
| 143 | |
| 144 | To create one constraint a root object:: |
| 145 | |
| 146 | b = Workplane().box(1, 1, 1) |
| 147 | assy = Assembly(b, Location(Vector(0, 0, 1)), name="root") |
| 148 | |
| 149 | """ |
| 150 | |
| 151 | self.obj = obj |
| 152 | self.loc = loc if loc else Location() |
| 153 | self.name = name if name else str(uuid()) |
| 154 | self.color = color if color else None |
| 155 | self.material = material if material else None |
| 156 | self.metadata = metadata if metadata else {} |
| 157 | self.parent = None |
| 158 | |
| 159 | self.children = [] |
| 160 | self.constraints = [] |
| 161 | self.objects = {self.name: self} |
| 162 | |
| 163 | self._solve_result = None |
| 164 | |
| 165 | self._subshape_names = BiDict() |
| 166 | self._subshape_colors = BiDict() |
| 167 | self._subshape_layers = BiDict() |
| 168 | |
| 169 | def _copy(self) -> "Assembly": |
| 170 | """ |