Try this it does use a hatch so no trimming required. It does require a control point so lower left corner of 45x45 starts there. Very limited testing, hatch pattern included.
; hatch to a bounraty and align
; By AlanH Jan 2024
(defun c:wow ( / pt ss obj cpt pt)
(setq pt (getpoint "\npick control point on pline "))
(setq ss (ssget pt '((0 . "LWPOLYLINE,CIRCLE"))))
(if (= ss nil)
(alert "pline not found")
(progn
(setq obj (vlax-ename->vla-object (ssname ss 0)))
(if (= (vla-get-objectname obj) "AcDbCircle")
(setq cpt (vlax-get obj 'Center))
(setq cpt (osnap (vlax-curve-getStartPoint obj) "gcen"))
)
(command "hatch" "P" "Waffle2" 1 0.0 cpt "")
(setq obj (vlax-ename->vla-object (entlast)))
(setq pt (mapcar '+ pt (list -0.3 -0.3 0.0)))
(vlax-put obj 'origin pt)
)
)
(princ)
)
(c:wow)
You must preload this hatch pattern.
*WAFFLE2,WAFFLE2
0, 0.3,0.0, 0,45.3, 45.0,-0.3
0, 0.3,0.3, 0,45.3, 45.0,-0.3
90, 0.0,0.3, 0,45.3, 45.0,-0.3
90, 0.3,0.3, 0,45.3, 45.0,-0.3
Limited Testing on plines and circles.