# $ctx->{Loc}{$id}{X}
# $ctx->{Loc}{$id}{Y}
# $ctx->{Loc}{$id}{A}
+# $ctx->{Loc}{$id}{H}
# $ctx->{Loc}{$id}{LayerKind}
# $ctx->{Trans}{X} # transformation. is ev representing
# $ctx->{Trans}{Y} # new origin. (is applied at _input_
# $ctx->{SavedSegment} # exists iff segment command used, is a $csss
# $ctx->{Layer}{Level}
# $ctx->{Layer}{Kind}
+# $ctx->{HeightLayer}{$hl}= $height
#
# $objs{$id}{CmdLog}
# $objs{$id}{Loc}
return ($min_x, $max_x, $min_y, $max_y);
}
-our %units_len= qw(- mm mm 1 cm 10 m 1000);
+our %units_len= qw(- mm um 0.001 mm 1 cm 10 m 1000);
our %units_ang= qw(- d r 1); $units_ang{'d'}= 2*$pi / 360;
sub cva_len ($) { my ($sp)=@_; cva_units($sp,\%units_len); }
sub cva_identity ($) { my ($sp)=@_; $sp; }
sub cva_ang ($) { my ($sp)=@_; cva_units($sp,\%units_ang); }
sub cva_absang ($) { input_absang(cva_ang($_[0])) }
+sub cva_height ($) {
+ my ($sp)=@_;
+ my $offset= 0;
+ if ($sp =~ s/^([a-z]+)([-+])/$2/i) {
+ die unless exists $ctx->{HeightLayer}{$1};
+ $offset= $ctx->{HeightLayer}{$1};
+ }
+ return $offset + cva_units($sp, \%units_len);
+}
+sub cvd_height () { return undef; }
sub cva_units ($$) {
my ($sp,$ua)=@_;
my ($n,$u,$r);
$i->{X}= can(\&cva_len);
$i->{Y}= can(\&cva_len);
$i->{A}= can(\&cva_ang);
+ $i->{H}= canf(\&cva_height, \&cvd_height);
ev_compose($nl, $ctx->{Trans}, $i);
}
sub cmd_rel {
- my ($from,$to,$len,$right,$turn);
+ my ($from,$to,$len,$right,$turn,$height,$base);
$from= can(\&cva_idex);
$to= can(\&cva_idnew);
+ if (@al && $al[0] =~ s/^\^//) {
+ if ($al[0] =~ m/^[a-z]/ || $al[0] =~ s/^0([-+])/$1/) {
+ $base= 0;
+ } else {
+ $base= $from->{H};
+ defined $base or die "relative height but no height defined";
+ }
+ $height= $base + can(\&cva_height);
+ }
$len= cano(\&cva_len,0);
$right= cano(\&cva_len,0) * $ctx->{Trans}{R};
$turn= cano(\&cva_ang, 0) * $ctx->{Trans}{R};
my ($u)= ev_compose({}, $from, { X => $len, Y => -$right, A => 0 });
ev_compose($to, $u, { X => 0, Y => 0, A => $turn });
+ $to->{H}= $height;
}
sub dv__evreff ($) {