ConfigName Example

Using Programming Languages other than VBA

Sub Example_ConfigName()
	' This example will add a new plot configuration to the current drawing.
	' It will then list the plotter configuration file name for each Layout
	' in the current drawing, change the configuration for Layout1 to "DWF Classic.pc3"
	' and re-display the configuration information for the drawing.
	'
	' * Note: File names may differ on your system, so be prepared to change
	' the configuration file name used in the example to a file that exists
	' on your system.

	Dim Layouts As AcadLayouts, Layout As ACADLayout
	Dim msg As String
	Dim ACADPref As AcadPreferencesFiles
	Dim originalValue As Variant

	' Get the files preferences object
	Set ACADPref = ThisDrawing.Application.preferences.Files

	' Read and display the original value
	originalValue = ACADPref.PrinterConfigPath

	' Get layouts collection from document object
	Set Layouts = ThisDrawing.Layouts

	' Display current plotter configuration information
	GoSub DISPLAY_CONFIG

	' Change plotter configuration file for "Layout1"
	Layouts("Layout1").ConfigName = "DWF Classic.pc3"

	' Display new plotter configuration information
	GoSub DISPLAY_CONFIG

	Exit Sub
	
DISPLAY_CONFIG:
	msg = vbCrLf & vbCrLf   ' Start with a space

	' Format and display current directory for configuration files
	msg = msg & vbTab & "Directories that will be scanned for the plotter configuration files are: " _
				& vbCrLf & vbTab & vbTab & originalValue & vbCrLf & vbCrLf

	' Get the plotter configuration name of every layout in this drawing
	For Each Layout In Layouts
		' Format for display
		msg = msg & vbTab & Layout.name & " is using configuration: " & Layout.ConfigName & vbCrLf
	Next

	' Display paper units information
	MsgBox "The plotter configuration information used in the current drawing is listed below." & msg

	Return
End Sub





   Comments?