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

Update Plotter Device List

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
SENL1362
677 Views, 4 Replies

Update Plotter Device List

Recently i discovered that my Plotter Device List is not beeing refreshed after a AutoCAD profile change using:

PlotConfigManager.RefreshList(RefreshCode.All);

 

Neither could i find a Refresh function in the UserConfigurationManager:

Application.UserConfigurationManager.xxREFRESHxx

 

Run the following code twice, before and after a profile change, and for each profile a different  Plotter Configuration Search path.

Notice the differences in the PC3 contents.

 

       [CommandMethod("LPD")]
        public void ListPlotDevices()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;
            PlotSettingsValidator plotSettingsValidator = PlotSettingsValidator.Current;

            //The Device list generated by the plotSettingsValidator is not refreshed
            //  after a AutoCAD Profile change -- within the same autoCAD session
            PlotConfigManager.RefreshList(RefreshCode.All);
            var pc3ListByPSV = plotSettingsValidator.
                                                   GetPlotDeviceList().
                                                   Cast<string>().
                                                   Where(pd => Regex.IsMatch(pd,"PC3$",RegexOptions.IgnoreCase)).
                                                   ToList();
            ed.WriteMessage("\nPlot Device List by PlotSettings Validator:");
            pc3ListByPSV.ForEach(pd => ed.WriteMessage("\n{0}", pd));

            dynamic acadPreferences = Application.Preferences;
            dynamic acadPrefsFiles = acadPreferences.Files;
            string acadprinterConfigPath = acadPrefsFiles.PrinterConfigPath;
            ed.WriteMessage("\n\nPrinter Config Path:{0}", acadprinterConfigPath);
            var pc3ListByDir = Directory.EnumerateFiles(acadprinterConfigPath, "*.pc3").Select(n => Path.GetFileName(n)).ToList();
            ed.WriteMessage("\nPlot Device List(PC3) by Directory search:");
            pc3ListByDir.ForEach(pd => ed.WriteMessage("\n{0}", pd));
        }

 

Any tips are welcome.

 

 

 

4 REPLIES 4
Message 2 of 5
Balaji_Ram
in reply to: SENL1362

Hi Anton,

 

Sorry for the delay.

 

Can you please try this code snippet to refresh the list ?

 

using (Transaction Tx = doc.Database.TransactionManager.StartTransaction())
{
    LayoutManager layoutMgr = LayoutManager.Current;
    Layout layout = Tx.GetObject(layoutMgr.GetLayoutId(layoutMgr.CurrentLayout), OpenMode.ForWrite) as Layout;
    plotSettingsValidator.RefreshLists(layout);
    Tx.Commit();
}

Regards,

Balaji 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 3 of 5
SENL1362
in reply to: Balaji_Ram

Hello Balaji_Ram ,
Thank you for you're time, this indeed solved the issue.

But does that mean that
PlotConfigManager.RefreshList(RefreshCode.All);
is worthless?

 

 

Message 4 of 5
Balaji_Ram
in reply to: SENL1362

Sorry, I am not aware of the reason why the other PlotConfigManager.RefreshList would not work.

 

I will let you know if I find anything related to this.

 

Regards,

Balaji



Balaji
Developer Technical Services
Autodesk Developer Network

Message 5 of 5
SENL1362
in reply to: Balaji_Ram

No hurry, just curios to the reason why.
I'l Appreciate you're support.

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