There's a reply in this thread with my lisp routine included.
https://forums.autodesk.com/t5/civil-3d-ideas/sac-saveas-older-format/idi-p/5758574?search-action-id...
Beware that I just realized it uses a lisp routine (VPLOCKS) that I found online a long time ago and don't remember who the author was. I'll post that here. My code uses this to check if the current viewport is locked (and can't be rotated).
(defun mspace?( / )
(or
(= 1 (getvar "Tilemode"))
(/= 1 (getvar "cvport"))
)
)
(defun vplocked?()
(and
(setq *acad* (vlax-get-acad-object))
(setq *doc* (vla-get-activedocument *acad*))
(setq vp (vla-get-activePviewport *doc*))
(= :vlax-true (vla-get-displaylocked vp))
)
)
;;;Lock/unlock paper space viewports
;;; mode = 1 lock all - (lockmviews 1)
;;; mode = 2 lock selected - (lockmviews 2)
;;; mode = 3 lock active - (lockmviews 3)
;;; mode = -1 unlock all - (lockmviews -1)
;;; mode = -2 unlock selected - (lockmviews -2)
;;; mode = -3 unlock active - (lockmviews -3)
(defun lockmviews (
mode
/
cmdecho
ss ssl ss1
)
(setq cmdecho (getvar "cmdecho"))
(setvar "cmdecho" 0)
(if (and
(/= (abs mode) 3) ;use the active viewport
(= 0 (getvar "tilemode"))
(/= 1 (getvar "cvport"))
)
(progn
(setq ss T)
(c:ss)
) ;_ end progn
) ;_ end if
(cond
((= 1 (getvar "tilemode"))
(alert "Switch to paper space and try again.")
)
;;Lock all ------------------------------------------------------------
((= mode 1)
(setq
ss1 (ssget "X" '(( 0 . "VIEWPORT")))
ssl (sslength ss1)
)
(if (<= 0 ssl)
(progn
(command "._mview" "Lock" "On" ss1 "")
(princ (strcat "\n" (itoa (1- ssl)) " viewport(s) found and locked. "))
)
(princ "\nNo viewports found. ")
)
)
;;Unlock all------------------------------------------------------------
((= mode -1)
(setq
ss1 (ssget "X" '((0 . "VIEWPORT")))
ssl (sslength ss1)
)
(if (<= 0 ssl)
(progn
(command "._mview" "Lock" "Off" ss1 "")
(princ (strcat "\n" (itoa (1- ssl)) " viewport(s) found and unlocked."))
)
(princ "\nNo viewports found. ")
)
)
;;Lock Selected---------------------------------------------------------
((= mode 2)
(command "._mview" "Lock" "On")
(setvar "cmdecho" 1)
(while (and (< 0 (getvar "cmdactive"))
(wcmatch (getvar "cmdnames") "*mview*")
) ;_ end and
(command pause)
) ;_ end while
(setvar "cmdecho" 0)
)
;;Unlock selected------------------------------------------------------
((= mode -2)
(setvar "cmdecho" 1)
(command "._mview" "Lock" "Off")
(while (and (< 0 (getvar "cmdactive"))
(wcmatch (getvar "cmdnames") "*mview*")
) ;_ end and
(command pause)
) ;_ end while
(setvar "cmdecho" 0)
)
;;Lock active----------------------------------------------------------
((= mode 3)
(lockactivepvp T)
(princ "\nActive viewport locked. ")
)
;;Unlock active--------------------------------------------------------
((= mode -3)
(lockactivepvp nil)
(princ "\nActive viewport unlocked. ")
)
(T nil)
) ;end cond
(if ss
(c:ss)
) ;_ end if
(setvar "cmdecho" cmdecho)
(princ)
) ;end lockmviews
(defun lockactivepvp( ;get the active paper space viewport
lock ;nil = unlock, non-nil = lock
/
app doc pvport
)
(setq
app (vlax-get-acad-object)
doc (vla-get-activedocument app)
pvport (vla-get-activepviewport doc)
)
(if lock
(vla-put-displaylocked pvport :vlax-true)
(vla-put-displaylocked pvport :vlax-false)
)
(vlax-release-object doc)
(vlax-release-object app)
pvport
)
Don Ireland
Engineering Design Technician

If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.
Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.