meta data for this page
  •  

This is an old revision of the document!


Extrusions

Rectangular Extrude

 Extrude Rectangular

Extrude a rectangle (upright, perpendicular) along the outlines of the two dimensional shape.

The two dimensional shape is extruded to the height, upwards along the Z axis.

Note: The extrusion process uses Linear Extrude underneath, so the extrusion can be rotated twistAngle about the Z axis during the extrusion, creating twistSteps during the extrusion.

Defaults:

  • size: 1 (width of rectangle during extrusion)
  • height : 1
const myshape = extrudeRectangular({height: radiusZ * 2, size: 0.25}, shape1)
const myshape = extrudeRectangular({height: radiusZ * 2, size: 3, twistAngle: Math.PI / 2, twistSteps: 10}, shape2)

Rotate Extrude

 Extrude Rotate

Extrude a two dimensional shape in a rotation about the Z axis. The two dimensional shape can be placed anywhere to create various three dimensional shapes. The segments specify the number of segments to create per full rotation.

Defaults:

  • startAngle : 0
  • angle: PI * 2
  • overflow: 'cap' (cap the ends in order to create a solid)
  • segments: 12 (Note: Increasing the value of segments improves the overall shape.)
const myshape = extrudeRotate({segments: 64}, shape1)
const myshape = extrudeRotate({segments: 8, angle: Math.PI startAngle: 0}, shape3)

jag@development:~/dev/jscad/dataV1/pages$ cat design_guide_linear_extrude.txt

Linear Extrude

Extruding 2D shapes into 3D, given height, twist (degrees), and slices (if twist is made):

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: 10, center: true, twist: 360, slices: 50}, translate([2,0,0], square([1,2])) );
linear_extrude({ height: 10, center: true, twist: 360, slices: 50}, square([1,2]).translate([2,0,0]) );

Linear extrusion of 2D shape, with optional twist. The 2d shape is placed in in z=0 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=0) twiststeps determines the resolution of the twist (should be >= 1), returns a CSG object:

// CAG built in method
var c = CAG.circle({radius: 3});
extruded = c.extrude({offset: [0,0,10], twistangle: 360, twiststeps: 100});