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_cylinder [2020/11/29 06:00] JSCAD Editor |
en:design_guide_cylinder [2022/04/13 06:54] (current) rozek included "require" statements |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ==== Cylinder ==== | ==== Cylinder ==== | ||
| - | A three dimensional shape with two flat ends that are circular. The cylinder has the same cross-section from one end to the other. | + | A three dimensional shape with two flat ends that are circular. The cylinder has the same cross-section from one end to the other, extending about the Z axis. |
| {{ : | {{ : | ||
| Line 7: | Line 7: | ||
| // | // | ||
| - | The ' | + | The '' |
| Defaults: | Defaults: | ||
| Line 16: | Line 16: | ||
| <code javascript> | <code javascript> | ||
| - | cylinder({r: 1, h: 10}) | + | const { cylinder } = require(' |
| - | cylinder({r: 1, h: 10, center: true}) // default: center: | + | |
| - | cylinder({r: | + | const myshape = cylinder({radius: 5, height: 10}) |
| - | cylinder({r: 1, h: 10, round: true}) | + | const myshape = cylinder({radius: 5, height: 10, center: [5, 5, 5], segments: 64}) |
| - | cylinder({r1: 3, r2: 0, h: 10}) | + | |
| - | cylinder({start: | + | |
| </ | </ | ||
| - | The CSG library functions | + | |
| + | === Elliptical Cylinder === | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | Various cylindrical shapes | ||
| + | |||
| + | Defaults: | ||
| + | * height : 2 | ||
| + | * startRadius : [1, 1] | ||
| + | * endRadius : [1, 1] | ||
| + | * center : [0, 0, 0] | ||
| + | * segments : 32 | ||
| + | * startAngle : 0 | ||
| + | * endAngle : PI * 2 | ||
| <code javascript> | <code javascript> | ||
| - | CSG.cylinder({ | + | const { cylinderElliptic } = require(' |
| - | start: [0, -1, 0], | + | |
| - | end: [0, 1, 0], | + | |
| - | radius: 1, | + | |
| - | resolution: 16 | + | |
| - | }); | + | |
| - | CSG.cylinder({ | + | const myshape = cylinderElliptic({height: 2, startRadius: [10, 5], endRadius: [8, 3]}) |
| - | start: [0, -1, 0], | + | </code> |
| - | end: [0, 1, 0], | + | |
| - | | + | === Rounded Cylinder === |
| - | | + | |
| - | | + | {{ :wiki:jscad-roundedCylinder.png? |
| - | }); | + | |
| + | Cylinders can be created with rounded ends by specifying '' | ||
| + | |||
| + | Defaults: | ||
| + | * radius | ||
| + | | ||
| + | * roundRadius: | ||
| + | * center : [0, 0, 0] | ||
| + | | ||
| + | |||
| + | <code javascript> | ||
| + | const { roundedCylinder | ||
| - | CSG.roundedCylinder({ | + | const myshape = roundedCylinder({radius: 5, height: 10, roundRadius: 0.5}) |
| - | start: [0, -1, 0], | + | const myshape = roundedCylinder({radius: |
| - | end: [0, 1, 0], | + | |
| - | radius: 1, | + | |
| - | resolution: 16 | + | |
| - | }); | + | |
| </ | </ | ||