centering AcadPViewport

Discussion in 'AutoCAD' started by ygrigoryev, Nov 1, 2005.

  1. ygrigoryev

    ygrigoryev Guest

    hi all
    i am new to AutoCAD and trying to come up with a function to properly
    scale an ActivePViewport looking at block with a given insertion point
    by applying custom scale that is a just function of a block's
    dimensions (makes blocks of different dims fit in the ActivePViewport)

    doc.ActivePViewport.StandardScale=AcViewportScale.acVpCustomScale;
    doc.ActivePViewport.CustomScale = somescalefactor;

    which works great. but it seems that unless the ActivePViewport is
    perfectly centered and is looking at the center of the block, applying
    a scale factor offsets the block towards the borders of the viewport,
    potentially clipping the block.

    i have no trouble finding the needed AcadPViewport, making it active
    and working with its properties, but do not understand changing which
    ones will achieve the centering I need. We have:

    AcadPViewport.Center
    AcadPViewport.Target

    that reference arrays of three doubles, but I could find little
    information which coordinate systems they work with and what they do
    and how they work together (if). knowing insert point and dims of a
    block can give us its center in mspace, but how can we center pviewport
    over it?

    my autocad terminology prob. sucks, but i'm hoping i communicated the
    message.

    i appreciate any help,
    thanks.
     
    ygrigoryev, Nov 1, 2005
    #1
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.