Can anyone help me to add an also to edit a custom papersize to the "DWG to PDF.pc3" file. Or give me a least a hint? Thanks in advance. I'm already this far:
<CommandMethod("cpss")> _ Public Sub cpss() Dim plottername, papersiize As String Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument Dim acCurDb As Database = acDoc.Database plottername = "DWG to PDF.pc3" papersiize = "ISO_expand_A3_(420.00_x_297.00_MM)" Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction() Dim acLayoutMgr As LayoutManager acLayoutMgr = LayoutManager.Current Dim acLayout As Layout acLayout = acTrans.GetObject(acLayoutMgr.GetLayoutId(acLayout
Mgr.CurrentLayout), OpenMode.ForRead) acDoc.Editor.WriteMessage(vbLf & "Current layout: " & acLayout.LayoutName) acDoc.Editor.WriteMessage(vbLf & "Current device name: " & acLayout.PlotConfigurationName) Dim acPlInfo As PlotInfo = New PlotInfo() acPlInfo.Layout = acLayout.ObjectId Dim acPlSet As PlotSettings = New PlotSettings(acLayout.ModelType) acPlSet.CopyFrom(acLayout) Dim acPlSetVdr As PlotSettingsValidator = PlotSettingsValidator.Current acPlSetVdr.SetPlotConfigurationName(acPlSet, plottername, papersiize) Dim rutte As New Extents2d(0, 0, 420, 297) acPlSetVdr.SetPlotWindowArea(acPlSet, rutte) acPlSetVdr.SetPlotType(acPlSet, Autodesk.AutoCAD.DatabaseServices.PlotType.Window) acPlSetVdr.SetUseStandardScale(acPlSet, True) acPlSetVdr.SetPlotOrigin(acPlSet, New Point2d(0, 0)) acPlSetVdr.SetPlotRotation(acPlSet, PlotRotation.Degrees000) acPlSetVdr.SetStdScaleType(acPlSet, StdScaleType.StdScale1To1) acPlSetVdr.SetPlotCentered(acPlSet, True) acLayout.UpgradeOpen() acLayout.CopyFrom(acPlSet) acDoc.Editor.WriteMessage(vbLf & "New device name: " & acLayout.PlotConfigurationName) acTrans.Commit() End Using End Sub
For some reason, setplotconfigurationname is expecting canonical media name as the last parameter. Kean has an example here: http://through-the-interface.typepad.com/through_t
When I had to add a custom page size, I just used autocad and edited the PC3 file. I have not used .net to do that.
papersiize is not an error; it is only a the name of a variable (not so good chosen, I agree).
As fas I can see the trhough-the-interface manual doesn't make new custom paper size, it only select existing paper sizes.
I explain why I want to program this:
I have a layout and I want to make a PDF of it.
The paper size of the plan is always changing with different projects, This is why I have to make for every different plot I make I have to define a new custom paper size. I find this very time consuming and I'm always aware that this paper space is defined by plot-scale in combination with the selected window that you want to plot.
For some reason the option "change paper size to the selected window in combination with selected paperscale" " is not within Autocad.
That is why I want to make a program and that is why I want to change/create a custom paper size and why I don't manualy make every possible paper size I could need in the future.
Here is the example (see zip in attach)
I want to make a PDF of Layout.
This is what I have to do in Autocad
- plotscale is 20mm = 1 unit
- window of the plan is 45 by 45 units
- so the paper size is 900 by 900 mm
- go to "dwg to PC3", make a new custom paper size 900 by 900 (this step is too time consuming for me)
- set this current
Another plan/layout with different size and these steps must be done again
This is what the program have to do:
- start program
- the program determines the plotscale (with this I have no programming-problem)
- the program detemines the plotwindow (with this I have no programming-problem)
- the program calculates the paper size en makes it current
- the program start to make the PDF (with this I have no programming-problem)
- result : 1 click
Sorry not trying to irrate you but why do you not use standard paper sizes does this not cause probles when the plans go out for print or is this like preliminary half size I noticed it is metric we do work all over the world, The reasons I am asking you these questions I ran across a similar thing do not know how similair yet but went at it a different way
You're not anoying at all. Discussion leads to a solution.
In our office we have a plotter with a paper roll of 100m. So the width of the plan is fixed, the length isn't. We mostly make road design plan. The length of the plan is mostly the length of the road to design scaled 500 times. It is true that I could make 15 extra paper size (fix width and 15 different lenghts), but I'm sure that the program that I want to make leads to more usercomfort (perhaps a little more, but I really want to program it).
AcPlPlotInfoValidator::isCustomPossible (you can place this in the index search of the arxdoc.chm for more info)
Checks to see if the validator can create a custom media size using the specified AcPlPlotInfo object. No validation of the object is performed by this method, and the object does not need to be validated before calling this method. The layout, plot settings overrides, and device override are obtained from the AcPlPlotInfo object to determine what page size and device would be used to create the custom media size.
The method returns a value containing coded bitwise OR flags of the eCustomSizeResult enum, indicating what (if any) problems would be encountered creating a custom paper size for the device.
You can go to theswamp.org and on the second page look for the post DumpBin Results for PINVOKE to see if you pinvoke something like this.
Or tell your boss you have start following NCS and used defined paper sizes
Access a broad range of knowledge to help get the most out of your products and services.