compas_nest.result¶
compas_nest.result
¶
Result of a nesting solve: placement poses and the world-placed geometry they imply.
nest_result
¶
Bases: Data
Placements produced by a nesting engine (a serializable COMPAS Data).
The placement contract (shared by both engines) is::
world_point = Rotate(part_point, angle, about origin) + (tx, ty) + sheet_origin
where part_point is a vertex of the original part geometry and angle is in radians.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
placements
|
list[dict]
|
Each placement: |
required |
geo
|
:class:`compas_nest.nest_geo`
|
The parts that were nested (placements reference parts by |
required |
sheet_origins
|
list[tuple[float, float]]
|
World origin of each sheet, added to sheet-local |
required |
n_sheets
|
int
|
Number of sheets actually used. |
required |
fitness
|
float
|
Solver fitness (NFP engine only). |
None
|
name
|
str
|
|
None
|
Source code in compas_nest/result.py
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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
placed
property
¶
list[dict] : Placements that landed on a sheet (sheet_id >= 0).
unplaced
property
¶
list[dict] : Placements that could not be placed.
transformation(placement)
¶
Return the world :class:compas.geometry.Transformation for a placement.
Source code in compas_nest/result.py
75 76 77 78 79 80 | |
placed_polylines(geo=None)
¶
Return the placed geometry grouped per sheet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geo
|
:class:`compas_nest.nest_geo`
|
Apply the solved poses to this geometry instead of the one that was nested. Use it to render the original parts when the solve ran on offset (clearance) geometry. |
None
|
Returns:
| Type | Description |
|---|---|
list[dict]
|
One entry per used sheet:: |
Source code in compas_nest/result.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
to_json(filepath, geo=None)
¶
Serialize the placed polylines (with holes) and transformations to COMPAS JSON.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
str
|
Output path. Parent directories are created if missing. |
required |
geo
|
:class:`compas_nest.nest_geo`
|
Apply the solved poses to this geometry instead of the nested one (see
:meth: |
None
|
Source code in compas_nest/result.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |
to_obj(filepath, geo=None)
¶
Write the placed outlines and holes to a Wavefront OBJ as closed polyline loops.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepath
|
str
|
Output path. Parent directories are created if missing. |
required |
geo
|
:class:`compas_nest.nest_geo`
|
Apply the solved poses to this geometry instead of the nested one (see
:meth: |
None
|
Source code in compas_nest/result.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |