.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Window Coordinate (Extents) bug Plot Setting Window

1 REPLY 1
Reply
Message 1 of 2
Anonymous
312 Views, 1 Reply

Window Coordinate (Extents) bug Plot Setting Window

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?
1 REPLY 1
Message 2 of 2
Human.Man.Name=Jose
in reply to: Anonymous

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost