User Tools


Differences

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

Link to this comparison view

design_guide_linear_extrude [2018/03/08 13:16] (current)
z3dev created
Line 1: Line 1:
 +==== Linear Extrude ====
  
 +Extruding 2D shapes into 3D, given height, twist (degrees), and slices (if twist is made):
 +
 +<code javascript>​
 +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]) );
 +</​code>​
 +
 +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:
 +
 +<code javascript>​
 +// CAG built in method
 +var c = CAG.circle({radius:​ 3});
 +extruded = c.extrude({offset:​ [0,0,10], twistangle: 360, twiststeps: 100});
 +</​code>​