;;; Create UCS parallel to current Paper space viewport frame.
;;; Need to draw Line/Polyline in Paper Space parallel to Paper space viewport frame
;;; Need to install Richard Stima Xref Tools Extra Plug-in
;;; From Autodesk App Store: https://apps.autodesk.com/MEP/en/Detail/Index?id=6784178835292008697&appLang=en&os=Win32_64
;;; Created by Igal Averbuh 2018 with respect to Richard Stima
(defun c:CS ()
(vl-load-com)

;;; Unlock All viewports

(vlax-for lay
(vla-get-Layouts
(vla-get-ActiveDocument
(vlax-get-acad-object)))
(if (eq :vlax-false (vla-get-ModelType lay))
(vlax-for ent (vla-get-Block lay)
(if (= (vla-get-ObjectName ent) "AcDbViewport")
(vla-put-DisplayLocked ent :vlax-false)))))

(setq sel (entsel "\nSelect object paralel to current vport frame: "))

(command "chspace" sel "" "")

(command "ucs" "ob" "l")

(command "_saveview")

(setvar "tilemode" 1)

(command "_restoreview")

;;; Lock All viewports
(vlax-for lay
(vla-get-Layouts
(vla-get-ActiveDocument
(vlax-get-acad-object)))
(if (eq :vlax-false (vla-get-ModelType lay))
(vlax-for ent (vla-get-Block lay)
(if (= (vla-get-ObjectName ent) "AcDbViewport")
(vla-put-DisplayLocked ent :vlax-true)))))

) ;_end defun
(princ)
(c:cs)

Advertisements