The following functions are copied and combined from this group. The paper size name collected are not 100% same as what you can see in ACAD plot dialog. Maybe someone know if I use the wrong classes or functions.
Sub ReadPloterInfo() Dim plsvalidator As PlotSettingsValidator = PlotSettingsValidator.Current Dim devicelist As System.Collections.Specialized.StringCollection devicelist = plsvalidator.GetPlotDeviceList() For Each str As String In devicelist list.Add(str) Next End Sub Sub ReadPPaperInfo(ByVal Plotterconfig As String) Dim plsvalidator As PlotSettingsValidator = PlotSettingsValidator.Current Dim doc As Autodesk.AutoCAD.ApplicationServices.Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument Dim pConfig As Autodesk.AutoCAD.PlottingServices.PlotConfig = Autodesk.AutoCAD.PlottingServices.PlotConfigManager.SetCurrentConfig(Plotterconfig) If TypeOf (pConfig) Is Autodesk.AutoCAD.PlottingServices.PlotConfig Then pConfig.RefreshMediaNameList() Dim PlotPaperList As System.Collections.Specialized.StringCollection = pConfig.CanonicalMediaNames For Each str As String In PlotPaperList list.Add(str) Next End Sub
Those size name with 'user' seems are user defined. How can I change them to meaningful name?
Thank you.
The paper size names you are looking at are the "CanonicalMediaNames". This is the "plotDeviceName" name you pass to the PlotSettingsValidator with SetPlotConfiguartionName. The paper size you want to see is the "LocalMediaName" that you can get by passing a "CanonicalMediaName" to the GetLocalMediaName as in:
_PaperName = PlotConfigManager.CurrentConfig.GetLocalMediaName(_CanMediaName)
I am new at this. As far as I know it is not possible to plot with the LocalMediaName without creating some code that returns a CanonicalMediaName given a LocalMediaName. What I do, using a rude and crude brute force method, is concatenate the Canonical name to its Local name with a | separator when filling the selector combo box. The local name is then stripped of the selection to leave the canonical name when it comes time to have the correct plotDeviceName.
Perhaps someone can show a more elegant (probably any) method.