Design
costumy.classes.Design
The Design class should be used as a parent class only. A Design is used to create patterns from body measurements and freesewing. Each different Design requires manual work to define stuff like stiches and cleaning process.
This system could be much better, but this is just for a Proof of concept.
Source code in costumy/classes/design.py
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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
required_measurements = None
class-attribute
instance-attribute
minimal required measures to get a pattern from freesewing
optional_measurements = None
class-attribute
instance-attribute
optionnal measurements that affects the freesewing pattern
options_range = None
class-attribute
instance-attribute
Range of options manually defined {"hipsEase":(0, 0.08, 0.2)} or {"name":(min, default, max)}
stitches = None
class-attribute
instance-attribute
List of stitches based on freesewing ID and panels names [ (("front", -3), ("back", 3)),]
rotation = None
class-attribute
instance-attribute
Dict of panels and their rotation values {"front":(0,0,0)}
styles = None
class-attribute
instance-attribute
Dict of styles (presets of options). {"croptop":{"option_name":1.5}}
panels_to_unfold = None
class-attribute
instance-attribute
Dict of panels to unfold with the edge index {"front":0}
measurements = measurements
instance-attribute
Current set of measurement
missing_measurements
property
list of measurments name that are required but missing from self.measurements
isolated_measurments
property
Returns the measurments from self.measurements
only if they are required.
Helpfull to exclude optional measurements that may affect the output design (like the breast size)
Raises:
Type | Description |
---|---|
KeyError
|
Missing required measurements |
default_options
property
Default Options for pattern style
random_options
property
Random options within handefined range of options. Usefull for new_pattern(). Can create really bad pattern still
random_style
property
Random name from current styles
pattern
property
Last Pattern generated with self.new_pattern()
__init__(measurements=None)
New Design instance
Source code in costumy/classes/design.py
61 62 63 64 65 66 67 68 |
|
from_template_measures()
classmethod
Makes a Design using template measurements
Source code in costumy/classes/design.py
70 71 72 73 74 |
|
complete_measurments(include_optional=True)
Fills the missing measurements from self.measurements using closest match from costumy/measurements_sets
Source code in costumy/classes/design.py
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 |
|
new_pattern(options=None, tolerance=0.8, complete_missing_measures=True)
Creates a new pattern based on self.measurements. Returns and defines self._pattern
.
Default behavior will create a pattern using default options and uses as many measures from self.measurements
#Create a pattern of choosen style:
self.new_pattern(options="croptop")
#Create a pattern with a random style :
self.new_pattern(options=self.random_style)
#Create a pattern with random options (might make some ugly or impossible patterns):
self.new_pattern(options=self.random_options)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
options
|
dict | str
|
set of options {str:float} or name of a style within self.styles.keys(). Defaults to None ("default"). |
None
|
tolerance
|
float
|
Tolerance for Cubic2Quad. High value = Less details, less curves. Defaults to 0.8. |
0.8
|
complete_missing_measures
|
bool
|
When true, missing measures are replaced with closest known match. Defaults to True. |
True
|
Raises:
Type | Description |
---|---|
RuntimeError
|
When measurements are missing and |
Returns:
Name | Type | Description |
---|---|---|
Pattern |
Pattern
|
2D Pattern from Freesewing based on the options and measurements |
Source code in costumy/classes/design.py
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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
|
align_panels(pattern, references)
classmethod
Define the translation
and rotation
of the pattern.panels
based on the current design and a reference dict (see Body.references
).
# This will only work with subclasses the Design class
pattern = Design.from_template_measures().new_pattern()
pattern.align_panels(references)
# or
Design.align_panels(pattern, references)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pattern
|
Pattern
|
Pattern to modify the panels attributes. Technicaly the Pattern should match the current Design |
required |
references
|
dict
|
Dict of references positions like {"neck":(0,0,1), "bound_front":0}. Most likely Body.references |
required |
Source code in costumy/classes/design.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
|