diff options
author | Thomas Kremer <-> | 2024-07-06 21:39:29 +0200 |
---|---|---|
committer | Thomas Kremer <-> | 2024-07-06 21:39:29 +0200 |
commit | d841a8decf392ffd9db96ae770dc40bac952e5e8 (patch) | |
tree | d652b7c35dfd25057d75ec4fe4bc92bea279315c | |
parent | 7b518529903ed4976b97868d8d7061737e0f5b73 (diff) |
dxf2camm.pl: added option "--speed".
-rw-r--r-- | CAMM.pm | 5 | ||||
-rwxr-xr-x | dxf2camm.pl | 6 |
2 files changed, 7 insertions, 4 deletions
@@ -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)); |