diff --git a/markdown/dev/tutorials/pattern-design/adding-measurements/en.md b/markdown/dev/tutorials/pattern-design/adding-measurements/en.md index 6b0cacc85c7..111bf2da04b 100644 --- a/markdown/dev/tutorials/pattern-design/adding-measurements/en.md +++ b/markdown/dev/tutorials/pattern-design/adding-measurements/en.md @@ -16,27 +16,26 @@ So let's add it as a required measurement. ## Adding required measurements -In our `bib.mjs` file, on the `bib` object, there is a key called +In our `design/src/bib.mjs` file, on the `bib` object, there is a key called `measurements` (line 121) that will hold a list (an array) of all required measurements for this part. -We are going to use *the official name* of the measurement. For head +We are going to use [*the official name* of the measurement](/reference/measurements). For head circumference, that name is `head`. ```design/src/bib.mjs function draftBib({ part }) { - return part } export const bib = { name: 'tutorial.bib', - draft: draftBib,[], + draft: draftBib, from: false, hide: { - self: false, - from: false, - after: false + self: false, + from: false, + after: false }, options: {}, // start-highlight diff --git a/markdown/dev/tutorials/pattern-design/adding-options/en.md b/markdown/dev/tutorials/pattern-design/adding-options/en.md index 314805f9cae..284732aa7ce 100644 --- a/markdown/dev/tutorials/pattern-design/adding-options/en.md +++ b/markdown/dev/tutorials/pattern-design/adding-options/en.md @@ -31,12 +31,12 @@ function draftBib({ part }) { export const bib = { name: 'tutorial.bib', - draft: draftBib,[], + draft: draftBib, from: false, hide: { - self: false, - from: false, - after: false + self: false, + from: false, + after: false }, // highlight-start options: { diff --git a/markdown/dev/tutorials/pattern-design/avoiding-overlap/en.md b/markdown/dev/tutorials/pattern-design/avoiding-overlap/en.md index b1762043339..4942b78726c 100644 --- a/markdown/dev/tutorials/pattern-design/avoiding-overlap/en.md +++ b/markdown/dev/tutorials/pattern-design/avoiding-overlap/en.md @@ -3,8 +3,8 @@ title: Avoiding overlap order: 220 --- -While we've only drawn the end of one strap, it's pretty obvious they overlap. -Which is a big no-no in sewing patterns, so we're going to have to address +While we've only drawn the end of one strap, it's pretty obvious they overlap, +which makes it impossible to cut out, so we're going to have to address that. Specifically, we're going to rotate our strap out of the way until it no longer overlaps. @@ -14,7 +14,7 @@ to rotate. Once we have our list of points to rotate, we can rotate them. How far? Until the strap no longer overlaps. -```js +```design/src/bib.mjs function draftBib({ Path, Point, @@ -31,18 +31,18 @@ function draftBib({ let target = (measurements.head * options.neckRatio) /4 let delta do { - points.right = new Point(tweak * measurements.head / 10, 0) - points.bottom = new Point(0, tweak * measurements.head / 12) + points.right = new Point(tweak * measurements.head / 10, 0) + points.bottom = new Point(0, tweak * measurements.head / 12) - points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) - points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) + points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) + points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) - paths.quarterNeck = new Path() - .move(points.right) - .curve(points.rightCp1, points.bottomCp2, points.bottom) + paths.quarterNeck = new Path() + .move(points.right) + .curve(points.rightCp1, points.bottomCp2, points.bottom) .hide() // Add this line - delta = paths.quarterNeck.length() - target + delta = paths.quarterNeck.length() - target if (delta > 0) tweak = tweak * 0.99 else tweak = tweak * 1.02 } while (Math.abs(delta) > 1) diff --git a/markdown/dev/tutorials/pattern-design/completing-our-pattern/en.md b/markdown/dev/tutorials/pattern-design/completing-our-pattern/en.md index d1e9daa01b2..6e2eb5f0ffd 100644 --- a/markdown/dev/tutorials/pattern-design/completing-our-pattern/en.md +++ b/markdown/dev/tutorials/pattern-design/completing-our-pattern/en.md @@ -22,7 +22,7 @@ is *truthy*. To access the setting, we can destructure it: -```mjs +```design/src/bib.mjs function draftBib({ Path, Point, @@ -58,20 +58,22 @@ To use them, much like points and paths, we need to destructure both the `Snippet` constructor as well as the `snippets` object to hold our snippets: -```mjs +```design/src/bib.mjs function draftBib({ Path, Point, + //hightlight-start + Snippet, + //highlight-end paths, points, + // highlight-start + snippets, + // highlight-end measurements, options, macro, complete, - // highlight-start - Snippet, - snippets, - // highlight-end part, }) { @@ -97,20 +99,18 @@ You can find all possible snippets in [our documentation](/reference/api/snippet Let's put this and few other things together to complete our design: -```js +```design/src/bib.mjs function draftBib({ Path, Point, + Snippet, paths, points, + snippets, measurements, options, macro, - // highlight-start complete, - snippets, - Snippet, - // highlight-end part, }) { @@ -119,18 +119,18 @@ function draftBib({ let target = (measurements.head * options.neckRatio) /4 let delta do { - points.right = new Point(tweak * measurements.head / 10, 0) - points.bottom = new Point(0, tweak * measurements.head / 12) + points.right = new Point(tweak * measurements.head / 10, 0) + points.bottom = new Point(0, tweak * measurements.head / 12) - points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) - points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) + points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) + points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) - paths.quarterNeck = new Path() - .move(points.right) - .curve(points.rightCp1, points.bottomCp2, points.bottom) + paths.quarterNeck = new Path() + .move(points.right) + .curve(points.rightCp1, points.bottomCp2, points.bottom) .hide() // Add this line - delta = paths.quarterNeck.length() - target + delta = paths.quarterNeck.length() - target if (delta > 0) tweak = tweak * 0.99 else tweak = tweak * 1.02 } while (Math.abs(delta) > 1) diff --git a/markdown/dev/tutorials/pattern-design/completing-the-neck-opening/en.md b/markdown/dev/tutorials/pattern-design/completing-the-neck-opening/en.md index e268194d357..48f03a7856d 100644 --- a/markdown/dev/tutorials/pattern-design/completing-the-neck-opening/en.md +++ b/markdown/dev/tutorials/pattern-design/completing-the-neck-opening/en.md @@ -14,7 +14,7 @@ as it is, and simply chose to not show it. To accomplish this, we'll call the `hide()` method on our path: -```js +```design/src/bib.mjs function draftBib({ Path, Point, @@ -30,20 +30,20 @@ function draftBib({ let target = (measurements.head * options.neckRatio) /4 let delta do { - points.right = new Point(tweak * measurements.head / 10, 0) - points.bottom = new Point(0, tweak * measurements.head / 12) + points.right = new Point(tweak * measurements.head / 10, 0) + points.bottom = new Point(0, tweak * measurements.head / 12) - points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) - points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) + points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) + points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) - paths.quarterNeck = new Path() - .move(points.right) - .curve(points.rightCp1, points.bottomCp2, points.bottom) + paths.quarterNeck = new Path() + .move(points.right) + .curve(points.rightCp1, points.bottomCp2, points.bottom) // highlight-start .hide() // highlight-end - delta = paths.quarterNeck.length() - target + delta = paths.quarterNeck.length() - target if (delta > 0) tweak = tweak * 0.99 else tweak = tweak * 1.02 } while (Math.abs(delta) > 1) @@ -68,7 +68,7 @@ Let's add some more points, and then construct the complete path for the neck opening. -```js +```design/src/bib.mjs function draftBib({ Path, Point, @@ -84,18 +84,18 @@ function draftBib({ let target = (measurements.head * options.neckRatio) /4 let delta do { - points.right = new Point(tweak * measurements.head / 10, 0) - points.bottom = new Point(0, tweak * measurements.head / 12) + points.right = new Point(tweak * measurements.head / 10, 0) + points.bottom = new Point(0, tweak * measurements.head / 12) - points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) - points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) + points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) + points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) - paths.quarterNeck = new Path() - .move(points.right) - .curve(points.rightCp1, points.bottomCp2, points.bottom) + paths.quarterNeck = new Path() + .move(points.right) + .curve(points.rightCp1, points.bottomCp2, points.bottom) .hide() - delta = paths.quarterNeck.length() - target + delta = paths.quarterNeck.length() - target if (delta > 0) tweak = tweak * 0.99 else tweak = tweak * 1.02 } while (Math.abs(delta) > 1) diff --git a/markdown/dev/tutorials/pattern-design/creating-the-closure/en.md b/markdown/dev/tutorials/pattern-design/creating-the-closure/en.md index 72e6ae8a3cd..704327e0f11 100644 --- a/markdown/dev/tutorials/pattern-design/creating-the-closure/en.md +++ b/markdown/dev/tutorials/pattern-design/creating-the-closure/en.md @@ -27,7 +27,7 @@ Like our neck opening, we've only drawn half since we can simply copy the points to the other side. -```js +```design/src/bib.mjs function draftBib({ Path, Point, @@ -46,18 +46,18 @@ function draftBib({ let target = (measurements.head * options.neckRatio) /4 let delta do { - points.right = new Point(tweak * measurements.head / 10, 0) - points.bottom = new Point(0, tweak * measurements.head / 12) + points.right = new Point(tweak * measurements.head / 10, 0) + points.bottom = new Point(0, tweak * measurements.head / 12) - points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) - points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) + points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) + points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) - paths.quarterNeck = new Path() - .move(points.right) - .curve(points.rightCp1, points.bottomCp2, points.bottom) + paths.quarterNeck = new Path() + .move(points.right) + .curve(points.rightCp1, points.bottomCp2, points.bottom) .hide() // Add this line - delta = paths.quarterNeck.length() - target + delta = paths.quarterNeck.length() - target if (delta > 0) tweak = tweak * 0.99 else tweak = tweak * 1.02 } while (Math.abs(delta) > 1) diff --git a/markdown/dev/tutorials/pattern-design/draft-method/en.md b/markdown/dev/tutorials/pattern-design/draft-method/en.md index cd96fe91c2f..6a7453e2783 100644 --- a/markdown/dev/tutorials/pattern-design/draft-method/en.md +++ b/markdown/dev/tutorials/pattern-design/draft-method/en.md @@ -4,12 +4,52 @@ order: 150 --- Time to turn our attention to the draft method of our part. -Inside our `design/src/bib.js` file, this is what it currently looks like: +Inside our `design/src/bib.mjs` file, this is what it currently looks like: ```design/src/bib.mjs -function draftBib({ part +function draftBib ({ + // Uncomment below to destructure what you need + /* + * Content constructors + */ + //Path, // A Path constructor to create new paths + //Point, // A Point constructor to create new points + //Snippet, // A Snippet constructor to create new snippets + /* + * Content constainers + */ + //paths, // Add a Path to your part by adding it to this object + //points, // Add a Points to your part by adding it to this object + //snippets, // Add a Snippet to your part by adding it to this object + /* + * Access to settings + */ + //absoluteOptions, // Access to settings.absoluteOptions + //complete, // Access to settings.complete + //measurements, // Access to settings.measurements + //options, // Access to settings.options + //paperless, // Access to settings.paperless + //sa, // Access to settings.sa + //scale, // Access to settings.scale + /* + * Access to utilities + */ + //getId, //See the getId documentation + //hide, //See the hide documentation + //log, //See the logging documentation + //macro, //See the macros documentation + //setHidden, //See the setHidden documentation + //store, //See the store documentation + //unhide, //See the unhide documentation + //units, //See the units documentation + ///utils, //See the utils documentation + /* + * Return value + */ + part, // Your draft method must return this }) { + // Work your magic here return part } ``` diff --git a/markdown/dev/tutorials/pattern-design/drawing-the-straps/en.md b/markdown/dev/tutorials/pattern-design/drawing-the-straps/en.md index 701d02374a7..35a7682f973 100644 --- a/markdown/dev/tutorials/pattern-design/drawing-the-straps/en.md +++ b/markdown/dev/tutorials/pattern-design/drawing-the-straps/en.md @@ -15,7 +15,7 @@ path. As it happens, that is the default behaviour, so we merely have to remove it's `hidden: false` property. -```js +```design/src/bib.mjs function draftBib({ Path, Point, @@ -32,18 +32,18 @@ function draftBib({ let target = (measurements.head * options.neckRatio) /4 let delta do { - points.right = new Point(tweak * measurements.head / 10, 0) - points.bottom = new Point(0, tweak * measurements.head / 12) + points.right = new Point(tweak * measurements.head / 10, 0) + points.bottom = new Point(0, tweak * measurements.head / 12) - points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) - points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) + points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) + points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) - paths.quarterNeck = new Path() - .move(points.right) - .curve(points.rightCp1, points.bottomCp2, points.bottom) + paths.quarterNeck = new Path() + .move(points.right) + .curve(points.rightCp1, points.bottomCp2, points.bottom) .hide() // Add this line - delta = paths.quarterNeck.length() - target + delta = paths.quarterNeck.length() - target if (delta > 0) tweak = tweak * 0.99 else tweak = tweak * 1.02 } while (Math.abs(delta) > 1) diff --git a/markdown/dev/tutorials/pattern-design/en.md b/markdown/dev/tutorials/pattern-design/en.md index 38408869c31..3c454537ca0 100644 --- a/markdown/dev/tutorials/pattern-design/en.md +++ b/markdown/dev/tutorials/pattern-design/en.md @@ -21,7 +21,7 @@ At the end of this tutorial, we will have created this pattern: -```js +```design/src/bib.mjs function draftBib({ Path, Point, @@ -41,18 +41,18 @@ function draftBib({ let target = (measurements.head * options.neckRatio) /4 let delta do { - points.right = new Point(tweak * measurements.head / 10, 0) - points.bottom = new Point(0, tweak * measurements.head / 12) + points.right = new Point(tweak * measurements.head / 10, 0) + points.bottom = new Point(0, tweak * measurements.head / 12) - points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) - points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) + points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) + points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) - paths.quarterNeck = new Path() - .move(points.right) - .curve(points.rightCp1, points.bottomCp2, points.bottom) + paths.quarterNeck = new Path() + .move(points.right) + .curve(points.rightCp1, points.bottomCp2, points.bottom) .hide() // Add this line - delta = paths.quarterNeck.length() - target + delta = paths.quarterNeck.length() - target if (delta > 0) tweak = tweak * 0.99 else tweak = tweak * 1.02 } while (Math.abs(delta) > 1) diff --git a/markdown/dev/tutorials/pattern-design/fitting-the-neck-opening/en.md b/markdown/dev/tutorials/pattern-design/fitting-the-neck-opening/en.md index 027e1451469..26eafa5e768 100644 --- a/markdown/dev/tutorials/pattern-design/fitting-the-neck-opening/en.md +++ b/markdown/dev/tutorials/pattern-design/fitting-the-neck-opening/en.md @@ -8,7 +8,7 @@ going to make sure it is. Here's how we'll make sure the neck opening is _just right_: -```js +```design/src/bib.mjs function draftBib({ Path, Point, @@ -26,18 +26,18 @@ function draftBib({ let delta do { // highlight-end - points.right = new Point(tweak * measurements.head / 10, 0) - points.bottom = new Point(0, tweak * measurements.head / 12) + points.right = new Point(tweak * measurements.head / 10, 0) + points.bottom = new Point(0, tweak * measurements.head / 12) - points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) - points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) + points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) + points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) - paths.quarterNeck = new Path() - .move(points.right) - .curve(points.rightCp1, points.bottomCp2, points.bottom) + paths.quarterNeck = new Path() + .move(points.right) + .curve(points.rightCp1, points.bottomCp2, points.bottom) // highlight-start - delta = paths.quarterNeck.length() - target + delta = paths.quarterNeck.length() - target if (delta > 0) tweak = tweak * 0.99 else tweak = tweak * 1.02 } while (Math.abs(delta) > 1) diff --git a/markdown/dev/tutorials/pattern-design/our-first-part/en.md b/markdown/dev/tutorials/pattern-design/our-first-part/en.md index b45e6e5fe88..07b34b28689 100644 --- a/markdown/dev/tutorials/pattern-design/our-first-part/en.md +++ b/markdown/dev/tutorials/pattern-design/our-first-part/en.md @@ -17,25 +17,25 @@ and approachable code base. The previous step has already set everything up for us. Our design's main file lives in `design/src/index.mjs`, and our part lives in `design/src/bib.mjs`. -This `bib.mjs` is where we'll do all our work. The file includes a basic guide on how to use it. We removed it for clarity in our example. It currently looks like this: +This `bib.mjs` is where we'll do all our work. The file includes a comments to guide you on how to use it. We removed those for clarity in our example. It currently looks like this: ```design/src/bib.mjs function draftBib ({ part, // Your draft method must return this }) { - // Work your magic here + // Work your magic here return part } export const bib = { - + name: 'tutorial.bib', draft: draftBib,[], from: false, hide: { - self: false, - from: false, - after: false + self: false, + from: false, + after: false }, options: {}, measurements: [], diff --git a/markdown/dev/tutorials/pattern-design/paperless/en.md b/markdown/dev/tutorials/pattern-design/paperless/en.md index e281027576b..f96956f3134 100644 --- a/markdown/dev/tutorials/pattern-design/paperless/en.md +++ b/markdown/dev/tutorials/pattern-design/paperless/en.md @@ -43,7 +43,7 @@ Refer to [the list of macros](/reference/macros/) for more details. -```js +```design/src/bib.mjs function draftBib({ Path, Point, @@ -66,18 +66,18 @@ function draftBib({ let target = (measurements.head * options.neckRatio) /4 let delta do { - points.right = new Point(tweak * measurements.head / 10, 0) - points.bottom = new Point(0, tweak * measurements.head / 12) + points.right = new Point(tweak * measurements.head / 10, 0) + points.bottom = new Point(0, tweak * measurements.head / 12) - points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) - points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) + points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) + points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) - paths.quarterNeck = new Path() - .move(points.right) - .curve(points.rightCp1, points.bottomCp2, points.bottom) + paths.quarterNeck = new Path() + .move(points.right) + .curve(points.rightCp1, points.bottomCp2, points.bottom) .hide() // Add this line - delta = paths.quarterNeck.length() - target + delta = paths.quarterNeck.length() - target if (delta > 0) tweak = tweak * 0.99 else tweak = tweak * 1.02 } while (Math.abs(delta) > 1) diff --git a/markdown/dev/tutorials/pattern-design/rounding-the-corners/en.md b/markdown/dev/tutorials/pattern-design/rounding-the-corners/en.md index 02febd44470..24dabefcf2f 100644 --- a/markdown/dev/tutorials/pattern-design/rounding-the-corners/en.md +++ b/markdown/dev/tutorials/pattern-design/rounding-the-corners/en.md @@ -9,7 +9,7 @@ With our corners rounded, we should also update our path. Fortunately, we merely have to update the start of it. -```js +```design/src/bib.mjs function draftBib({ Path, Point, @@ -26,18 +26,18 @@ function draftBib({ let target = (measurements.head * options.neckRatio) /4 let delta do { - points.right = new Point(tweak * measurements.head / 10, 0) - points.bottom = new Point(0, tweak * measurements.head / 12) + points.right = new Point(tweak * measurements.head / 10, 0) + points.bottom = new Point(0, tweak * measurements.head / 12) - points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) - points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) + points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) + points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) - paths.quarterNeck = new Path() - .move(points.right) - .curve(points.rightCp1, points.bottomCp2, points.bottom) + paths.quarterNeck = new Path() + .move(points.right) + .curve(points.rightCp1, points.bottomCp2, points.bottom) .hide() // Add this line - delta = paths.quarterNeck.length() - target + delta = paths.quarterNeck.length() - target if (delta > 0) tweak = tweak * 0.99 else tweak = tweak * 1.02 } while (Math.abs(delta) > 1) @@ -217,7 +217,6 @@ function draftBib({ .close() .addClass("fabric") - return part } ``` diff --git a/markdown/dev/tutorials/pattern-design/shaping-the-straps/en.md b/markdown/dev/tutorials/pattern-design/shaping-the-straps/en.md index 9307c404528..5a53920f769 100644 --- a/markdown/dev/tutorials/pattern-design/shaping-the-straps/en.md +++ b/markdown/dev/tutorials/pattern-design/shaping-the-straps/en.md @@ -17,7 +17,7 @@ As always, [the API docs](/reference/api/point/) have all the details. -```js +```design/src/bib.mjs function draftBib({ Path, Point, @@ -33,18 +33,18 @@ function draftBib({ let target = (measurements.head * options.neckRatio) /4 let delta do { - points.right = new Point(tweak * measurements.head / 10, 0) - points.bottom = new Point(0, tweak * measurements.head / 12) + points.right = new Point(tweak * measurements.head / 10, 0) + points.bottom = new Point(0, tweak * measurements.head / 12) - points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) - points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) + points.rightCp1 = points.right.shift(90, points.bottom.dy(points.right)/2) + points.bottomCp2 = points.bottom.shift(0, points.bottom.dx(points.right)/2) - paths.quarterNeck = new Path() - .move(points.right) - .curve(points.rightCp1, points.bottomCp2, points.bottom) + paths.quarterNeck = new Path() + .move(points.right) + .curve(points.rightCp1, points.bottomCp2, points.bottom) .hide() // Add this line - delta = paths.quarterNeck.length() - target + delta = paths.quarterNeck.length() - target if (delta > 0) tweak = tweak * 0.99 else tweak = tweak * 1.02 } while (Math.abs(delta) > 1)