Say you have a closed polyline as a boundary - as it looks it is. Then this routine of mine could help you.
Note that there are two last lines commented out - routine is originally made for export to the separated file.
(vl-load-com)
(defun c:ExtrimExport ( / :VPMatchModel s i x f) ; Extrim using Export-Layout
(defun :VPMatchModel (ss / cad doc ss i obj cen) ; Match scale with Model
(setq cad (vlax-get-Acad-Object)
doc (vla-get-ActiveDocument cad))
(vla-put-MSpace doc :vlax-true)
(repeat (setq i (sslength ss))
(setq obj (vlax-ename->vla-object (ssname ss (setq i (1- i)))))
(if (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-put-ActivePViewport (list doc obj))))
(progn
(vlax-invoke cad 'ZoomCenter (vlax-get obj 'Center) 1.0)
(vla-put-CustomScale obj 1.))))
(vla-put-MSpace doc :vlax-false))
; ---------------------------------------------------------------------------------------
(if (and (or (= (getvar 'ctab) "Model")
(prompt "\nError: Start routine from MODEL space!"))
(princ "\nClosed lwpolylines as boundaries required, ")
(setq s (ssget '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1))))
(or (vl-position "Extrim" (layoutlist))
(vl-cmdf "_.LAYOUT" "_New" "Extrim"))
(setvar 'ctab "Extrim")
(vl-cmdf "_.PSPACE")
)
(progn
(if (setq x (ssget "_A" '((410 . "Extrim"))))
(command "_.ERASE" x ""))
(repeat (setq i (sslength s))
(entmake (append (entget (ssname s (setq i (1- i)))) '((410 . "Extrim")))))
(command "_.ZOOM" "_E")
(if (setq s (ssget "_A" '((0 . "LWPOLYLINE") (410 . "Extrim"))))
(repeat (setq i (sslength s))
(command "_.-VPORTS" "_Object" (ssname s (setq i (1- i))))))
(if (setq s (ssget "_A" '((0 . "VIEWPORT") (410 . "Extrim"))))
(:VPMatchModel s))
;;; (initdia)
;;; (command "_.EXPORTLAYOUT")
))
(princ)
)