-
Notifications
You must be signed in to change notification settings - Fork 0
2D Primitives
- 1
circle-new element created -
a 2D drawing primitive that creates a circle that may be extruded to create other 3D structures. e.g
$scad->circle("circle",{r=>5}); - 2
square-new element created -
a 2D drawing primitive that creates a rectangle that may be extruded to create other 3D structures. e.g
$scad->square("square",[10,10]);. Rectangles may be created using the same method, but squares may also be created using$scad->square("square",5); - 3
polygonnew element created -
a 2D drawing primitive that creates a polygon that may be extruded to create other 3D structures. The easiest way to do it in Perl is to create an arrayref of points. and pass that as a parameter. an example of this is the gear.pl in Examples. The linear_extrude option below also provides an example using SCAD variables. A simple solution making a filled line chart is shown below :-
# create a Filled Line Chart from values my @values=(10,30,15,40,35,45,40,35,10); my $separation =10; my $start=[0,0];my $count=0; # starting corner of chart my $points=[$start]; # add points to be plotted as a line graph push @$points, [$separation*$count++,$_] foreach @values; # add end corner push @$points, [$separation*(--$count),$start->[1]]; my $chart=new SCAD; $chart->polygon("chart",$points) ->build("