| Author |
Message |
milfora
Guest
|
Posted:
Thu Mar 31, 2005 3:41 am Post subject:
Paperspace Viewports |
|
|
I have setup an event procedure which is activated when the user enters a floating modelspace window (command MSPACE). What I want is for the program to return the properties of the viewport the user has entered (ie. CustomScale, Height, Width etc)
The following code does not appear to work, as the ActivePViewport returned is that of the actual Paperspace layout.
Is there a way to set the active pviewport to the viewport the user enters on the MSPACE command?
Public Sub Floating_Modelspace_DwgScale(X)
' declare variables
Dim oPViewport As AcadPViewport
Dim Scl, Width, Height As Single
Set oPViewport = ThisDrawing.ActivePViewport
oPViewport.Display (True)
Scl = oPViewport.CustomScale
Width = oPViewport.Width
Height = oPViewport.Height
End Sub
Thanks in advance
AM
|
|
| Back to top |
|
 |
Jeff Mishler
Guest
|
Posted:
Thu Mar 31, 2005 4:11 am Post subject:
Re: Paperspace Viewports |
|
|
How is your Event fired?
The following works for me in R2002...
Private Sub AcadDocument_EndCommand(ByVal CommandName As String)
Select Case UCase(CommandName)
Case Is = "MSPACE"
Floating_Modelspace_DwgScale (CommandName)
End Select
End Sub
Public Sub Floating_Modelspace_DwgScale(X)
' declare variables
Dim oPViewport As AcadPViewport
Dim Scl, Width, Height As Single
Set oPViewport = ThisDrawing.ActivePViewport
oPViewport.Display (True)
Scl = oPViewport.CustomScale
Width = oPViewport.Width
Height = oPViewport.Height
MsgBox "Scale = " & Scl & vbCrLf & "Width = " & Width & vbCrLf & "Height
= " & Height
End Sub
--
Jeff
check out www.cadvault.com
"milfora" <nospam@address.withheld> wrote in message
news:32065915.1112222518301.JavaMail.jive@jiveforum2.autodesk.com...
| Quote: | I have setup an event procedure which is activated when the user enters a
floating modelspace window (command MSPACE). What I want is for the program
to return the properties of the viewport the user has entered (ie.
CustomScale, Height, Width etc)
The following code does not appear to work, as the ActivePViewport
returned is that of the actual Paperspace layout.
Is there a way to set the active pviewport to the viewport the user enters
on the MSPACE command?
Public Sub Floating_Modelspace_DwgScale(X)
' declare variables
Dim oPViewport As AcadPViewport
Dim Scl, Width, Height As Single
Set oPViewport = ThisDrawing.ActivePViewport
oPViewport.Display (True)
Scl = oPViewport.CustomScale
Width = oPViewport.Width
Height = oPViewport.Height
End Sub
Thanks in advance
AM |
|
|
| Back to top |
|
 |
milfora
Guest
|
Posted:
Thu Mar 31, 2005 4:46 am Post subject:
Re: Paperspace Viewports |
|
|
Jeff,
Thanks for the quick response.
My event was fired from the AcadDocument_BeginCommand event. Code shown below:
Private Sub AcadDocument_BeginCommand(ByVal CommandName As String)
On Error Resume Next
' check for following cases
Select Case CommandName
Case "MSPACE"
' if user enters a floating modelspace window
Floating_Modelspace_DwgScale 1
End Select
End Sub
I have just put the calling procedure in the wrong event (should have been the AcadDocument_EndCommand event)
This has fixed the problem nicely
Thanks again
|
|
| Back to top |
|
 |
|
|
|
|