.NET
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Window Coordinate (Extents) bug Plot Setting Window
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.Data base
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?
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.Data
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?
Re: Window Coordinate (Extents) bug Plot Setting Window
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.
