I have created an external program to create PDF's automatically of opened DWG's using VB.Net. Here is some of my code, a lot of which came from Gile, Tony, Fixo, and others on TheSwamp:
Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
Dim ed As Editor = doc.Editor
Dim db As Database = doc.Database
Dim tr As Transaction = db.TransactionManager.StartTransaction()
Using tr
Dim bt As BlockTable = tr.GetObject(db.BlockTableId, OpenMode.ForRead)
Dim pi As PlotInfo = New PlotInfo()
If PlotFactory.ProcessPlotState = ProcessPlotState.NotPlotting Then
Dim layoutId As Autodesk.AutoCAD.DatabaseServices.ObjectId = LayoutManager.Current.GetLayoutId(LayoutManager.Current.CurrentLayout)
Dim activeLyt As Autodesk.AutoCAD.DatabaseServices.Layout = tr.GetObject(layoutId, OpenMode.ForRead)
pi.Layout = layoutId
Dim ps As PlotSettings = New PlotSettings(activeLyt.ModelType)
Dim obj As AcadObject = activeLyt.AcadObject
ps.CopyFrom(activeLyt)
ps.PlotSettingsName = "PDF"
ps.ScaleLineweights = True
Dim configStr As String = "DWG To PDF.pc3"
Dim plotName As String = "ANSI_full_bleed_E_(34.00_x_44.00_Inches)"
Dim psv As PlotSettingsValidator = PlotSettingsValidator.Current
psv.SetPlotConfigurationName(ps, configStr, plotName)
psv.RefreshLists(ps)
psv.SetPlotType(ps, Autodesk.AutoCAD.DatabaseServices.PlotType.Extents)
psv.SetPlotPaperUnits(ps, Autodesk.AutoCAD.DatabaseServices.PlotPaperUnit.Inches)
psv.SetPlotRotation(ps, Autodesk.AutoCAD.DatabaseServices.PlotRotation.Degrees090)
psv.SetPlotOrigin(ps, New Autodesk.AutoCAD.Geometry.Point2d(0, 0))
'psv.SetPlotCentered(ps, True)
'psv.SetCanonicalMediaName(ps, "ANSI_full_bleed_E_(34.00_x_44.00_Inches)")
psv.SetCustomPrintScale(ps, New Autodesk.AutoCAD.DatabaseServices.CustomScale(num, den))
psv.SetStdScale(ps, (num / den))
psv.SetUseStandardScale(ps, True)
psv.SetCurrentStyleSheet(ps, PenTable)
pi.OverrideSettings = ps
Dim piv As PlotInfoValidator = New PlotInfoValidator()
piv.MediaMatchingPolicy = MatchingPolicy.MatchDisabled
piv.Validate(pi)
Dim pe As PlotEngine = PlotFactory.CreatePublishEngine
Using pe
Dim ppd As PlotProgressDialog = New PlotProgressDialog(False, 1, True)
Using ppd
ppd.PlotMsgString(PlotMessageIndex.DialogTitle) = "Plot Progress"
ppd.PlotMsgString(PlotMessageIndex.CancelJobButtonMessage) = "Cancel Job"
ppd.PlotMsgString(PlotMessageIndex.CancelSheetButtonMessage) = "Cancel Sheet"
ppd.PlotMsgString(PlotMessageIndex.SheetSetProgressCaption) = "Sheet Set Progress"
ppd.PlotMsgString(PlotMessageIndex.SheetProgressCaption) = "Sheet Progress"
ppd.LowerPlotProgressRange = 0
ppd.UpperPlotProgressRange = 100
ppd.PlotProgressPos = 0
ppd.OnBeginPlot()
ppd.IsVisible = True
pe.BeginPlot(ppd, Nothing)
pe.BeginDocument(pi, doc.Name, Nothing, 1, True, fileName)
ppd.PlotMsgString(PlotMessageIndex.Status) = "Plotting: " & doc.Name & " - " & activeLyt.LayoutName
ppd.OnBeginSheet()
ppd.LowerSheetProgressRange = 0
ppd.UpperSheetProgressRange = 100
ppd.SheetProgressPos = 0
Dim ppi As PlotPageInfo = New PlotPageInfo()
pe.BeginPage(ppi, pi, True, Nothing)
pe.BeginGenerateGraphics(Nothing)
pe.EndGenerateGraphics(Nothing)
pe.EndPage(Nothing)
ppd.SheetProgressPos = 100
ppd.OnEndSheet()
pe.EndDocument(Nothing)
ppd.PlotProgressPos = 100
ppd.OnEndPlot()
pe.EndPlot(Nothing)
End Using
End Using
End If
End Using
My question is, how do I control Autocad's "DWG To PDF.pc3" to include layer information? I want to do this programatically rather than opening up the pc3 and changing it manually. I have the default set to not include the layer information. If this is not even possible, then just slap me and move on the next question.
I feel like I have searched everywhere for this information and have come up with nothing.
Thank for you taking the time to read and respond.