See the top rated post in this thread. Click here

Results 1 to 10 of 18

Thread: Plot window randomly offset

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nijmegen, NL
    Login to Give a bone

    Default Plot window randomly offset

    Hello to all,
    I am trying to hardcode X and Y coordinates for multiple plotwindows within ModelSpace.
    The initial plotsettings are made with the common plot dialog.
    The new lowerleft and upperright coordinates are retrieved by GetBoundingBox for several blocks and polylines.

    Sub PlotMultipleAreas()
    Dim Dwg As AcadDocument
    Dim SS As AcadSelectionSet
    Dim acObj As AcadObject
    Dim acBl As AcadBlockReference
    Dim acLwP As AcadPolyline
    Dim ObjectNames As String
    Set Dwg = ActiveDocument
    Set SS = Dwg.SelectionSets.Add("SS")
    Dwg.ActiveSpace = acModelSpace
    With SS
    End With
    If SS.Count = 0 Then GoTo QuitSub
    ObjectNames = "AcDbPolyline, AcDbBlockReference"
    For Each acObj In SS
        If InStr(1, ObjectNames, acObj.ObjectName) = 0 Then GoTo NextObject
        acObj.GetBoundingBox pt1, pt2
        With Dwg.ModelSpace.Layout
            .PlotType = acWindow
            .CenterPlot = True
            .SetWindowToPlot ConvPt(pt1), ConvPt(pt2)
            .GetWindowToPlot pt1, pt2
        End With
        Dwg.Plot.DisplayPlotPreview acFullPreview
    Next acObj
    Set SS = Nothing
    Set Dwg = Nothing
    End Sub
    Function ConvPt(Pt As Variant) As Variant
    Select Case UBound(Pt)
        Case 1
            ReDim Preserve Pt(2)
            Pt(0) = Pt(0): Pt(1) = Pt(1): Pt(2) = 0
        Case 2
            ReDim Preserve Pt(1)
            Pt(0) = Pt(0): Pt(1) = Pt(1)
    End Select
    ConvPt = Pt
    End Function
    I use ConvPt(pt) for transforming two-element to three-element array of doubles and back.

    In the plotpreview / hardcopy there is a significant, constant, totally random offset present. Am I missing something ?

    Thanks in advance for your help.
    Kind regards,
    Erik Wijbrandts
    Last edited by Ed Jobe; 2011-10-18 at 02:43 PM. Reason: Added code tags

Similar Threads

  1. Replies: 5
    Last Post: 2012-03-02, 04:33 PM
  2. How Do I Plot PaperSpace View w/ NO Offset?
    By chillme1 in forum AutoCAD Plotting
    Replies: 2
    Last Post: 2009-01-14, 12:19 PM
  3. What is procedure for setting Plot Offset?
    By gpapp in forum VBA/COM Interop
    Replies: 5
    Last Post: 2008-01-10, 02:09 AM
  4. Setting plot window in plot preview
    By IanR in forum AutoCAD Wish List
    Replies: 1
    Last Post: 2006-04-18, 07:51 PM
    By jasontirone in forum ACA General
    Replies: 0
    Last Post: 2004-12-17, 03:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts