TheSwamp
CAD Forums => CAD General => Topic started by: MSTG007 on September 12, 2014, 02:16:25 PM
-
I have been doing more and more ucs rotations, so I have to ask. I usually type in ucs click on a nearest line to nearest point to assign the ucs, then I have the type in plan, then enter.
is there a lisp or command that can do all that in one command?
-
my process is set the UCS, then use my command PLANC. Changes view to UCS, and restores zoom setting
;;;============================================================================
;;; ##View Commands
;;;============================================================================
(defun c:PLANW () ;set current view to world without zooming out to extents
(XYZ_ViewSave)
(command "PLAN" "World")
(XYZ_ViewRestore)
(princ)
)
(defun c:PLANC () ;set view to current ucs without zooming out to extents
(XYZ_ViewSave)
(command "PLAN" "Current")
(XYZ_ViewRestore)
(princ)
)
;;;=========================================================================
;;; XYZ_ViewSave & Restore
;;;=========================================================================
(defun XYZ_ViewSave ()
(setq XYZ_vsize (getvar "viewsize")
XYZ_vctr (trans (getvar "viewctr") 1 0) ;ucs user to world
) ;setq
)
(defun XYZ_ViewRestore ()
(command "zoom" "c" (trans XYZ_vctr 0 1) XYZ_vsize)
(setq XYZ_vsize nil
XYZ_vctr nil
) ;setq
)
-
Is there some reason you need to see it in 'plan'??
I've been working 3D exclusively for 20 years and almost NEVER work in a 'plan' view of the UCS.
also investigate 'UCS OB'ject (E still works for 'entity') for setting a UCS to match an existing object.
For planes that are 'normal' to orthogonal geometry I use
(defun c:ucr () (command ".UCS" "w" ".UCS" "3" "0,0,0" "0,1,0" "0,0,1")) ;; 'RIGHT' side, looking in negative "X" axis direction
(defun c:ucb () (command ".UCS" "w" ".UCS" "3" "0,0,0" "-1,0,0" "0,0,1")) ;; 'BACK' side, looking in negative "Y" axis direction
(defun c:ucl () (command ".UCS" "w" ".UCS" "3" "0,0,0" "0,-1,0" "0,0,1")) ;; 'LEFT' side, looking in positive "X" axis direction
(defun c:ucf () (command ".UCS" "w" ".UCS" "x" "90")) ;; 'FRONT' side, looking in positive "Y" axis direction
and
(defun c:uce () (command ".UCS" "E")) ;; UCS to entity
(defun c:uco () (command ".UCS" "o")) ;; specify new origin
(defun c:ucp () (command ".UCS" "p")) ;; UCS Previous
(defun c:ucv () (command ".UCS" "V")) ;; UCS match View
(defun c:ucw () (command ".UCS" "W")) ;; UCS World
(defun c:uczee () (command ".UCS" "z" "ENDP" PAUSE "ENDp" PAUSE)) ;; spin UCS about "Z" axis to match 'endpoints'
All of the above can be modified to add a call to "plan"
(defun c:ucf () (command ".UCS" "w" ".UCS" "x" "90" "" "plan" ""))
or Mr. Allen's viewsave/restore tool
I am sure the lispy gurus around here can produce a more elegant set of tools without leaning on the (command ...) but these work fer me.
-
Is there some reason you need to see it in 'plan'??
with my architect drafting methods, I really like to have the linework orthagonal to plan view. I use the stretch command a lot, and the pickbox wants to be orthagonal with view, and I use X/Y point filers a lot, and I like to make it easy to remember which way is which
-
with my architect drafting methods, I really like to have the linework orthagonal to plan view. I use the stretch command a lot, and the pickbox wants to be orthagonal with view,
hmmm... yes the selection window appears orthogonal to the current view, by CP will fix that, and the stretch remain orthogonal to the UCS with ORTHO on.
Are you working 2D or 3D?? Multiple viewports or single??
-
2d, almost always single viewport
your comments make sense, we just work differently, that is the great thing about being able to customize
-
I have been doing more and more ucs rotations, so I have to ask. I usually type in ucs click on a nearest line to nearest point to assign the ucs, then I have the type in plan, then enter.
is there a lisp or command that can do all that in one command?
FWIW, I use these functions:
(defun c:UCSfollowOBJECT ( / e worldpoint v-size v-ctr)
(setq Gb-ERROR '("UCSFOLLOW")
Gb-ERROR (mapcar (function (lambda (a) (list 'setvar a (getvar a)))) Gb-ERROR)
)
(command "._undo" "_begin")
(defun *error* (msg) (MAPCAR 'eval Gb-ERROR))
(if (setq e (nentsel "\nSelect object to align UCS or [ENTER] to restore: "))
(progn
(setq v-size (getvar "VIEWSIZE") v-ctr (trans (getvar "VIEWCTR") 1 0))
(setq worldpoint (trans (cadr e) 1 0))
(setvar "UCSFOLLOW" 1)
(command "._UCS" "_ob" (car e))
(command "._zoom" "_CE" v-ctr v-size)
;(command ".pan" (trans worldpoint 0 1)(getvar "VIEWCTR"))
(command "._pan" (trans worldpoint 0 1)(cadr (grread nil 7)))
)
; else
(command "._plan" "WORLD")
)
(eval Gb-ERROR)
(setq *error* nil Gb-ERROR nil)
(command "._undo" "_end")
(princ)
)
(defun c:UCSWORLD ()
(if (and (/= (getvar "VIEWTWIST") 0)(= (getvar "WORLDUCS") 1))(command ".plan" "World")(command ".UCS" "W"))
(princ)
)
-
UCSFOLLOW set to 1 will eliminate the need for the plan command.
-
UCSFOLLOW set to 1 will eliminate the need for the plan command.
it will also eliminate the ability to change the UCS WITHOUT altering your view.
-
Both statements are true. UCSFOLLOW is something that you don't want active all the time, that's the reason of these commands.
In my menu I've replaced 'UCS W' with the UCSWORLD command. A single click for 'UCS WORLD' and a double click if you need 'PLAN WORLD'.