meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:design_guide_path [2021/05/12 08:24] JSCAD Editor |
en:design_guide_path [2022/04/13 12:44] (current) rozek included "require" statements, corrected mistakes |
||
---|---|---|---|
Line 4: | Line 4: | ||
<code javascript> | <code javascript> | ||
+ | const { line } = require(' | ||
+ | const { path2 } = require(' | ||
+ | |||
const mypathA = line([[10, 10], [-10, 10]]) | const mypathA = line([[10, 10], [-10, 10]]) | ||
const mypathB = line([[-10, -10], [10, -10]]) | const mypathB = line([[-10, -10], [10, -10]]) | ||
Line 34: | Line 37: | ||
<code javascript> | <code javascript> | ||
+ | const { arc } = require(' | ||
+ | |||
const mypath = arc({radius: | const mypath = arc({radius: | ||
const mypath = arc({center: | const mypath = arc({center: | ||
Line 43: | Line 48: | ||
<code javascript> | <code javascript> | ||
+ | const { path2 } = require(' | ||
+ | const { line } = require(' | ||
+ | |||
const mypath = line([[27, -22], [27, 22]]) | const mypath = line([[27, -22], [27, 22]]) | ||
const newpath = path2.appendPoints([[-27, | const newpath = path2.appendPoints([[-27, | ||
Line 58: | Line 66: | ||
<code javascript> | <code javascript> | ||
- | let p5 = path2.create({}, [[10, | + | const { path2 } = require(' |
- | p5 = path2.appendBezier({controlPoints: | + | |
- | p5 = path2.appendBezier({controlPoints: [null, [25,-30],[40,-30], | + | let p1 = path2.create([[10, |
+ | p1 = path2.appendPoints([[27.5,-3.28125]], p1) | ||
+ | p1 = path2.appendArc({endpoint: [12.5, -22.96875], radius: | ||
</ | </ | ||
Line 70: | Line 80: | ||
<code javascript> | <code javascript> | ||
- | let p5 = path2.create({}, [[10, | + | const { path2 } = require(' |
- | p5 = path2.appendBezier({controlPoints: | + | |
+ | let p5 = path2.create([[10, | ||
+ | p5 = path2.appendBezier({controlPoints: | ||
p5 = path2.appendBezier({controlPoints: | p5 = path2.appendBezier({controlPoints: | ||
</ | </ | ||
Line 82: | Line 94: | ||
<code javascript> | <code javascript> | ||
+ | const { geom2, path2 } = require(' | ||
+ | const { line } = require(' | ||
+ | |||
// create a closed path in shape of triangle | // create a closed path in shape of triangle | ||
const mypath = line([[10, 10], [-10, 10], [-10, -10], [10, 10]]) | const mypath = line([[10, 10], [-10, 10], [-10, -10], [10, 10]]) | ||
Line 91: | Line 106: | ||
<code javascript> | <code javascript> | ||
// create an open path in shape of L | // create an open path in shape of L | ||
+ | const { expand } = require(' | ||
+ | const { line } = require(' | ||
+ | |||
const mypath = line([[10, 10], [-10, 10], [-10, -10]]) | const mypath = line([[10, 10], [-10, 10], [-10, -10]]) | ||
const myshape = expand({delta: | const myshape = expand({delta: | ||
Line 97: | Line 115: | ||
=== Conversion to 3D Shape === | === Conversion to 3D Shape === | ||
- | Hint: Any two dimensional | + | Two dimensional |
+ | |||
+ | <code javascript> | ||
+ | const { path2 } = require(' | ||
+ | const { extrudeLinear } = require(' | ||
+ | |||
+ | // create a closed path in shape of triangle | ||
+ | const mypath = path2.fromPoints({ closed: true }, [[0, 0], [12, 0], [6, 10]]) | ||
+ | // extrude into triangular prism | ||
+ | const myshape = extrudeLinear({ height: 15 }, mypath) | ||
+ | </ |