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

printer stored in dwg file

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
galbori
487 Views, 4 Replies

printer stored in dwg file

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" _ ....."


4 REPLIES 4
Message 2 of 5
fenton.webb
in reply to: galbori

Please post more information and the code that goes wrong




Fenton Webb
AutoCAD Engineering
Autodesk

Message 3 of 5
galbori
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

Message 4 of 5
Balaji_Ram
in reply to: galbori

Hi,

 

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 :

 

[CommandMethod("ResetPS")]
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;
        piv.Validate(pi);

        lo.UpgradeOpen();
        lo.CopyFrom(ps);
        tr.Commit();
    }
    ed.Regen();
}

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 5 of 5
galbori
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.

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