Active Contributor
Posts: 32
Registered: ‎08-11-2010
Message 1 of 5 (227 Views)
Accepted Solution

printer stored in dwg file

227 Views, 4 Replies
07-23-2013 09:33 AM

I have a problem with plotting dwg files using vb net.

When in this files is stored a printer no more existing in my network I've an exception in my vb net program.

How can I clean any information about printers stored in files?


To plot these files I use "acadDoc.SendCommand("-stampa" + vbCr + "S" + vbCr + "model" _ ....."

ADN Support Specialist
Posts: 352
Registered: ‎07-24-2007
Message 2 of 5 (205 Views)

Re: printer stored in dwg file

07-23-2013 09:25 PM in reply to: galbori

Please post more information and the code that goes wrong

Fenton Webb

Developer Technical Services

Autodesk Developer Network

Active Contributor
Posts: 32
Registered: ‎08-11-2010
Message 3 of 5 (196 Views)

Re: printer stored in dwg file

07-24-2013 01:26 AM in reply to: fenton.webb

through a vb net dll I print dwg files using

        acadDoc = AcadApp.ActiveDocument
        acadDoc.SendCommand("-stampa" + vbCr + "S" + vbCr + "model" _
        + vbCr + nDevice + vbCr + fmtPrint + vbCr + "M" + vbCr + orientPAGE _
        + vbCr + "n" + Chr(13) + "E" + vbCr + "Adatta" + vbCr + "Center" + vbCr _
        + "S" + vbCr + "Giben.ctb" + vbCr + "S" + vbCr + "n" + vbCr + "N" _
        + vbCr + "N" + vbCr + "S" + vbCr)

my problem is when in dwg layout is strored a printer no more existing (as you can see in the layout.jpg image). In this case I obtain the error in error.jpg image. Unfortunatly this warning are in Italian :-) I hope it's not a big problem for you

ADN Support Specialist
Posts: 694
Registered: ‎03-21-2011
Message 4 of 5 (133 Views)

Re: printer stored in dwg file

08-06-2013 05:28 AM in reply to: galbori



If you think the printer name associated with the PlotSettings is not valid, you can reset it to default before going ahead with the plot. Here is a sample code to reset it :


public void ResetPSMethod()
    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);
        PlotSettingsValidator psv = PlotSettingsValidator.Current;

        pi.OverrideSettings = ps;
        PlotInfoValidator piv = new PlotInfoValidator();
        piv.MediaMatchingPolicy = MatchingPolicy.MatchEnabled;





Developer Technical Services
Autodesk Developer Network

Active Contributor
Posts: 32
Registered: ‎08-11-2010
Message 5 of 5 (119 Views)

Re: printer stored in dwg file

08-06-2013 02:59 PM in reply to: Balaji_Ram
Thank's it's perfect J

Cordiali saluti

Gianni Albori - CED

Giben International Spa

Questo messaggio di posta elettronica contiene informazioni di carattere confidenziale rivolte esclusivamente al destinatario sopra indicato.
E' vietato l'uso, la diffusione, distribuzione o riproduzione del messaggio intero o di parte di esso a chiunque non ne sia il diretto destinatario. Nel caso aveste ricevuto questo messaggio di posta elettronica per errore, siete pregati di segnalarlo immediatamente al mittente e distruggere quanto ricevuto (compresi i file allegati) senza farne copia.
Qualsiasi utilizzo non autorizzato del contenuto di questo messaggio costituisce violazione dell'obbligo di non prendere cognizione della corrispondenza tra altri soggetti, salvo piu grave illecito, ed espone il responsabile alle relative conseguenze.

Confidentially notice. This e-mail transmission may contain legally privileged and/or confidential information. Please do not read it if you are not the intended recipient(S).
Any use, distribution, reproduction or disclosure by any other person is strictly prohibited.
If you have received this e-mail in error, please notify the sender and destroy the original transmission and its attachments without reading or saving it in any manner.
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.