OK, there may be other ways to do it, but this works
%<\AcDiesel $(substr,$(getvar,dwgname),1, 4)>%
the last two numbers (the 1 & 4) determine where to start (character 1 of the name in this case) and how many characters to show (4 characters in this case).
Might work for you.