How to enable/disable plot stamp on under plot options

How to enable/disable plot stamp on under plot options

Anonymous
Not applicable
1,011 Views
3 Replies
Message 1 of 4

How to enable/disable plot stamp on under plot options

Anonymous
Not applicable

Hi

 

   How do I enable/disable "plot stamp on" under plot options using .net code?

0 Likes
1,012 Views
3 Replies
Replies (3)
Message 2 of 4

SENL1362
Advisor
Advisor

Change registry Key:

HKEY_CURRENT_USER\Software\Autodesk\...\Dialogs\Plot Stamp

PlotStamp(Dword)=0(=off) or 1(=on)

 

 

Sample below turns the PlotStamp ON

 

...
var acadServices = HostApplicationServices.Current;
var acadUsrRootKeyPath = acadServices.UserRegistryProductRootKey;  //Software\Autodesk\AutoCAD\R20.1\ACAD-F002:409
var acadPref = (dynamic)AcadApp.Preferences;
var activeProfileName = acadPref.Profiles.ActiveProfile;
var psKeyPath = Path.Combine("HKEY_CURRENT_USER",acadUsrRootKeyPath, "Profiles", activeProfileName,"Dialogs", "Plot Stamp");
var curPsStatus = (int)Microsoft.Win32.Registry.GetValue(psKeyPath, "PlotStamp", -1);
Microsoft.Win32.Registry.SetValue(psKeyPath, "PlotStamp", 1);
... 
Message 3 of 4

Anonymous
Not applicable

Thank you for the Registry Solution.

 

Can I set the Plot Stamp Option when I am plotting using the following code. I was thinking can I set the plot stamp using PlotSettings, PlotConfig, PlotInfo or PlotInfoValidator Object.

 

 

PlotSettings defaultPlotSetting = (PlotSettings)sourcePlotSettingsDict.GetAt(printingConfiguration.PageSetupName).GetObject(OpenMode.ForRead);

string defaultDeviceName = defaultPlotSetting.PlotConfigurationName;

//defaultPlotSetting.

LayoutManager layMgr = LayoutManager.Current;

DBDictionary layouts = tr.GetObject(db.LayoutDictionaryId, OpenMode.ForRead) as DBDictionary;

foreach (DBDictionaryEntry item in layouts)

 

{

Layout theLayout = (Layout)layMgr.GetLayoutId(item.Key).GetObject(OpenMode.ForWrite);

LayoutManager.Current.CurrentLayout = item.Key;

if (item.Key != "Model")

 

{

ed.SwitchToPaperSpace();

// PlotSettingsValidator psVal = Autodesk.AutoCAD.DatabaseServices.PlotSettingsValidator.Current;

 

theLayout.CopyFrom(defaultPlotSetting);

 

theLayout.UpgradeOpen();

PlotConfigManager.RefreshList(RefreshCode.All);

var s = PlotConfigManager.SetCurrentConfig(defaultDeviceName);//DWG To PDF-300.pc3

PlotConfig tds = PlotConfigManager.CurrentConfig;

string plotFile = null;

plotFile = pdfDirectory + FormatDrawingName(drawingFileNameWithoutExtension) + item.Key + ".pdf";

ed.WriteMessage("\nPlotting to {0}\n", plotFile);

if (System.IO.File.Exists(plotFile))

 

{

File.Delete(plotFile);

 

}

 

PlotInfo plotInfo = new PlotInfo();

 

plotInfo.Layout = theLayout.ObjectId;

plotInfo.OverrideSettings = defaultPlotSetting;

plotInfo.DeviceOverride = tds;

PlotInfoValidator validator = new PlotInfoValidator();

//int itIs = validator.IsCustomPossible(plotInfo);

validator.MediaMatchingPolicy = Autodesk.AutoCAD.PlottingServices.MatchingPolicy.MatchEnabledCustom;

int itIs = validator.IsCustomPossible(plotInfo);

 

validator.Validate(plotInfo);

PlotEngine plotEngine = PlotFactory.CreatePublishEngine();

plotEngine.BeginPlot(null, null);

plotEngine.BeginDocument(plotInfo, Application.DocumentManager.MdiActiveDocument.Database.Filename, null, 1, true, plotFile);

PlotPageInfo pageInfo = new PlotPageInfo();

ed.WriteMessage("\nPlotting {0} Entities, {1} ", pageInfo.EntityCount, pageInfo.RasterCount);

plotEngine.BeginPage(pageInfo, plotInfo, true, null);

plotEngine.BeginGenerateGraphics(null);

plotEngine.EndGenerateGraphics(null);

plotEngine.EndPage(null);

plotEngine.EndDocument(null);

plotEngine.EndPlot(null);

 

plotEngine.Destroy();

}

}

 

 

 

0 Likes
Message 4 of 4

SENL1362
Advisor
Advisor

I don't think so, the  status is stored in ..\support\mm.pss (or inches.pss dependent on youre measurement setting).

As far as i know it is not related to any of those Plot* objects.

 

0 Likes