You want something like this?
Select a rectangular polyline for scale first, then the block to fit inside.
Keep in mind that something in the block from your sample drawing sticks out over the edges so the x scale will be a little off. There are also too many variables to make this work correctly for all cases (rotation, what is x or y scale, etc..)
(defun c:foo ( / o1 o2 ob en x y xn yn xblock yblock anx )
(defun bbox ( o / mi ma )
(vla-getboundingbox o 'mi 'ma)
(list (vlax-safearray->list mi) (vlax-safearray->list ma))
)
(defun bboxcen ( o / mi ma )
(vla-getboundingbox o 'mi 'ma)
(mapcar '(lambda (x y) (/ (+ x y) 2)) (vlax-safearray->list mi) (vlax-safearray->list ma))
)
(setq o1 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (eq (car x) 10)) (entget (setq en (car (entsel "Select Polyline: ")))))))
(setq x (distance (car o1) (cadr o1)))
(setq y (distance (cadr o1) (caddr o1)))
(setq yn (min x y))
(setq xn (max x y))
(cond
( (eq x xn)
(setq anx (angle (car o1) (cadr o1)))
)
( t (setq anx (angle (cadr o1 (caddr o1)))))
)
(setq ob (vlax-ename->vla-object (car (entsel "Select Block: "))))
(vla-put-rotation ob 0)
(setq o2 (bbox ob))
(setq xblock (abs (- (caar o2) (caadr o2))))
(setq yblock (abs (- (cadar o2) (cadr (cadr o2)))))
(vla-put-xeffectivescalefactor ob (* (/ xn xblock) (vla-get-xeffectivescalefactor ob)))
(vla-put-yeffectivescalefactor ob (* (/ yn yblock) (vla-get-yeffectivescalefactor ob)))
(vla-rotate ob (bboxcen ob) anx)
(vla-move ob (bboxcen ob) (bboxcen (vlax-ename->vla-object en)))
)