diff --git a/markdown/dev/reference/api/path/attr/en.md b/markdown/dev/reference/api/path/attr/en.md index 23b363f167b..75d27b52763 100644 --- a/markdown/dev/reference/api/path/attr/en.md +++ b/markdown/dev/reference/api/path/attr/en.md @@ -5,15 +5,15 @@ title: Path.attr() This `Path.attr()` method can be used to add attributes to the Path object. It calls `this.attributes.add()` under the hood, and returns the Path object. -If the third parameter is set to `true` it will call `this.attributes.set()` +If the third parameter is set to `true` it will call `this.attributes.set()` instead, thereby overwriting the value of the attribute. ## Signature ```js Path path.attr( - string name, - mixed value, + string name, + mixed value, bool overwrite = false ) ``` @@ -34,7 +34,7 @@ Path path.attr( paths.example = new Path() .move(points.from) .curve(points.cp1, points.cp2, points.to) - .setClass("canvas") + .attr("class", "canvas") .setText("FreeSewing rocks", "text-xs center") return part @@ -45,7 +45,7 @@ Path path.attr( ## Notes -Methods like +Methods like [`Path.addClass`](/reference/api/path/addclass), [`Path.setClass`](/reference/api/path/setclass), [`Path.addText`](/reference/api/path/addtext), and diff --git a/markdown/dev/reference/api/path/length/en.md b/markdown/dev/reference/api/path/length/en.md index 7414a835647..c17901f7676 100644 --- a/markdown/dev/reference/api/path/length/en.md +++ b/markdown/dev/reference/api/path/length/en.md @@ -14,36 +14,29 @@ float path.length() ```js -({ Point, points, Path, paths, macro, part }) => { +({ Point, points, Path, paths, macro, utils, part }) => { points.A = new Point(45, 60) points.B = new Point(10, 30) points.BCp2 = new Point(40, 20) points.C = new Point(90, 30) points.CCp1 = new Point(50, -30) - - paths.example = new Path() + + paths.AB = new Path() .move(points.A) .line(points.B) + + paths.BC = new Path() + .move(points.B) .curve(points.BCp2, points.CCp1, points.C) - - macro("pd", { - path: paths.example, - d: -20 - }) - - macro("pd", { - path: new Path().move(points.B).line(points.A), - d: 10 - }) - - macro("pd", { - path: new Path().move(points.B).curve(points.BCp2, points.CCp1, points.C), - d: -10 - }) + + const lengthAB = paths.AB.length() + const lengthBC = paths.BC.length() + + paths.AB.addText(utils.round(lengthAB) + " mm") + paths.BC.addText(utils.round(lengthBC) + " mm") return part } ``` -