Jump to content

Recommended Posts

Posted

I was wondering if someone might be able to help me. What I'm looking for is a routine that will let you pick a paperspace viewport, popup a dialog box that has the different scale choices, then change that viewport to the scale chosen.

 

I have a lisp/dcl that already does this for text size/dimscale. I was wondering if someone could help me adapt it for changing viewport scales?

dsl.dcl

dsl.lsp

Posted

Try pick scale from dcl then z e pick centre pt of dwg then z C zzz where zzz is the scale factor for your chosen scale else use the zoom zzzXP again zzz is a scale factor 10XP =1:100

(setq sc (getstring "\nScale for this window 1:  "))
(setq sc3 (strcat "1/" sc "xp"))
(setq zc (getpoint "\nPoint to centre of view in Viewport:"))
(command "_.zoom" "_center" zc sc3)

Posted

I found this routine on the forums and was wondering if it could be integrated somehow into that DSL lisp/DCL routine?

 

(defun c:Test (/ e s)

(if (setq e (car (entsel "\nSelect viewport to change/view scale: ")))

(if (eq "AcDbViewport" (vla-get-objectname (setq e (vlax-ename->vla-object e))))

(if (setq s (getreal (strcat "\nSpecify new scale (Current: 1\" = "

(rtos (/ 1. (vla-get-customscale e)) 2)

"'): "

)

)

)

(vl-catch-all-apply (function vla-put-customscale) (list e (/ 1. s)))

)

(princ "\nInvalid object!")

)

)

(princ)

)

Posted

Just curious.

Why not use the AutoCAD properties box? Why do you need it in a lisp?

Posted

Well, I have people in my office that aren't the brightest bulbs in the bunch :)

 

I want to make setting up sheets the easiest way possible. The properties box doesn't work with civil scales (i.e. 1" = 10'). And I thought this would be a way to simplify the setting up of model windows.

Guest kruuger
Posted

maybe this. it is very simple but it works:

(defun C:S1  () (DRAWVP  1))
(defun C:S2  () (DRAWVP  2))
(defun C:S4  () (DRAWVP  4))
(defun C:S8  () (DRAWVP  )
(defun C:S12 () (DRAWVP 12))
(defun C:S16 () (DRAWVP 16))
(defun C:S24 () (DRAWVP 24))
(defun C:S32 () (DRAWVP 32))
(defun C:S48 () (DRAWVP 48))
(defun C:S96 () (DRAWVP 96))
---------------------------------------------------------------------------------------
(defun DRAWVP (Scale / OLDCMD CVP SS)
 (setq OLDCMD (getvar "cmdecho"))
 (setvar "cmdecho" 0)
 (if (/= (getvar "cvport") 1)
   (progn
     (command "_zoom" "_s" (strcat "1/" (itoa Scale) "xp"))
     (setq CVP (getvar "cvport"))
     (setq SS
       (ssget "_X"
         (list
           (cons 0 "viewport")
           (Cons 69 CVP)
         )
       )
     )
     (command "_vports" "_L" "ON" SS "")
     (command "_pspace")
   )
 )
 (setvar "cmdecho" OLDCMD)
 (princ)
)

(princ)

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...