Jump to content

AutoCAD PLAN (that does not zoom out)


halam

Recommended Posts

Many of my collegues find it usefull to work with ucsfollow=1

Personally, i'm not a great fan because it makes me zoom to many times when UCS is adjusted. Also PLAN is also a major pita in this regard

This brought me up the idea to customize both the PLAN and UCS command to this.

 

 

Having short contact with, Autodesk online, they seem to like the idea PLAN not zooming out all the time, thats nice.

It could be fitted in to the UCSFOLLOW setvar, if you ask me.

Any comments or improvement will be appriciated

 

 

 

 


; better commands AutoCAD UCSfollow settings  
                                         
; view in current ucs => PLN 
; UCS World without zooming => WCS


(defun c:pln ()
(setq vctr (getvar "viewctr"))
(setq vsize (getvar "viewsize"))
(setq olducsfollow (getvar "ucsfollow"))   
(setq getucsfollow (getvar "ucsfollow")) (if (= getucsfollow 1) (setvar "ucsfollow"  0) ())      
(setq getosnapz (getvar "osnapz")) (if (= getosnapz 1) (setvar "gridmode"  1) (setvar "gridmode"  0))   
(command "plan" "")
(command "_.zoom" "c" vctr vsize)   
(command "ucs" "v")
(setvar "ucsfollow" olducsfollow)   ; reset
)
(defun C:WCS () 
 (setvar "UCSICON" 1)
 (setq olducsfollow (getvar "ucsfollow"))   
 (setq getucsfollow (getvar "ucsfollow")) (if (= getucsfollow 1) (setvar "ucsfollow"  0) ())
 (command "UCS" "")
 (setvar "ucsfollow" olducsfollow)   ; reset
 (prin1)
)

(defun C:UCO(/ ENT1 )
 (setq ENT1 (entsel "\nPick object to align UCS:"))
 (setq olducsfollow (getvar "ucsfollow"))   
 (setq getucsfollow (getvar "ucsfollow")) (if (= getucsfollow 1) (setvar "ucsfollow"  0) ())  
 (command "ucs" "ob" ENT1)
 (setvar "ucsfollow" olducsfollow)   ; voorgaande waarde
 (princ)
)  
(defun C:uc3 ()
 (prompt "\t* set UCS 3 points")
 (SETVAR "GRIDMODE" 0)
 (SETVAR "OSNAPZ" 0)
 (SETVAR "UCSICON" 1)
 (setq olducsfollow (getvar "ucsfollow"))   
 (setq getucsfollow (getvar "ucsfollow")) (if (= getucsfollow 1) (setvar "ucsfollow"  0) ())
 (command "UCS" "3" pause pause pause)
 (setvar "ucsfollow" olducsfollow)   ; voorgaande waarde
 (prin1)
)
(defun C:ucm () 
 (setvar "cmdecho" 0)  
 (prompt "\t* draai UCS haaks MET de klok mee")
 (setvar "UCSICON" 1)
 (setq olducsfollow (getvar "ucsfollow"))   
 (setq getucsfollow (getvar "ucsfollow")) (if (= getucsfollow 1) (setvar "ucsfollow"  0) ())  
 (command "UCS" "z" "")
 (setvar "ucsfollow" olducsfollow)   ; voorgaande waarde  
 (prin1)
)
 

Edited by halam
Link to comment
Share on other sites

AutoCAD 2016 has a something similar in the famous EXPRESS TOOLS (..WHY didn't they just improve PLAN itself)

Except, this routine ask for a selection of objects. (..WHY??)

I think it could do much better if if it didn't ZOOM OUT, even if user wishes (/replies ENTER) without any selection. It can be done..

 

 



;;
;;  explan.lsp - Express Tools plan replacement command
;;                    
;;
;;  Copyright © 1999 by Autodesk, Inc.
;;
;;  Your use of this software is governed by the terms and conditions
;;  of the License Agreement you accepted prior to installation of this
;;  software.  Please note that pursuant to the License Agreement for this
;;  software, "[c]opying of this computer program or its documentation
;;  except as permitted by this License is copyright infringement under
;;  the laws of your country.  If you copy this computer program without
;;  permission of Autodesk, you are violating the law."
;;
;;  AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
;;  AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
;;  MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
;;  DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
;;  UNINTERRUPTED OR ERROR FREE.
;;
;;
;; Description:
;;  Similar to PLAN except that EXPLAN ..

Edited by halam
Link to comment
Share on other sites

@Hans:

Asking for a selection of objects does make sense. Example: if you are looking at 3 objects that are placed one behind the other and after using the 'improved' plan command you would be looking at a side view of one of them, which one should it be?

 

BTW: Have you read the copyright notice?

Link to comment
Share on other sites

I don't really follow the 3d aspect, view follows ucs is what I'm after.

Referencing this totally open readable file. Is that not accepted? I'm not a lawyer. It was programmed for 2016 but 'protected' in 1999. That really seems a long time ago.

But I erased the code for good sake. The help files does not mention this 3D aspect as well, they are different!

Therefore, relevant for some discussion..

 

http://help.autodesk.com/view/ACD/2016/ENU/?guid=GUID-3FD011D0-2AB5-4C46-8302-19F91DD2EC87

Edited by halam
Link to comment
Share on other sites

I understand that what you are doing is related to UCSFOLLOW. But the _Plan command can also be used in a different context where the view center is perhaps not where the user expects or wants it to be. Which is probably the reason for the default zoom action in the first place.

Link to comment
Share on other sites

Thanks all. 3d indeed needs a different approach, i see now. I was thinking i need a 2-way routine to write, like this, in nutshell

 

1. Check is view is aligned to ucs (100% XY orientated)

2. If so, then proceed to step 3, else go to 4 for 3d appoach

3. PLN (described in my first post)

4. Perform EXPLAN (select objects)

 

For step 2 my idea would be to use VIEWDIR to determine the ucs/view relation..

 

 

VIEWDIR 0,0,1+ (any value bigger for Z bigger than 1.0)

IF VIEWDIR doesn't have the value 0,0 (XY) than proceed to 4.

 

 

(if (not (equal (getvar 'viewdir) '(0.0 0.0 1.0) 1e-6))  ; for Z it needs the code to make it happen for value 1.0 and anything more than 1.0.. hmm..
   (progn
     (c:pln))
     (c:explan)
   )

I did not have time to test your routines yet Marko, will certainly do. Thanks.

 

The reason is because i use PLAN very many times a day. Any improvement is welcome to save zooming times.

Edited by halam
Link to comment
Share on other sites

For me, this works better now

2D & 3D

 

(defun c:pln ()
   (setq getviewdir (getvar "viewdir"))
   (setq getviewdir_x (car getviewdir))
   (setq getviewdir_y (car (cdr getviewdir)))
   (setq result_pln (+ getviewdir_x getviewdir_y))
   (if (= result_pln 0) (c:pln_2d) (c:explan))
)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...