Is there anyway to get the scale of the viewport without, toggling
into model space in some form? Trans requires the viewport to be active, the viewctr/viewsize method does as well...
P. Farrell
Both R14 and A2K have an Express tool that will give you the scale of a
viewport from either modelspace or paperspace. If you're already inside the
viewport, VPSCALE will automatically spit out the paperspace to modelspace
scale. If not, you will be prompted to select the viewport.
--
Eugene N. Kilmer
Owner/Mag Drafting
(defun c:vpscale ()
(setq e (car (entsel "\nSelect a viewport: "))
elist (entget e '("ACAD"))
pscale (cdr (assoc 41 elist))
xdata (cdr (nth 0 (cdr (assoc -3 elist))))
c 0
)
(foreach n xdata
(if (= (car n) 1040)
(progn
(setq c (1+ c))
(if (= c 2)
(setq mscale (cdr n))
)
)
)
)
(/ pscale mscale)
)
Peter Farrell <pfar...@bellatlantic.net> wrote in message
news:7v55le$c3...@adesknews2.autodesk.com...
Thanks, all better.
P.Farrell
(defun xpfact ()
(caddr (trans '(0 0 1) 2 3))
)
--
/*********************************************************/
/* Tony Tanzillo Design Automation Consulting */
/* Programming & Customization for AutoCAD & Compatibles */
/* ----------------------------------------------------- */
/* tony.t...@worldnet.att.net */
/* http://ourworld.compuserve.com/homepages/tonyt */
/*********************************************************/
Tony Tanzillo <tony.t...@worldnet.att.net> wrote in message
news:3816FE0E...@worldnet.att.net...
1. Out of curiosity where is this recently active viewport information stored.
2. is there an equally elegant means to acquire the scale of
any viewport you pick *from paperspace only*. Frank's answer
was good, is there a better one?
P. Farrell
Peter Farrell <pfar...@bellatlantic.net> wrote in message
news:7v7861$gq...@adesknews2.autodesk.com...
I do not know how to make a viewport active short of toggling to model space, and setting the current viewport, which is not an
acceptable solution
in this case, from *paperspace only* is the key factor here as you noted.
P. Farrell
(defun c:vpscalefactor ( / epk elist)
(if (eq 1 (getvar "tilemode"))
(prompt "\n** Command not allowed unless TILEMODE is set to 0 **")
(if (eq 1 (getvar "cvport"))
(while (or (setq epk (entsel "\nSelect VIEWPORT: "))
(eq 7 (getvar "errno"))
)
(if (and epk (setq elist (entget (car epk) '("ACAD"))))
(if (eq "VIEWPORT" (cdr (assoc 0 elist)))
(prompt
(strcat
"\nVIEWPORT scale is 1:"
(rtos (/ (cdr (nth 7 (cadr (assoc -3 elist)))) (cdr (assoc
41 elist))))
)
)
(prompt (strcat "\nInvalid selection: " (cdr (assoc 0 elist))))
)
)
)
(prompt (strcat "\nVIEWPORT scale is 1:" (rtos (last (trans '(0 0 1) 3
2)))))
)
)
(princ)
)
Jaysen
Peter Farrell wrote in message <7v7861$gq...@adesknews2.autodesk.com>...
<snip>
What precisely is the reason why you can't
switch to MSPACE to make a selected viewport
active?
(PS "not an acceptable solution" is not an
acceptable answer).
--
In my case, I am reading the Viewport scale as part of a right click
menu, and the MSPACE method causes the viewport to unselect.
Its just a matter of consistency with (noun-verb) commands.
In other words the user expects the entity to remain highlighted, not
to unhighlight, not to flicker, etc. until a command is actually entered.
I ended up using the xdata method to resolve the issue.
P. Farrell
Art Cooney <ar...@autodesk.com> wrote in message
news:3817303C...@autodesk.com...
> If you're working with AutoCAD2000, then you can calculate the zoom scale
from the viewport's normal data (i.e. you don't need to
> work with XData):
>
> (defun tst (/ ed)
> (setq ed (entget (car (entsel))))
> (/ (cdr (assoc 41 ed)) (cdr (assoc 45 ed)))
> )
>
> This is possible because in AutoCAD2000, the data is no longer stored as
XData. For compatibility with existing LISP programs,
> when you do an entget and ask for the XData, we use the actual data to
make up the appropriate XData values to be returned by
> entget.
>
> Peter Farrell wrote:
>
> > Carefully worded answer, but not the scale of a viewport from paper
space only. This gives the scale of the active model space
> > viewport
> > or recently active viewport.
> >
> > 1. Out of curiosity where is this recently active viewport information
stored.
> > 2. is there an equally elegant means to acquire the scale of
> > any viewport you pick *from paperspace only*. Frank's answer
> > was good, is there a better one?
> >
> > P. Farrell
>