VB .NET Plotting Problem

Discussion in 'AutoCAD' started by Rich19, Aug 2, 2004.

  1. Rich19

    Rich19 Guest

    Hi All,

    When trying to plot with the following code and using VB .NET, everything works fine when using AutoCad 2004 and AutoCad 2004 COM objects. When I use the same code for AutoCad 2002 and AutoCad 2002 COM objects, everything plots to the same size media no matter what is selected. It is like the plotter/printer ignores the selection and defaults to letter size media. I have 2 seperate projects for 2004 and 2002.

    'Create AutoCad object.
    Dim ACADAPP As AutoCAD.AcadApplication
    Try
    ACADAPP = GetObject(, "AutoCAD.Application")
    Catch ex As Exception
    ACADAPP = CType(CreateObject("AutoCAD.Application"), AutoCAD.AcadApplication)
    End Try


    'Create drawing object and Open Acad Drawing.
    Dim ACADAPPdwg As AutoCAD.AcadDocument
    ACADAPPdwg = ACADAPP.Documents.Open(drawingfile)

    ACADAPP.Application.ActiveDocument.ActiveLayout.PlotType = AcPlotType.acExtents
    ACADAPP.Application.ActiveDocument.ActiveLayout.CenterPlot = True
    ACADAPP.Application.ActiveDocument.ActiveLayout.StandardScale = AcPlotScale.acScaleToFit
    ACADAPP.Application.ActiveDocument.ActiveLayout.PlotWithPlotStyles = True
    ACADAPP.Application.ActiveDocument.ActiveLayout.RefreshPlotDeviceInfo()
    ACADAPP.Application.ActiveDocument.ActiveLayout.ConfigName = cboPlotter.Text
    ACADAPP.Application.ActiveDocument.ActiveLayout.StyleSheet = cboPlotStyle.Text

    'Get the UserMedia Name from LocaleMedia Name selected for plotting.
    strlocmedname = cboPaperSize.Text
    strusermedianame = Get_UserMediaName(strlocmedname)

    ACADAPP.Application.ActiveDocument.ActiveLayout.CanonicalMediaName = strusermedianame

    'Refresh Plot info.
    ACADAPP.Application.ActiveDocument.ActiveLayout.RefreshPlotDeviceInfo()

    'Send Drawing to Plotter.
    ACADAPP.Application.ActiveDocument.Plot.PlotToDevice(cboPlotter.Text)
     
    Rich19, Aug 2, 2004
    #1
  2. Rich19

    Rich19 Guest

    Additional Info:

    I found in the AutoCAD 2002 project that whatever the default paper size the printer object (in Windows) is set to that is what size gets printed no matter what paper size is selected . However, the same code works fine in my ACAD 2004 project. Looks like there is a bug in either the ACAD 2002 COM library or a bug in the VB .NET Interop Services.

    Has anybody else had a similar problem like this?

    Thanks
     
    Rich19, Aug 4, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.