TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: hospitaller on November 21, 2005, 06:55:37 PM
-
We're trying to scale down a bunch of old files, basically scale down to 50% the titlesheets, the text blocks and the viewports using ),) as the origin, thats the easy part.
We'd also need to change the scale of the viewport to reflect the new scaled down size, thats also fairly easy, the problem is, as you can imagine, that the already scaled down viewport "moved", so the contents of the viewport "shift".
Is there a way to make the contants of the viewports remain anchored relative to the center of the VP, so that when they scale down, and we manually change their scales, the contents remain perfectly aligned as they were originally?
Did I even make sense?
TIA
Hector Rojas
-
You would have to activate each model space viewport, get the value of cvport and then get the mid point like.
(mapcar '(lambda (a b) (/ (+ a b) 2.0)) (getvar "vsmin") (getvar "vsmax"))
Then scale all the viewports down, go back into each on, scale down the view, then pan form the new mid point, to the old one.
Just an idea.
Tim
-
Forgive me for not quite understanding, but what purpose would this serve? It won't reduce your file size, you can plot it at any scale you want to already, so I just don't see the point?!?!
I could probably give you a hand if you could convince me otherwise........
-
We inherited a series of drawings that were NOT drawn in real world units,
they were drawn scaled up, don't ask, I just deal with the aftermath....
Anyway, we need to scale them down by a user defined percentage, origin
point 0,0 and then change the plot scale of the viewports, problem is, as
seen in the 2 images in the middle, the contents shift, if we change the
pl
otscale of the vport prior to scaling them down, we end up with the same
problem.
We need to be able to have the plotscale of the viewport somehow use PSPACE
0,0 to scale the vport contents.
Is this even possible?
Thanks in advance
(http://i29.photobucket.com/albums/c299/hectorrojas/untitled2.jpg)
-
This is
- Really quick
- Really dirty
- Not lisp
- Not pretty
but shows you a way that it can be done.Sub test()
Dim objEnt As AcadEntity
Dim objPVP As AcadPViewport
Dim dblBase(0 To 2) As Double
Dim dblScale As Double
dblScale = ThisDrawing.Utility.GetReal("Scale Factor: ")
dblBase(0) = 0: dblBase(1) = 0: dblBase(2) = 0
For Each objEnt In ThisDrawing.PaperSpace
If TypeOf objEnt Is AcadPViewport Then
Set objPVP = objEnt
objPVP.DisplayLocked = False
objPVP.ScaleEntity dblBase, dblScale
Else
objEnt.ScaleEntity dblBase, dblScale
End If
Next objEnt
End Sub