Create view VBA

Discussion in 'AutoCAD' started by dan01, Feb 20, 2004.

  1. dan01

    dan01 Guest

    Is there a way to create a view through vba that allows for a window option? I tried to zoomwindow then set the view but that did not work. Any thoughts would help

    Dan
     
    dan01, Feb 20, 2004
    #1
  2. Huh? That's the way it does work - specify the center point and the
    height and width - which is a window. So, work backwards - pick your
    window and calc the center point, height & width.
    ___________________________
    Mike Tuersley
    CADalyst's AutoCAD Clinic
    Rand IMAGINiT Technologies
     
    Mike Tuersley, Feb 20, 2004
    #2
  3. dan01

    dan01 Guest

    Hi Mike,
    I thought that it would be easy, I think I might be missing something.

    Here my code it looks good to me?
    ========================================
    'draw line accross proposed vport
    Set Vpline = ThisDrawing.ModelSpace.AddLine(VpPnt, VpPnt2)
    'get mid point of vport
    Vpline.ScaleEntity VpPnt, 0.5
    'zoom window
    ZoomWindow VpPnt, VpPnt2
    'add vport
    Set VpObject = ThisDrawing.Views.Add(VpName)
    'set center of vport
    VpObject.Center = Vpline.EndPoint 'my code errors here
    VpObject.Width = VpW
    VpObject.Height = VpH

    If you see anything wrong with the code please let me know.

    Thanks,
    Dan
     
    dan01, Feb 20, 2004
    #3
  4. Center has to be a 2 dimensional array of doubles, not a 3 dim.
    Something like --->

    Dim cPt(1) as Double

    cPt(0) = Vpline.EndPoint(0)
    cPt(1) = Vpline.EndPoint(1)

    VpObject.Center = cPt

    ___________________________
    Mike Tuersley
    CADalyst's AutoCAD Clinic
    Rand IMAGINiT Technologies
     
    Mike Tuersley, Feb 20, 2004
    #4
  5. dan01

    dan01 Guest

    Thanks that worked
     
    dan01, Feb 20, 2004
    #5
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.