.NET

Reply
Active Contributor
46 Posts
0 Kudos
Registered: ‎10-29-2009
Post 1 of 2

Paper size name of plotter confused

269 Views, 1 Replies
11-17-2011 08:12 AM

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

 paper size.jpg

 

Those size name with 'user' seems are user defined. How can I change them to meaningful name?

 

Thank you.

 

Valued Contributor
93 Posts
1 Kudo
Registered: ‎03-23-2009
Post 2 of 2

Re: Paper size name of plotter confused

11-17-2011 11:24 AM in reply to: harryliu3140

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. 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!