The code appears to work as expected, however, I might suggest several things to make it better ...
First there are several things you should do to improve the code:
block all the setq's into one call like so
(setq wl (cdr (assoc 8 (entget (car pt))))
DS (Atof DZ)
WT (DISTANCE PT1 PT2)
SW (- DS f)
ANG2 (ANGLE PT1 PT2)
PT3 (POLAR PT1 ANG1 DS)
PT4 (POLAR PT3 ANG2 WT)
ANG3 (ANGLE PT3 PT1)
PL2 (POLAR PT1 ANG1 a)
PL3 (POLAR PL2 ANG2 b)
PL4 (POLAR PL3 ANG3 c)
PL5 (POLAR PL4 ANG2 d)
PL6 (POLAR PL5 ANG3 e)
PT5 (POLAR PT1 ANG1 (/ DS 2))
PT6 (POLAR PT5 ANG2 f)
PT7 (POLAR PL5 ANG1 SW)
PT12 PT7 PT13 PL5)
Reduce the occurence of COMMAND in the code. The structure of the calls to the commands have changed considerably over the many releases and will likely change again in the future. This means that your code will likely cease to work as expected at some point in the future. Instead, it might be better to utilize ENTMAKE where practical and leave the command calls to those areas where coding adds considerable work.
I noticed you change several system variables in the program. It is advisable to store the original values of these variables and restore them at the end of the function. i.e.
(setq bmode (getvar "BLIPMODE")
omode (getvar "OSMODE"))
(mapcar 'SETVAR '("BLIPMODE" "OSMODE") '(0 512))
;do stuff here
(mapcar 'SETVAR '("BLIPMODE" "OSMODE") '(bmode omode))
I noticed that during the running of the code, you set OSMODE to 512 and 128 respectively. This might work for you, but in my experience, that is very limiting on the user. I suggest changing the OSMODE only if it is imperitive to the function of the code. In this case, it does not appear to be. Perhaps some error checking to see if the user has any running osnaps on and if not, turn them on only where desired.
You don't have an error handler, this will leave the system in an unfamiliar state for the user if the program crashes or the user terminates it unexpectedly.
The code is currently only designed to work in mm, that is fine if that is all you are expecting to use it for. To determine if the drawing is indeed metric or imperial, you should check the value of MEASUREMENT, if that is 0, check the value of MEASUREINIT, if that is 0, then it is likely imperial and you can adjust your measurements accordingly. If MEASUREMENT is 1 then it is metric. Remember that MEASUREMENT overrides MEASUREINIT, so you will need to check both to be reasonably sure of the units. Alternately, if the user has set LUNITS to 4, it is likely an architectural drawing and probably will be imperial as metric drawings typically set LUNITS to 2, although that isn't necessarily the case all the time.
You have some variables that are global. I suggest making them either sufficiently obscure so they won't be mistakenly overwritten by another bit of code or change other code's expected operation. You can do this by storing the variables in the registry of by storing them in the ini file .. there are functions for both of these .. you could then make the function default to these layers between drawings and the user can simply click through (press enter or space bar) if they don't want to change them.
For ease of reading the code, I also suggest using a format that makes the variables readily identifiable, i.e. caps for lisp functions and lowercase for vars or vice-versa .. or whatever happens to suit you. There are some pretty comprehensive code formatting options in the vlide editor.
Good luck!