meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:design_guide_linear_extrude [2020/11/28 03:25]
JSCAD Editor
en:design_guide_linear_extrude [2022/05/02 08:02] (current)
JSCAD Editor
Line 1: Line 1:
 ==== Linear Extrude ==== ==== Linear Extrude ====
  
-Extruding 2D shapes into 3D, given height, twist (degrees), and slices (if twist is made):+{{ :wiki:jscad-extrudelinear.png?nolink | Extrude Linear}}
  
-<code javascript> +Extrude a two dimensional shape in an upward linear direction.
-linear_extrude({ height: 10 }, square()); +
-linear_extrude({ height: 10, twist: 90 }, square([1,2])); +
-linear_extrude({ height: 10, twist: 360, slices: 50}, circle().translate([1,0,0]) );+
  
-linear_extrude({ height: 10center: truetwist: 360, slices: 50}, translate([2,0,0], square([1,2])) ); +The two dimensional shape is extruded to the ''height''upwards along the Z axis. The two dimensional shape is be rotated ''twistAngle'' about the Z axis during the extrusioncreating ''twistSteps'' during the extrusion.
-linear_extrude({ height: 10, center: true, twist: 360, slices: 50}, square([1,2]).translate([2,0,0]) ); +
-</code>+
  
-Linear extrusion of 2D shape, with optional twist. The 2d shape is placed in in z=plane and extruded into direction offset (a CSG.Vector3D). The final face is rotated twistangle degrees. Rotation is done around the origin of the 2D shape (i.e. x=0, y=0twiststeps determines the resolution of the twist (should be >= 1), returns a CSG object:+//Note: The two dimensional shape can be placed anywhere to create various twisted shapes.// 
 + 
 +Defaults: 
 +  * height : 1 
 +  * twist : 0 
 +  * twistSteps : 1 (Note: Increasing the value of twistSteps improves the overall shape.)
  
 <code javascript> <code javascript>
-// CAG built in method +const { extrudeLinear } = require('@jscad/modeling').extrusions 
-var c CAG.circle({radius3}); + 
-extruded c.extrude({offset[0,0,10], twistangle360twiststeps100});+const myshape extrudeLinear({heightradiusZ * 2}, shape1
 +const myshape extrudeLinear({heightradiusZ * 2twistAngleMath.PI / 2twistSteps10}, shape2)
 </code> </code>