Named View assign UCS

Named View assign UCS

Baker_ADG
Advocate Advocate
669 Views
7 Replies
Message 1 of 8

Named View assign UCS

Baker_ADG
Advocate
Advocate

Forgive my archaic lisp routine, feel free to help and refine it..

 

But I was wondering if there was a way to assign a named UCS to a named view through the command line.  (about line 37)

 

(defun c:NVVF (/ echo ept pt1 pt2 pt3 tx1 *ERROR*)

(defun *Error* (strErr)
  (setvar "expert" ept)
  (setvar "CmdEcho" echo)
  (princ)
 ) ;_ closes ERROR EXCEPTION defun

 (setq ;saves current SYSTEM VARIABLES
  ept (getvar "expert")
  echo (getvar "CmdEcho")
 )


(setvar "expert" 4)
(setvar "CmdEcho" 0)

(Command "_.ucs" "world")

(setq 
pt1 (GETPOINT "\nPick Bottom Left Corner of View Frame: ")
pt2 (GETPOINT "\nPick Bottom Right Corner of View Frame: ")

)

(command "ucs" "3" pt1 pt2 "")

(setq
pt3 (GETPOINT "\nPick Top Right Corner of View Frame: ")
tx1 (GETSTRING T "\nEnter view name to save: ")

)

(command "_.ucs" "named" "save" tx1)
(COMMAND "PLAN" "")
(COMMAND "ZOOM" "0,0" pt3)
(command "-view" "W" tx1 "0,0" pt3)

(princ "\n***Named View Created***")
   (*error* nil)
;quiet exit
 (princ)
)

 

Jon Baker | Land Development & Infrastructure Design Manager
Alignment Design Group | Denver | Colorado
Civil 3D 2025 | Windows 11
0 Likes
Accepted solutions (1)
670 Views
7 Replies
Replies (7)
Message 2 of 8

Moshe-A
Mentor
Mentor

@Baker_ADG 

 

Command: -VIEW
Enter an option [?/Delete/Orthographic/Restore/Save/sEttings/Window]: sEttings
Enter an option [Background/Categorize/Layer snapshot/live Section/Ucs/Visual style]: ucs
Save current UCS with named views?[Yes/No]<Yes>:

 

moshe

 

0 Likes
Message 3 of 8

Baker_ADG
Advocate
Advocate
I've tried that.. and it does not actually assign the UCS to the view.
Jon Baker | Land Development & Infrastructure Design Manager
Alignment Design Group | Denver | Colorado
Civil 3D 2025 | Windows 11
0 Likes
Message 4 of 8

Baker_ADG
Advocate
Advocate
my original line of code: (command "-view" "settings" "ucs" "yes" "" "W" tx1 "0,0" pt3)
Jon Baker | Land Development & Infrastructure Design Manager
Alignment Design Group | Denver | Colorado
Civil 3D 2025 | Windows 11
0 Likes
Message 5 of 8

Sea-Haven
Mentor
Mentor

Do you want multiple layouts that are rotated automatically as you walk along a pline ? Noted "Land development".

0 Likes
Message 6 of 8

Moshe-A
Mentor
Mentor
Accepted solution

@Baker_ADG ,

 

give this a try, works for me 😀

 

Moshe

 

 

(defun c:nvvf (/ *error* ; local function
                 echo ept pt1 pt2 pt3 tx1)

 (defun *error* (msg)
  (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
   (princ (strcat "\nError: " msg))
  )

  (setvar "expert" ept)
  (setvar "CmdEcho" echo)
  (princ)
 ) ;_ closes ERROR EXCEPTION defun

 (setvar "CmdEcho" 1)
 (command "._undo" "_begin")
  
 ;saves current SYSTEM VARIABLES  
 (setq ept (getvar "expert")
       echo (getvar "CmdEcho")
 )

 
 (setvar "expert" 4)
 (Command "_.ucs" "world")

 (if (and
      (setq pt1 (getpoint "\nPick Bottom Left Corner of View Frame: "))
      (setq pt2 (getpoint "\nPick Bottom Right Corner of View Frame: "))
      (not (command "._ucs" "3" pt1 pt2 ""))
      (setq pt3 (getpoint "\nPick Top Right Corner of View Frame: "))
      (not (eq  (setq tx1 (getstring t "\nEnter view name to save: ")) ""))
     )
  (progn
   (command "_.ucs" "_named" "_save" tx1)
   (command "._plan" "")
   (command "._zoom" "0,0" pt3)

 ; (command "-view" "W" tx1 "0,0" pt3)
   (command "._view" "_save" tx1)
  
   (princ "\n***Named View Created***")
  ); progn
 ); if

 (command ".undo" "_end")
 (setvar "cmdecho" echo)

 (princ)
)

 

 

 

Message 7 of 8

Baker_ADG
Advocate
Advocate

perfect!!! 

Thank you!!

Jon Baker | Land Development & Infrastructure Design Manager
Alignment Design Group | Denver | Colorado
Civil 3D 2025 | Windows 11
0 Likes
Message 8 of 8

Sea-Haven
Mentor
Mentor

Appreciate pick 2 points for view but, red rectangles follow a line or pline at title/layout scale, next step is make all layouts with view twisted. Made like 50 layouts 1 go. Just run again for multiple line/plines.

 

SeaHaven_0-1667606420701.png

 

 

 

0 Likes