• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Active Contributor
    Posts: 44
    Registered: ‎04-12-2005

    Window Coordinate (Extents) bug Plot Setting Window

    78 Views, 1 Replies
    07-18-2005 01:42 PM
    Try this ..

    Open an empty drawing.

    Activate the "Model Space" tab

    Create a line from 0,0 to 34,22

    Create a plot setting using the ends of the line (0,0 34,22)

    Name the plot setting "Temp"

    Save the drawing

    Run this code

    Public Sub Test()
    Dim oAcadDB As Database = Application.DocumentManager.MdiActiveDocument.Database
    Dim oAcadTM As DBTransMan = oAcadDB.TransactionManager
    Dim oAcadTR As Transaction = oAcadTM.StartTransaction()
    Dim oAcadPSDictID As ObjectId = oAcadDB.PlotSettingsDictionaryId
    Dim oAcadPSdict As DBDictionary
    Dim oPSVal As PlotSettingsValidator = PlotSettingsValidator.Current
    oAcadPSdict = CType(oAcadTR.GetObject(oAcadPSDictID, OpenMode.ForRead, False, False), DBDictionary)
    Dim oDictEntry As DictionaryEntry
    Dim PSExist As Boolean
    Dim PSObjectID As ObjectId
    Dim PSisLayout As Boolean
    For Each oDictEntry In oAcadPSdict
    If oDictEntry.Key = "Test" Then
    PSExist = True
    PSObjectID = oDictEntry.Value
    Exit For
    End If
    Next
    Dim PSPlotSettings As Autodesk.AutoCAD.DatabaseServices.PlotSettings
    If PSExist Then
    PSPlotSettings = CType(oAcadTR.GetObject(PSObjectID, OpenMode.ForRead, False, False), PlotSettings)
    Dim strTemp As String
    Dim oExtents2d As Autodesk.AutoCAD.DatabaseServices.Extents2d = PSPlotSettings.PlotWindowArea
    strTemp = "X1 = " & CStr(oExtents2d.MinPoint.X) & " Y1 = " & CStr(oExtents2d.MinPoint.Y)
    strTemp = strTemp & " X2 = " & CStr(oExtents2d.MaxPoint.X) & " Y2 = " & CStr(oExtents2d.MaxPoint.Y)
    MsgBox(strTemp)
    oAcadTR.Commit()
    End If

    If Not Nothing Then oAcadPSdict = Nothing
    If Not Nothing Then oAcadPSDictID = Nothing
    oPSVal.Dispose()
    If Not Nothing Then oPSVal = Nothing
    oAcadTR.Dispose()
    oAcadTM.Dispose()
    If Not Nothing Then oAcadDB = Nothing
    If Not Nothing Then oAcadTM = Nothing
    If Not Nothing Then oAcadTR = Nothing

    End Sub

    ::::::::::::::::::::::::::::::::::::::::::::::::\

    Note that the coordinates returned have an amibiguis relationship with the (0,0 34,22) coordinates that were manually used to define the plot setting.

    Am I missing something, or is this a bug?
    Please use plain text.
    Contributor
    Posts: 11
    Registered: ‎01-05-2007

    Re: Window Coordinate (Extents) bug Plot Setting Window

    01-30-2007 05:18 PM in reply to: Chris Ludtke
    Did you ever figure this one out? Currently having similar problem, don't know how to get extents exactly and having hard time setting new plotsettings current. Any help is appreciated.
    Please use plain text.