For final results, your image (that looks like a Table), should probably (be) a Table.
I found a few items in the code that you should look at.
I'm assuming that the code you uploaded as 'HW.lsp' is just a portion
of a much larger Lisp.
I see a couple of issues with what you have posted.
(defun ck-num-g (a / n snum sstr sappend m-snum snum-t-nil) <---- is a function,
but I don't see it 'called' from within the C:Hw function.
And, here, there seems to be a typo..
(setq ssn (sslengt des))
Should be:
(setq ssn (sslength des)); note missing h
And here:
(setq des (ssget))
Would allow for picking just about any entity.
And would allow Multiple items to be picked via Window or Crossing or 1 at a time.
Better to prompt for something:
(princ "\nPick a Beam Number:")
(setq des (ssget "_+.:E:S" '((0 . "TEXT")))); to only get 1 item
(if des
(progn
(setq ent (ssname des 0))
(setq elist (entget ent))
(setq BeamNumber (cdr (assoc 1 elist)))
); progn
); if
ECCAD