Display Box for Print area

Discussion in 'AutoCAD' started by MickyV, May 12, 2004.

  1. MickyV

    MickyV Guest

    I'm trying to write a macro that will display a box representing the printable area of a page, centred about the cursor, so that the user can see what will fit on the page while selecting the print area.

    I tried using a block to do this, because when you use the AutoCAD "INSERT" command, the block is displayed when you are prompted to pick a point. I've tried inserting the block, then moving it with VBA, but nothing is displayed.

    Does anyone have any ideas?

    Thanks,
    Mick.
     
    MickyV, May 12, 2004
    #1
  2. MickyV

    akseidel Guest

    Yes. Here is an idea that seems to work. I tried it today. The
    exception in this case is that I want the print area handle to be a
    corner, not the middle as you want. I want to snap it to an element.
    The basic scheme is to place a scaled block and jump into moving it
    right away. The effect is that of a dynamic rectangle placement.

    1) Start with a block defined as "PrntRec" that is a rectangle 1 unit by
    1 unit. I plan to create the block definition on the fly in the VBA. I
    tested this with the block already defined.

    2) Calculate the necessary X and Y scale values for the PrntRec
    rectangle that corresponds to the print area size and the intended
    scale. For example, in modelspace a 1/8" scale plot on a 8.5" wide by
    11" tall print area the values would be: xscale 8*12*8.5 , yscale
    8*12*11 for the drawing units being inches.

    3) Get a point with a prompt something like, "Click in the view from
    which you want to plot." The purpose here is to collect a point within
    the current view area to place the block so that it can be then
    instantly picked up by the macro to appear as a dynamic shape. For some
    reason this method does not work if the block is placed out of view.
    The block can be placed out of the view but it cannot be moved with the
    conventional AutoCAD move technique that this method uses.

    4) Extract the returned point's x and y values. Create a string
    strPrntRecPt that equals the xvalue & "," yvalue. This string will be
    passed to the AutoCAD move command as the origin point from which to
    move the print area block.

    5) Using the point returned from the getpoint, place the PrntRec block
    at this returned point at the xscale and yscale values as previously calculated.

    6) Now imeadiately issue a sendcommand string consisting of move last
    <accept> strPrntRecPt with the correct number of vbCRs intermixed in the
    string so that AutoCAD gets the right message.

    7) You will now be left with AutoCAD waiting for the destination input
    point for a move command that is moving the correctly sized PrntRec
    block clearly visible and moving with the pointer.

    So now what is planned next? I'm planning to use the rectangle as the
    plot window for immeadiatly plotting the contents, bypassing the AutoCAD
    print interface. It may not be possible to retrieve that last input
    point. Plan B will be to selectionset scan for the PrntRec block. The
    coordinates will then be in hand. The block will be deleted. What are
    you plans if I may ask?

    I'll post the testing code as soon as possible.

    AKS
     
    akseidel, May 14, 2004
    #2
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.