Quantcast
Channel: Autodesk India Community aggregator
Viewing all articles
Browse latest Browse all 1680

AutoCAD Customization: .NET: Plot to plt file using a system printer

$
0
0

Hi,

 

In our drawings we have a layout with a view port and tittle block.

Default printer set for that layout is "dwg to pdf.pc3" and paper is "ISO A3".

 

I had to plot this layout [extence] to a plt file for the use of our Production ERP.

We had to print to a specific windows printer with paper size A3.

We use to do it in VBA with the bellow code.

How to do it in .Net

--------------------------------------------------------------------

Public Function BetsyPlot2() As Boolean


    Dim Plot As AcadPlot
    Dim alayout As AcadLayout
    Dim lowerLeft(0 To 1) As Double
    Dim upperRight(0 To 1) As Double
    Dim retval As Boolean
    retval = flase



    For Each alayout In ThisDrawing.layouts
        If alayout.Name = "Betsy" Then
            RedrawViewPort
            ThisDrawing.ActiveLayout = alayout
            ThisDrawing.SetVariable "ANNOALLVISIBLE", 1
            lowerLeft(0) = 0
            lowerLeft(1) = 0

            upperRight(0) = 400
            upperRight(1) = 275

            alayout.SetWindowToPlot lowerLeft, upperRight
            alayout.PlotType = acWindow
            'alayout.UseStandardScale = True
            alayout.StandardScale = acScaleToFit
            'ThisDrawing.ActiveLayout.PlotRotation = ac270degrees
            alayout.ShowPlotStyles = False    'if it is true this may cause the layout become black & wite
            ' MsgBox ("sss")
            Set Plot = alayout.Document.Plot

            ' Plot.DisplayPlotPreview acPartialPreview
            ThisDrawing.SetVariable "BACKGROUNDPLOT", 0
            Call CreateDirectory(Trim(Me.txtFileNo.Text), BasePath)
            retval = Plot.PlotToFile(BasePath & Me.txtFileNo.Text & "\" & Me.txtDwgNo.Text & ".plt", comboPlotPrinter.Text)
            BetsyPlot2 = retval
            Exit Function
        End If
    Next alayout
    MsgBox ("Betsy layout not found in the drawing!")
    BetsyPlot2 = retval
End Function

--------------------------------------------------------------------------------------------------------------------------------------------------

Regards,

Shijith


Viewing all articles
Browse latest Browse all 1680

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>