<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic eDeviceNotFound Error when validating PlotInfo in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/edevicenotfound-error-when-validating-plotinfo/m-p/3758278#M51478</link>
    <description>&lt;P&gt;I am having problems when trying to modify Layouts plot settings.&amp;nbsp; I am using the same approach to plot the layouts and it works fine.&amp;nbsp; Also, it works well when modifying the plot settings for the ModelSpace layout.&amp;nbsp; I&amp;nbsp;don't know what the problem is. &amp;nbsp;The ConfigurationName is correct, so is the CanonicalMediaName and the Scale.&amp;nbsp; I am not very clear about this process. Can someone take a look at my code and help me to figure out what is the problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Try

                Trans = db.TransactionManager.StartTransaction

                TableRec = CType(Trans.GetObject(db.CurrentSpaceId, OpenMode.ForWrite), BlockTableRecord)

                Layout = CType(Trans.GetObject(TableRec.LayoutId, OpenMode.ForWrite), Layout)

                PltSettings = New PlotSettings(Layout.ModelType)

                PltSettings.CopyFrom(Layout)

                PSValidator = PlotSettingsValidator.Current

                PSValidator.SetPlotConfigurationName(PltSettings, PlotInformation.PrinterName, PlotInformation.PaperSize)

                PSValidator.SetUseStandardScale(PltSettings, True)

                PSValidator.SetStdScaleType(PltSettings, PlotInformation.PlotScale)

                PSValidator.SetPlotType(PltSettings, PlotInformation.PlotExtents)

                PSValidator.SetPlotCentered(PltSettings, False)

                PSValidator.RefreshLists(PltSettings)

                PltInfo = New PlotInfo

                PltInfo.Layout = TableRec.LayoutId

                PltInfo.ValidatedSettings = PltSettings

                PltInfoValidator = New PlotInfoValidator

                PltInfoValidator.MediaMatchingPolicy = MatchingPolicy.MatchEnabled

                PltInfoValidator.Validate(PltInfo)

                Layout.CopyFrom(PltSettings)

                Trans.Commit()

                Return True

            Catch ex As Exception

                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

                Return False

            End Try&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I am getting the error message "eDeviceNotFound"&amp;nbsp;on the line&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PltInfoValidator.Validate(PltInfo)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 21 Jan 2013 19:34:55 GMT</pubDate>
    <dc:creator>HJohn1</dc:creator>
    <dc:date>2013-01-21T19:34:55Z</dc:date>
    <item>
      <title>eDeviceNotFound Error when validating PlotInfo</title>
      <link>https://forums.autodesk.com/t5/net-forum/edevicenotfound-error-when-validating-plotinfo/m-p/3758278#M51478</link>
      <description>&lt;P&gt;I am having problems when trying to modify Layouts plot settings.&amp;nbsp; I am using the same approach to plot the layouts and it works fine.&amp;nbsp; Also, it works well when modifying the plot settings for the ModelSpace layout.&amp;nbsp; I&amp;nbsp;don't know what the problem is. &amp;nbsp;The ConfigurationName is correct, so is the CanonicalMediaName and the Scale.&amp;nbsp; I am not very clear about this process. Can someone take a look at my code and help me to figure out what is the problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Try

                Trans = db.TransactionManager.StartTransaction

                TableRec = CType(Trans.GetObject(db.CurrentSpaceId, OpenMode.ForWrite), BlockTableRecord)

                Layout = CType(Trans.GetObject(TableRec.LayoutId, OpenMode.ForWrite), Layout)

                PltSettings = New PlotSettings(Layout.ModelType)

                PltSettings.CopyFrom(Layout)

                PSValidator = PlotSettingsValidator.Current

                PSValidator.SetPlotConfigurationName(PltSettings, PlotInformation.PrinterName, PlotInformation.PaperSize)

                PSValidator.SetUseStandardScale(PltSettings, True)

                PSValidator.SetStdScaleType(PltSettings, PlotInformation.PlotScale)

                PSValidator.SetPlotType(PltSettings, PlotInformation.PlotExtents)

                PSValidator.SetPlotCentered(PltSettings, False)

                PSValidator.RefreshLists(PltSettings)

                PltInfo = New PlotInfo

                PltInfo.Layout = TableRec.LayoutId

                PltInfo.ValidatedSettings = PltSettings

                PltInfoValidator = New PlotInfoValidator

                PltInfoValidator.MediaMatchingPolicy = MatchingPolicy.MatchEnabled

                PltInfoValidator.Validate(PltInfo)

                Layout.CopyFrom(PltSettings)

                Trans.Commit()

                Return True

            Catch ex As Exception

                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

                Return False

            End Try&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I am getting the error message "eDeviceNotFound"&amp;nbsp;on the line&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PltInfoValidator.Validate(PltInfo)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Jan 2013 19:34:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/edevicenotfound-error-when-validating-plotinfo/m-p/3758278#M51478</guid>
      <dc:creator>HJohn1</dc:creator>
      <dc:date>2013-01-21T19:34:55Z</dc:date>
    </item>
    <item>
      <title>Re: eDeviceNotFound Error when validating PlotInfo</title>
      <link>https://forums.autodesk.com/t5/net-forum/edevicenotfound-error-when-validating-plotinfo/m-p/3760953#M51479</link>
      <description>&lt;P&gt;Hi John,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a blog post that explains a way to list all the available media names and to choose one of them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://through-the-interface.typepad.com/through_the_interface/2007/10/allowing-select.html" target="_blank"&gt;http://through-the-interface.typepad.com/through_the_interface/2007/10/allowing-select.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the sample code in the blog post, you can make use of the “ChooseDeviceAndMedia” as :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;lt;code&amp;gt;&lt;/P&gt;
&lt;P&gt;String[] deviceAndMedia = new String[2];&lt;/P&gt;
&lt;P&gt;deviceAndMedia = ChooseDeviceAndMedia();&lt;/P&gt;
&lt;P&gt;String device = deviceAndMedia[0];&lt;/P&gt;
&lt;P&gt;String media = deviceAndMedia[1];&lt;/P&gt;
&lt;P&gt;&amp;lt;/code&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will help rule out any issues with incorrect device / media names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you still have the issue, can you please share the full code for me to reproduce the error ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2013 18:34:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/edevicenotfound-error-when-validating-plotinfo/m-p/3760953#M51479</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2013-01-24T18:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: eDeviceNotFound Error when validating PlotInfo</title>
      <link>https://forums.autodesk.com/t5/net-forum/edevicenotfound-error-when-validating-plotinfo/m-p/3763780#M51480</link>
      <description>&lt;P&gt;Balaji, thank you for your suggestion.&amp;nbsp; I get the canonicalmedialist to populate a dropdown to allow the user to select the desired media name.&amp;nbsp;&amp;nbsp;The program works fine when updating the plotsetting&amp;nbsp;of the model space layout.&amp;nbsp; I only get the error message when I try to update a paper space layout.&amp;nbsp; Is there any difference&amp;nbsp;between updating the model&amp;nbsp;and paper space layouts?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2013 04:51:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/edevicenotfound-error-when-validating-plotinfo/m-p/3763780#M51480</guid>
      <dc:creator>HJohn1</dc:creator>
      <dc:date>2013-01-29T04:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: eDeviceNotFound Error when validating PlotInfo</title>
      <link>https://forums.autodesk.com/t5/net-forum/edevicenotfound-error-when-validating-plotinfo/m-p/3764829#M51481</link>
      <description>&lt;P&gt;Hi John,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you passing "false" as the parameter to the "PlotSettings" constructor. For modelspace layout, it is "true" and for paperspace layouts it is "false". The convenient way is to use the "Layout.ModelType" to get this parameter right.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a sample code that set the plot settings for a paperspace layout.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps in identifying the issue with your code. If this does not help, can you please share a code snippet for me to reproduce the error ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;[CommandMethod("SetPS")]
public void SetPSMethod()
{
    Document doc = Application.DocumentManager.MdiActiveDocument;
    Editor ed = doc.Editor;
    Database db = doc.Database;

    Transaction tr = db.TransactionManager.StartTransaction();
    using (tr)
    {
        BlockTableRecord btr = tr.GetObject(db.CurrentSpaceId, OpenMode.ForRead) as BlockTableRecord;
        Layout lo = tr.GetObject(btr.LayoutId, OpenMode.ForRead) as Layout;

        PlotInfo pi = new PlotInfo();
        pi.Layout = btr.LayoutId;

        PlotSettings ps = new PlotSettings(lo.ModelType);
        ps.CopyFrom(lo);

        PlotSettingsValidator psv = PlotSettingsValidator.Current;

        psv.SetPlotType(ps, Autodesk.AutoCAD.DatabaseServices.PlotType.Extents);
        psv.SetUseStandardScale(ps, true);
        psv.SetStdScaleType(ps, StdScaleType.ScaleToFit);
        psv.SetPlotCentered(ps, true);

        psv.SetPlotConfigurationName(ps, "DWG To PDF.pc3", "ANSI_A_(8.50_x_11.00_Inches)");

        pi.OverrideSettings = ps;
        PlotInfoValidator piv = new PlotInfoValidator();
        piv.MediaMatchingPolicy = MatchingPolicy.MatchEnabled;
        piv.Validate(pi);

        lo.UpgradeOpen();
        lo.CopyFrom(ps);
        tr.Commit();
    }
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2013 07:01:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/edevicenotfound-error-when-validating-plotinfo/m-p/3764829#M51481</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2013-01-30T07:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: eDeviceNotFound Error when validating PlotInfo</title>
      <link>https://forums.autodesk.com/t5/net-forum/edevicenotfound-error-when-validating-plotinfo/m-p/3765703#M51482</link>
      <description>&lt;P&gt;Yes, I am.&amp;nbsp; if you look at the fourth code line [ PltSettings = New PlotSettings(Layout.ModelType) ] you can see it.&amp;nbsp; Now, one thing I am not clear about, what is the difference of [ PltInfo.ValidatedSettings = PltSettings ] as in my code or in your example [ pi.OverrideSettings = ps; ] apart from VB and C#? I would like to save the settings back to the Layout, simillar to Applaying the settings in the plot dialog box.&amp;nbsp; Thanks for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2013 05:59:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/edevicenotfound-error-when-validating-plotinfo/m-p/3765703#M51482</guid>
      <dc:creator>HJohn1</dc:creator>
      <dc:date>2013-01-31T05:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: eDeviceNotFound Error when validating PlotInfo</title>
      <link>https://forums.autodesk.com/t5/net-forum/edevicenotfound-error-when-validating-plotinfo/m-p/3765717#M51483</link>
      <description>&lt;P&gt;Hi John,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To include&amp;nbsp;proper error checking it is necessary to check if the plotInfo is validated and if so, access the ValidatedSettings. This is set after the validation is done by the Validate method. So it is not necessary for us to set it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the change to include such error checking&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;pi.OverrideSettings = ps;
PlotInfoValidator piv = new PlotInfoValidator();
piv.MediaMatchingPolicy = MatchingPolicy.MatchEnabled;
piv.Validate(pi);

if (pi.IsValidated)
{
    lo.UpgradeOpen();
    lo.CopyFrom(pi.ValidatedSettings);
}&lt;/PRE&gt;
&lt;P&gt;Have you tried the sample code from my previous reply.&lt;/P&gt;
&lt;P&gt;It does save the plot settings to the layout.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jan 2013 06:30:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/edevicenotfound-error-when-validating-plotinfo/m-p/3765717#M51483</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2013-01-31T06:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: eDeviceNotFound Error when validating PlotInfo</title>
      <link>https://forums.autodesk.com/t5/net-forum/edevicenotfound-error-when-validating-plotinfo/m-p/3768881#M51484</link>
      <description>&lt;P&gt;Balaji thank you very much for your help.&amp;nbsp; I made the change you suggested and I am not getting the error message any more.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Feb 2013 14:47:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/edevicenotfound-error-when-validating-plotinfo/m-p/3768881#M51484</guid>
      <dc:creator>HJohn1</dc:creator>
      <dc:date>2013-02-04T14:47:09Z</dc:date>
    </item>
  </channel>
</rss>

