I can see problems with a make legend not in the sense of get linetypes and blocks but rather in the descriptions, if you look closely.
Some of the descriptions are 3 lines long. So they would need to be excluded and say added manually, else you need a look up for them and get the details.
So make all linetypes then make Blocks, the SRS linetypes need to be added last. Move the pothole and Bore pit up. Simplest way is to have the Buried fibre and Interduct as external blocks and Insert.
Need a real dwg to do real testing.
Steven P pretty sure this returns the 4 corners of a viewport in mspace will try to have a look at Lee's code. Note Twistangle for rotated viewports. Used for grids in layouts.
(command "._PSPACE")
(setq sss (ssget "_+.:E:S" (list (cons 0 "Viewport"))))
(setq cspace (cdr (assoc 69 (entget (ssname sss 0)))))
(setq obj (vlax-ename->vla-object (ssname sss 0)))
(if (= (vla-get-objectname obj) "AcDbViewport")
(progn
(setq cen (vlax-get obj 'Center ))
(setq ht (vlax-get obj 'Height))
(setq wid (vlax-get obj 'Width))
(if (> ht wid)
(setq dist (* 0.8 ht))
(setq dist (* 0.8 wid))
)
(setq sc (vlax-get obj 'customscale ))
(setq ang (vlax-get obj 'TwistAngle))
(setq xmin (- (car cen)(/ wid 2.0)))
(setq xmax (+ (car cen)(/ wid 2.0)))
(setq ymin (- (cadr cen)(/ ht 2.0)))
(setq ymax (+ (cadr cen)(/ ht 2.0)))
(command "zoom" "c" cen 2000)
(command "Mspace")
(setvar 'cvport cspace)
(command "UCS" "w")