VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Trying to change Canonical Media Name

0 REPLIES 0
Reply
Message 1 of 1
Anonymous
1167 Views, 0 Replies

Trying to change Canonical Media Name

I am trying to change the Canonical Media Name type in my VBA code, but I keep getting overridden with other values (for reason I don't know why) I also tried passing variables through another sub, but this isn't working either. I was wondering if someone has an idea floating around to by pass this. I have tried using 

myLayout.Regen acAllViewports

to update my viewports and 

myLayout.RefreshPlotDeviceInfo

to also update my code.

 

I am currently restructuring this code provided by 

 

Option Explicit

Public Sub PlotTest()

    Dim backPlot As Integer
Dim PaperSize As String backPlot = ThisDrawing.GetVariable("BACKGROUNDPLOT") ThisDrawing.SetVariable "BACKGROUNDPLOT", 0 On Error Resume Next PaperSize = "11x17" PlotToPdf ThisDrawing, "D:\Temp\TestDwgPlot1.pdf", ac0degrees PlotToPdf ThisDrawing, "D:\Temp\TestDwgPlot2.pdf", ac90degrees ThisDrawing.SetVariable "BACKGROUNDPLOT", backPlot End Sub Private Sub PlotToPdf(currentDwg As AcadDocument, pdfFile As String, plotRotation As AcPlotRotation, Papersize As String) Dim myLayout As ACADLayout Dim currentPlot As AcadPlot
Set myLayout = currentDwg.ModelSpace.Layout myLayout.StyleSheet = "monochrome.ctb" myLayout.plotRotation = plotRotation myLayout.ConfigName = "DWG To PDF.pc3" myLayout.CanonicalMediaName = PaperSize myLayout.StandardScale = acScaleToFit myLayout.PlotType = acExtents myLayout.CenterPlot = True Set currentPlot = currentDwg.Plot currentPlot.DisplayPlotPreview acFullPreview If currentPlot.PlotToFile(pdfFile) Then MsgBox pdfFile & " generated successfully." End If End Sub 

 

Tags (1)
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report