Part
A Part
in FreeSewing holds all data, logic, and configuration of a Design.
Parts truly are the building blocks of FreeSewing as they not only provide
the configuration, but also a draft()
method that does the actual work
of drafting a parametric design.
Properties
A Part object comes with the following properties:
attributes
: An Attributes instance holding the part's attributeshidden
: When this istrue
the part will be hidden (excluding it from the output). See Part.hide(), Part.unhide(), and Part.setHidden() for various methods that allow setting this in a chainable way.name
: The name of the partpaths
: Holds the paths used in the partpoints
: Holds the points used in the partsnippets
: Holds the snippets used in the part
RELATED
See Using Attributes for information about custom Attributes that can be used with Parts.
Example
const part = {
name: 'example.part',
from: otherPart,
after: [ yetAnotherPart, oneMorePart ],
measurements: ['head', 'chest' ],
optionalMeasurements: ['neck'],
options: {
headEase: { pct: 12, min: 5, max: 20 }
}
hide: false,
hideAll: false,
hideDependencies: true,
plugins: [
plugin1,
plugin1,
[ plugin3, dataForPlugin3 ],
],
draft: ({ part }) => part
}
Methods
A Part object exposes the following methods:
- Part.asRenderProps()
- Part.attr()
- Part.getId()
- Part.hide()
- Part.setHidden()
- Part.shorthand()
- Part.unhide()
- Part.units()
More information
Click below to learn more about: