problem set active viewport when splited

problem set active viewport when splited

Anonymous
Not applicable
404 Views
4 Replies
Message 1 of 5

problem set active viewport when splited

Anonymous
Not applicable
I want zoom splited viewports in model space with different's directions (top, front...), center and magnitudes. But, when I change the current viewport, all the others lost the zoom I had set.
...
For Each vport In ThisDrawing.Viewports
ThisDrawing.ActiveViewport = vport 'here the others lost the zoom I had set
...
When I alter the current viewport manually, clicking in the viewports, it's not occurs.
I see others topics describing the same problem, but no reply, then I'm trying to change the current viewport by 'sendcommand'. Any help to do this?

thanks
0 Likes
405 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
would you post the routine please.
0 Likes
Message 3 of 5

Anonymous
Not applicable
Sub VportsUpdate()
Dim vport As AcadViewport
Dim dirTop(0 To 2) As Double
Dim dirFront(0 To 2) As Double

'draw a circle in origin
ThisDrawing.ModelSpace.AddCircle dirTop, 10

'if not splited, split the viewport
If ThisDrawing.Viewports.Count = 1 Then
ThisDrawing.ActiveViewport.Split acViewport2Horizontal
ThisDrawing.Regen acAllViewports
VportsUpdate
End If
'here is the code
For Each vport In ThisDrawing.Viewports
ThisDrawing.ActiveViewport = vport
If vport.UpperRightCorner(1) = 0 Then vport.Direction = dirTop
If vport.UpperRightCorner(1) = 0.5 Then vport.Direction = dirFront
ThisDrawing.Application.ZoomExtents
Next vport

End Sub

If you stop the execution in the 'Next vport' line, you can see the good result in the Acad window... but after the next 'thisdrawing.activeviewport = vport', the zoomextend is missed.
0 Likes
Message 4 of 5

Anonymous
Not applicable
sorry, in the code paste I forgot initialize the dirTop and dirFront after draw the circle.

dirTop(0) = 0: dirTop(1) = 0: dirTop(2) = 1
dirFront(0) = 0: dirFront(1) = -1: dirFront(2) = 0
0 Likes
Message 5 of 5

Anonymous
Not applicable
Hello,

Do you have a solution on this problem?

Thank you,
Cata
0 Likes