summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CAMM.pm5
-rwxr-xr-xdxf2camm.pl6
2 files changed, 7 insertions, 4 deletions
diff --git a/CAMM.pm b/CAMM.pm
index 5b79c7b..49027c4 100644
--- a/CAMM.pm
+++ b/CAMM.pm
@@ -188,7 +188,7 @@ BEGIN {
# local $CAMM::Commands::escape_char = $c;
# $self->emit(CAMM::Commands::set_escape_char($c));
# }
-
+
# getters, setters.
for my $name (keys %setters) {
my $sub = sub {
@@ -319,7 +319,7 @@ sub content {
# $polyline = ["open"|"closed",[point,...]]
# options:
# boolean: header, footer, headerfooter, relative
-# float: epsilon, offset, shortline, smallangle
+# float: epsilon, offset, shortline, smallangle, speed
sub from_polylines {
my $self = shift;
@@ -328,6 +328,7 @@ sub from_polylines {
my ($paths,%options) = @_;
@options{qw(header footer)} = (1,1) if $options{headerfooter};
$self->header() if $options{header};
+ $self->set_speed($options{speed}) if defined $options{speed};
my $eps = $options{epsilon}//0.00001;
# since the knife follows the machine's current (pen) position by an offset,
# we need to keep track of the knife's position as well as the pen position.
diff --git a/dxf2camm.pl b/dxf2camm.pl
index 8659dde..ff006da 100755
--- a/dxf2camm.pl
+++ b/dxf2camm.pl
@@ -832,10 +832,11 @@ sub usage {
translate => "Translate everything to this point (\"x,y\")",
scale => "Scale everything by this factor",
sort => "Sort order: /(left|bottom|right|top)(|-asc|-desc)|box/, comma-separated",
+ speed => "speed in mm/s (defaults to 300mm/s).",
help => "Show this help screen.",
);
-@opts = qw(output|o=s offset|off=f offsetless_start! bbox=f ignore_bbox! align_knife! overlap=f raw! relative! epsilon=f shortline=f smallangle=f coarsify=f combine! combine_cycles|cycles! combine_reverse|reverse! translate=s scale=f sort=s help|h|?);
+@opts = qw(output|o=s offset|off=f offsetless_start! bbox=f ignore_bbox! align_knife! overlap=f raw! relative! epsilon=f shortline=f smallangle=f coarsify=f combine! combine_cycles|cycles! combine_reverse|reverse! translate=s scale=f sort=s speed=f help|h|?);
GetOptions(\%opts,@opts) or usage(2);
@@ -844,6 +845,7 @@ usage(2) if @ARGV > 1;
$opts{headerfooter} = !$opts{raw};
$opts{offset} *= CAMM::units_per_mm if defined $opts{offset};
$opts{shortline} *= CAMM::units_per_mm if defined $opts{shortline};
+$opts{speed} /= 10 if defined $opts{speed};
$opts{translate} = [split /,/,$opts{translate}] if defined $opts{translate};
# we don't want the bbox to cause negative coordinates.
@@ -877,7 +879,7 @@ for (@$paths) { # a path
}
# We shift everything to [offset,offset] based on bounding box now, since cutting negative coordinates isn't possible anyway.
-# TODO: make option to not translate according to bbox.
+# DONE: make option to not translate according to bbox.
my $input_bbox = $opts{ignore_bbox} ? [0,0,0,0] : bbox_union(compute_bboxes($paths));