Author Topic: UCS view depth  (Read 2738 times)

0 Members and 1 Guest are viewing this topic.

Ron Heigh

  • Guest
UCS view depth
« on: September 16, 2004, 12:29:24 PM »
Can I set my UCS to only show entities 2' above or below the current elevation?

CADaver

  • Guest
UCS view depth
« Reply #1 on: September 16, 2004, 01:18:05 PM »
Not your UCS, but DVIEW CLIP

I am more than sure some of the vlispy expert-types folks around here could make this a lot slicker and smoother, but this works fer me.



Code: [Select]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(vl-load-com)
(vl-load-reactors)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:dvp ( / *error*)
   (defun *error* (msg)
      (cond
         (msg (command)(command)(princ (strcat "\nError: " msg)))
         (T nil)
      )
      (dvt:restore)
      (if msg (command "_u"))
   )
   (dvt:save)
   (dvp:sectiontop)
   (*error* nil)
   (prin1)
(setvar "cvport" curvp)
(princ)
)
;------------------------------------------------------------------
(defun dvp:sectiontop ();/ ptfrt pt2 ang Ndvpdeep)
   (setvar "EXPERT" 5)
   (setvar "orthomode" 1)
   (setq curvp (getvar "cvport"))
   (command "_ucs" "_s" "__TMP")
   (command "_ucs" "_v")
   (cond
      ((null (setq ptfrt (getpoint "\nSelect Front Clipping Plane of Section: "))))
      ((null (setq ptbck (getpoint "\n Select Back Clipping Plane of Section: " ptfrt))))
      ((null (setq ang (angle ptbck ptfrt))))
      ((null (setq dist (distance ptbck ptfrt))))
       (T
         (setq ptfrt (trans ptfrt 1 0) ptbck (trans ptbck 1 0));;;;;;; pt2 (trans pt2 1 0))
         (prompt "\n Select Viewport for Section Display (ENTER if necessary then) ")
         (dvt:rm:cvpc)     ; vp-change function (possibly unreliable)
         (setvar "WORLDVIEW" 1)
         (setvar "UCSFOLLOW" 0)
         (command "_ucs" "_w") ; moved here (only necessary after viewport change)
         (command "_.dview" "" "_po" "_non" ptbck "_non" ptfrt "_cl" "_f" dist "_cl" "_b" "0" "")
         (command "_.zoom" "_e" "_.zoom" ".8x")
         (command "_ucs" "_r" "__TMP" "_ucs" "_d" "__TMP")
      )
   )
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun dvt:rm:cvpc ( / grrd weida p pold viewsize trigger)
   (setq weida T viewsize (getvar "VIEWSIZE")
         trigger (* viewsize 0.4)) ; adjust factor according to mouse speed etc
   (while weida
      (setq grrd (grread T )) ;(+ 1 2 4 8) 2
      (cond
         ((= 5 (car grrd))
            (setq p (cadr grrd))
            (cond
               ((and pold (> (distance p pold) trigger))
                  (setq weida nil)
               )
            )
            (setq pold p)
         )
         ((= 2 (car grrd))(setq weida nil))
         (T nil
         )
      )
   )
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   (defun dvt:save ( / n)
      (setq *dvt* nil)
      (command "_undo" "_begin")
      (setvar "osmode" 0)
      (foreach n '("CMDECHO" "WORLDVIEW" "UCSFOLLOW" "EXPERT")
         (setq *dvt* (cons (cons n (getvar n)) *dvt*))
      )
   )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   (defun dvt:restore ()
      (foreach n *dvt*
         (setvar (car n) (cdr n))
      )      
      (command "_undo" "_end")
   )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(princ)