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" _ ....."
Solved! Go to Solution.
Solved by Balaji_Ram. Go to Solution.
Please post more information and the code that goes wrong
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
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(); }
Can't find what you're looking for? Ask the community or share your knowledge.