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

printer stored in dwg file

187 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 (165 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: 26
Registered: ‎08-11-2010
Message 3 of 5 (156 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: 609
Registered: ‎03-21-2011
Message 4 of 5 (93 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: 26
Registered: ‎08-11-2010
Message 5 of 5 (79 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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community