addPViewport not saved

Discussion in 'AutoCAD' started by Mark Gardiner, Aug 18, 2004.

  1. Hi,

    At the moment I have a routine that iterates thought all VP's in paperscace and if it is not set up correctly It deletes them
    then Icreates a new VP using addPViewport. I use mm units

    I can creat the viewport fine, but it is not saved with the drawing (but the preview is) and when opened the drawing is zoomed in by ariund 2.5 times. If I do not use foundVP.Delete and just adsd a viewport with pSpace.addPViewport it is saved in the drawing.

    Has anyone else come accross this?

    Thanks
    Mark
     
    Mark Gardiner, Aug 18, 2004
    #1
  2. Nope, but why not post your code. The problem could be elsewhere like
    setting your object to nothing before saving or an issue with scaling -
    since it is zoomed in roughly 2.5x. You could also remove ALL error
    handling and make sure Option Explicit it declared. You could be masking
    the true error if you are using an errant On Error Resume Next. Just a few
    things to try.

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Aug 18, 2004
    #2
  3. Mark Gardiner

    markgardiner Guest

    Thanks Mike

    I have tracked the error down to the myVP.Delete
    by commenting out line by line
    '
    '
    For Each obj In Dwg.PaperSpace
    If TypeOf obj Is AcadPViewport Then
    Set xVP = obj
    Set obj = Nothing
    If Not xVP.CustomScale = 0.1 Then
    xVP.Delete ' If I comment out this line code works fine
    Set xVP = Nothing
    Else
    bVP = True
    End If
    End If
    Next
    Set VP = Nothing
    '
    '
    If Not bVP Then
    Pnt(0) = 400.5: Pnt(1) = 304.5: Pnt(2) = 0#
    Set VP = Dwg.PaperSpace.AddPViewport(Pnt, 777#, 499#)
    Dwg.Regen acAllViewports
    VP.Display True
    End If
    '
    '
     
    markgardiner, Aug 18, 2004
    #3
  4. Mark Gardiner

    markgardiner Guest

    Ah,

    Just tried the same code in acad 2005 and works fine
    But does not work in acad 2002 or 2004
     
    markgardiner, Aug 18, 2004
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.