Programatically selecting plotconfiguration

Programatically selecting plotconfiguration

Anonymous
Not applicable
484 Views
4 Replies
Message 1 of 5

Programatically selecting plotconfiguration

Anonymous
Not applicable
Hi,

Have the following:

Dim ObjPlotConfigs As AcadPlotConfigurations
Dim ObjPlotConfig As AcadPlotConfiguration
Set ObjPlotConfigs = ThisDrawing.PlotConfigurations
Set ObjPlotConfig = ObjPlotConfigs.Add("AutoDWF")

I then have later:

With ObjPlotConfig
.CanonicalMediaName = "ISO_A1_(841.00_x_594.00_MM)"
.RefreshPlotDeviceInfo
.ConfigName = "autodwf.pc3"
.StandardScale = acScaleToFit
.PlotType = acExtents
.PlotRotation = ac0degrees
End With

And finally:

blnret = objplot.PlotToFile(FullFName)

Is there a method to set the above plotconfiguration as current prior to using the PlotToFile method? I can't seem to figure out how ACAD knows which is the current plot Configuration. If the above is run and the drawing for example contains a plot configuration that is not supported on the local machine i.e. no printer installed and 'none' device substitutes then the procedure fails.

Its drving me mad 🙂

Simon
0 Likes
485 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Use the Layout's CopyFrom method. The help file is
incomplete. It only says you can supply a Layout object as the argument, but a
PlotConfiguration works too.


--
Ed
--


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hi,

Have the following:

Dim ObjPlotConfigs As AcadPlotConfigurations
Dim ObjPlotConfig As
AcadPlotConfiguration
Set ObjPlotConfigs = ThisDrawing.PlotConfigurations

Set ObjPlotConfig = ObjPlotConfigs.Add("AutoDWF")

I then have later:

With ObjPlotConfig

            .CanonicalMediaName
= "ISO_A1_(841.00_x_594.00_MM)"

            .RefreshPlotDeviceInfo

            .ConfigName
= "autodwf.pc3"

            .StandardScale
= acScaleToFit

            .PlotType
= acExtents

            .PlotRotation
= ac0degrees
End With

And finally:

blnret = objplot.PlotToFile(FullFName)

Is there a method to set the above plotconfiguration as current prior to
using the PlotToFile method? I can't seem to figure out how ACAD knows which
is the current plot Configuration. If the above is run and the drawing for
example contains a plot configuration that is not supported on the local
machine i.e. no printer installed and 'none' device substitutes then the
procedure fails.

Its drving me mad 🙂

Simon

0 Likes
Message 3 of 5

Anonymous
Not applicable
Ed,

Thanks for the response but I am still a little bit unclear about something:

In my code I have created a plot configuration with all of the settings I would like the drawing to use. The problem I have however is that before calling the PlotToFile method I need to ensure that the current plot configuration is the one I have created. The problem I have is that for some reason the plot config from the last plot is stored and this produces a plottofile output that is incorrect. If I go to the drawing the configuration I created in code is available in layouts and if selected the print is fine.

Simon
0 Likes
Message 4 of 5

Anonymous
Not applicable
The last  post still applies.

ThisDrawing.ActiveLayout.CopyFrom
oMyPlotConfig

When you do this, it not only copies the page setup
settings from your PlotConfiguration, but sets it active in the Page Setup
dialog. Simply copying the settings individually won't make the page setup
current. Also make sure that on the 'Plotting' tab of Options, that 'use last
successful plot settings' is not checked.


--
Ed
--


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Ed,

Thanks for the response but I am still a little bit unclear about
something:

In my code I have created a plot configuration with all of the settings I
would like the drawing to use. The problem I have however is that before
calling the PlotToFile method I need to ensure that the current plot
configuration is the one I have created. The problem I have is that for some
reason the plot config from the last plot is stored and this produces a
plottofile output that is incorrect. If I go to the drawing the configuration
I created in code is available in layouts and if selected the print is fine.

Simon

0 Likes
Message 5 of 5

Anonymous
Not applicable
ObjPlotConfig.RefreshPlotInfo needs to be the last line you call before
you plot.
___________________________
Mike Tuersley
AutoCAD Clinic
Rand IMAGINiT Technologies
0 Likes