.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

papersize

11 REPLIES 11
Reply
Message 1 of 12
fallright
1624 Views, 11 Replies

papersize

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(acLayoutMgr.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

 

11 REPLIES 11
Message 2 of 12
fieldguy
in reply to: fallright

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_the_interface/2007/10/allowing-select.html.

 

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. 

Message 3 of 12
fieldguy
in reply to: fallright

Sorry.  I see you have that already - papersiize.  What is the error?

Message 4 of 12
fallright
in reply to: fieldguy

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.

 

Message 5 of 12
Jeffrey_H
in reply to: fallright

Would you load a dwg with multiple layouts or something to show why you have to create a custom papersize for each plot

You can also find your answers @ TheSwamp
Message 6 of 12
fallright
in reply to: fallright

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

   - plot

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

 

 

 

Message 7 of 12
Jeffrey_H
in reply to: fallright

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 can also find your answers @ TheSwamp
Message 8 of 12
fallright
in reply to: fallright

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).

 

 

Message 9 of 12
Jeffrey_H
in reply to: fallright

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

You can also find your answers @ TheSwamp
Message 10 of 12
Jeffrey_H
in reply to: Jeffrey_H

Sorry that was just for validation

You can also find your answers @ TheSwamp
Message 11 of 12
Jeffrey_H
in reply to: Jeffrey_H

AcPlPlotConfig
class AcPlPlotConfig : public AcPlObject;

 

Instances of this class represent a single device or PC3 file installed on the system. AcPlPlotConfig exposes utility methods for media size list, description fields, paper size matching, custom paper size creation, and persistence. 

You can also find your answers @ TheSwamp
Message 12 of 12
gianpaolo.marin
in reply to: fallright

Hello everyone,

I have the same fallright's  problem. Someone found a solution? I try with the class AcPlPlotConfig but probably I don't understand how it works. Please hint me

 

Autodesk.AutoCAD.PlottingServices.PlotConfig
[Wrapper("AcPlPlotConfig")]
public sealed class PlotConfig : RXObject;

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost