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

Paper size name of plotter confused

1 REPLY 1
Reply
Message 1 of 2
harryliu3140
463 Views, 1 Reply

Paper size name of plotter confused

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.

 

1 REPLY 1
Message 2 of 2
aksaks
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. 

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