match annotation scale to viewport scale
is there an easy way to automatically set all viewports so the annotation scale is equal to the viewport scale. I use Eagle Point to create plan and profile sheets, when it creates a viewport, it applies the viewport scale, but does not adjust the annotation scale. It would be nice to have this done automatically so our hatches and other annotative objects show up properly.
Thanks,
Re: match annotation scale to viewport scale
Eh...that's a rough one. I don't have a direct answer, but a trick. You can select multiple Viewports (or use a the selection filter) and set them all that way. I'm not familiar with how Eagle Point works anymore (thankfully), but I can't think of any other way. Maybe one of the geniuses in the LISP and API forums have a trick up their sleeves?
Re: match annotation scale to viewport scale
Quote:
Originally Posted by
CADDmanVA
... Maybe one of the geniuses in the LISP and API forums have a trick up their sleeves?
It just so happens that I've been working on that this week. My proof-of-concept code works, but it will be the end of the week before I can revisit the code for final polish.
Re: match annotation scale to viewport scale
Quote:
Originally Posted by
RobertB
It just so happens that I've been working on that this week. My proof-of-concept code works, but it will be the end of the week before I can revisit the code for final polish.
Wow. Thanks Robert. I didn't expect a response that quick, or without having to post it in the LISP forums. Wow! :beer:
Re: match annotation scale to viewport scale
Quote:
Originally Posted by
CADDmanVA
Wow. Thanks Robert. I didn't expect a response that quick, or without having to post it in the LISP forums. Wow! :beer:
I'm confused, this is the LISP forum. anyway, Robert, bring it on, I tried a couple of other methods that someone gave me to try and they didnt seem to work the way I expected, too much user interaction.
Re: match annotation scale to viewport scale
Quote:
Originally Posted by
ccowgill
I'm confused, this is the LISP forum. anyway, Robert, bring it on, I tried a couple of other methods that someone gave me to try and they didnt seem to work the way I expected, too much user interaction.
Whoops...my bad. I thought this was the Annotative Scale forum. :Oops:
Re: match annotation scale to viewport scale
Quote:
Originally Posted by
RobertB
It just so happens that I've been working on that this week. My proof-of-concept code works, but it will be the end of the week before I can revisit the code for final polish.
Any chance that you had time to polish your program? I am planning on working on redoing our Eagle Point settings over the long holiday and would like to look at starting to use annotative objects
Re: match annotation scale to viewport scale
just to bring this back to the top, does anyone have any advice on how to achive this. I have a program started, but I learned that to set annotation scale in paperspace, you need to have the viewport currently selected, is there a way to have AutoCAD physically select an object so it is highlighted?, so I can run cannoscale and assign the proper scale to that viewport? Here is the code I have that doesnt work, but I figure it has to be close.
Code:
(defun c:annoscalematch (/ viewports count
vportcount vport vportheight
vportdistance vportscale vportscale2
)
(if (and (equal (getvar "cannoscalevalue") 1.0 0.1)
(wcmatch (getvar "dwgname") "RCp*")
) ;_ end of and
(progn
(setq viewports (ssget "_X" '((0 . "VIEWPORT") (8 . "Viewport")))
count 0
vportcount (sslength viewports)
) ;_ end of setq
(while (< count vportcount)
(setq vport (ssname viewports count)
) ;_ end of setq
(if (equal (cdr (assoc 40 (entget vport))) 30 0.1)
(progn
(setq
vportheight
(cdr (assoc 41 (entget vport)))
vportdistance
(cdr (assoc 45 (entget vport)))
vportscale
(/ 1 (/ vportheight vportdistance))
vportscale2 (strcat "1:" (rtos vportscale 2 0))
) ;_ end of setq
(setvar "cannoscale" vportscale2)
) ;_ end of if
(setq count (1+ count))
) ;_ end of setq
) ;_ end of while
) ;_ end of progn
) ;_ end of if
) ;_ end of defun
Re: match annotation scale to viewport scale
Good job on finding a start to this problem. You will need to adjust your cvport system variable to the current viewport you are working with in your selection set. However, if the cvport variable is equal to 1, meaning paperspace, AutoCAD does not allow changing it to a different space value. :confused: You will need to change to modelspace prior to changing each viewport's cannoscale.
Try the following code
Code:
(defun c:annoscalematch (/ CVPORT CVPRT TMODE
VPANNOSCALE VPDIST VPHEIGHT
VPID VPSCALE VPWIDTH
)
(if (wcmatch (getvar "dwgname") "RCp*")
(progn
(setq cvprt (getvar "cvport")
tmode (getvar "tilemode")
)
(if (= 1 (setq tmode (getvar "tilemode")))
(setvar "tilemode" 0)
)
(if (/= 1 (setq cvprt (getvar "cvport")))
(setvar "cvport" 1)
)
(setq viewports (ssget "_X" '((0 . "VIEWPORT") (8 . "Viewport")))
count (sslength viewports)
)
(repeat count
(setq vport (entget (ssname viewports (setq count (1- count))))
vpid (cdr (assoc 69 vport))
)
(if (/= vpid 1)
(progn
(command "mspace")
(setq vpwidth (cdr (assoc 40 vport))
vpheight (cdr (assoc 41 vport))
vpdist (cdr (assoc 45 vport))
vpscale (/ 1 (/ vpheight vpdist))
vpannoscale (strcat "1:" (rtos vpscale 2 0))
)
(setvar "cvport" vpid)
(setvar "cannoscale" vpannoscale)
)
)
)
)
)
(if (and (= cvport 1)
(/= (getvar "cvport") cvport)
)
(command "pspace")
)
(if (/= tmode (getvar "tilemode"))
(setvar "tilemode" tmode)
)
(princ)
)
I'm not sure on your limiting of viewport widths to only viewports with a width of 30. I have removed that check as many of my viewports are not that specific width. If you removed the check on the drawing name, this routine could also be used on more drawings.
Re: match annotation scale to viewport scale
I'll give it a shot. the reason I have the name check and the width is that I have it designed so when Eagle Point finishes creating the sheet, I can hopefully get it to automatically change the scale, with no user interaction. Like I said, I wil give it a try and see if I can get it to work.
*edit - I have tried it and the only problem with it is that when it gets to the end, it doesnt switch back to paperspace, but after adding
before the princ, it works perfect, thanks for the nudge in the right direction.