Paperspace Viewports
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Paperspace Viewports

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
milfora
Guest





Posted: Thu Mar 31, 2005 3:41 am    Post subject: Paperspace Viewports Reply with 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
Jeff Mishler
Guest





Posted: Thu Mar 31, 2005 4:11 am    Post subject: Re: Paperspace Viewports Reply with quote

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 Reply with quote

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
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB