Viewports get deleted

Viewports get deleted

NGVBA
Contributor Contributor
672 Views
3 Replies
Message 1 of 4

Viewports get deleted

NGVBA
Contributor
Contributor

Hi All

I created viewports in various layouts and zoom window locked it.

All the stuff is visible before saving, after saving when I reopen it, all the viewports are not available and I need to do it manually.@norman

     acadDoc.ActiveSpace = 0
    ViewPinsertionPoint(0) = 504.5
    ViewPinsertionPoint(1) = 420.5
    ViewPinsertionPoint(2) = 0
    newViewport = "newViewport" & i
    Set newViewport = acadDoc.PaperSpace.AddPViewport(ViewPinsertionPoint, 979, 811)

    acadApp.ZoomExtents
    newViewport.Display (True)
    acadDoc.MSpace = True
    
    UpperLeft(0) = ThisWorkbook.Worksheets("Execute").Range("cf" & i - 7).Value  ' X-coordinate of lower-left corner
    UpperLeft(1) = ThisWorkbook.Worksheets("Execute").Range("cg" & i - 7).Value
    UpperLeft(2) = 0

    LowerRight(0) = ThisWorkbook.Worksheets("Execute").Range("ch" & i - 7).Value
    LowerRight(1) = ThisWorkbook.Worksheets("Execute").Range("ci" & i - 7).Value
    LowerRight(2) = 0
    
    
    
    
acadDoc.Application.ZoomWindow UpperLeft, LowerRight

acadDoc.MSpace = False

newViewport.DisplayLocked = True

 

0 Likes
673 Views
3 Replies
Replies (3)
Message 2 of 4

Ed__Jobe
Mentor
Mentor

In the code you show, you never saved the dwg.

activeDoc.Save()

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 4

NGVBA
Contributor
Contributor

Thanks Ed, Above is just part of the code hence . I am saving the drawing, in fact I have saved the drawing manually also and everything is fine before closing but when I reopen it all viewports are not available.

0 Likes
Message 4 of 4

Ed__Jobe
Mentor
Mentor

Then can you post a complete code sample that we can test?

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes