Author Topic: UCS and Plan commands  (Read 2476 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2565
  • I can't remeber what I already asked! I need help!
UCS and Plan commands
« 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?
Civil3D 2020

danallen

  • Guest
Re: UCS and Plan commands
« Reply #1 on: September 12, 2014, 02:46:07 PM »
my process is set the UCS, then use my command PLANC. Changes view to UCS, and restores zoom setting

Code: [Select]
;;;============================================================================
;;;   ##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
)

RC

  • Guest
Re: UCS and Plan commands
« Reply #2 on: September 15, 2014, 02:01:29 PM »
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

Code: [Select]
(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
Code: [Select]
(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"
Code: [Select]
(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.

danallen

  • Guest
Re: UCS and Plan commands
« Reply #3 on: September 15, 2014, 04:14:17 PM »
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

RC

  • Guest
Re: UCS and Plan commands
« Reply #4 on: September 15, 2014, 06:50:18 PM »
Quote
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??

danallen

  • Guest
Re: UCS and Plan commands
« Reply #5 on: September 15, 2014, 07:34:09 PM »
2d, almost always single viewport

your comments make sense, we just work differently, that is the great thing about being able to customize

Crank

  • Swamp Rat
  • Posts: 1492
Re: UCS and Plan commands
« Reply #6 on: September 16, 2014, 01:01:49 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?
FWIW, I use these functions:
Code: [Select]
(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)
)
Vault Professional 2022     +     AEC Collection

ROBBO

  • Bull Frog
  • Posts: 217
Re: UCS and Plan commands
« Reply #7 on: September 17, 2014, 10:57:41 AM »
UCSFOLLOW set to  1 will eliminate the need for the plan command.
The only thing to do with good advice is to pass it on.
It is never of any use to oneself.

Oscar Wilde
(1854-1900, Irish playwright, poet and writer)

RC

  • Guest
Re: UCS and Plan commands
« Reply #8 on: September 17, 2014, 12:53:25 PM »
Quote
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.

Crank

  • Swamp Rat
  • Posts: 1492
Re: UCS and Plan commands
« Reply #9 on: September 17, 2014, 05:20:46 PM »
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'.
Vault Professional 2022     +     AEC Collection