Plot Autocad API .net or vba

Plot Autocad API .net or vba

Anonymous
適用対象外
4,302件の閲覧回数
5件の返信
メッセージ1/6

Plot Autocad API .net or vba

Anonymous
適用対象外

Hello community is there a way to convert my dwg to png? 
I need to do it programmatically and in certain dimensions.
The best way i found it easier is through plot in Autocad. I am aware of the pngout command.


is there a way to do this conversion in Autocad with certain dimesions and programmatically?

 

0 件のいいね
解決済み
4,303件の閲覧回数
5件の返信
返信 (5)
メッセージ2/6

steven-g
Mentor
Mentor

This forum is for Autocad LT and if that is what you use there is no .NET or VBA functionality in LT if you need that for full Autocad then there is a dedicated forum here

0 件のいいね
メッセージ3/6

norman.yuan
Mentor
Mentor
解決済み

You can either use AutoCAD .NET API, or COM API /AutoCAD VBA plot drawing programmatically,using the "PublishToWeb PNG.pc3" as plotting device.

 

For example, this simple code sample plot the active layout to a *.png file:

 

Option Explicit

Public Sub PrintToPng()

    Dim pngFile As String
    
    pngFile = "C:\Temp\Test.png"
    
    Dim layout As AcadLayout
    Set layout = ThisDrawing.ActiveLayout
    
    layout.ConfigName = "PublishToWeb PNG.pc3"
    
    
    Dim result As Boolean
        
    result = ThisDrawing.Plot.PlotToFile(pngFile)
    
    If result Then
        MsgBox "Plotting to PNG file succeeded."
    Else
        MsgBox "Plotting to PNG file failed."
    End If

End Sub

It is pretty simple, if the active layout's plot configuration is properly set (paper size, plot scale...). Of course, you can also programmatically set up plotting configuration to the layout your want to plot before the plotting is actually done.

 

With AutoCAD .NET API, you may have event more controls on how  the plotting is done. 

 

Programmatic plotting is one of most discussed topics on AutoCAD customization programming. For using COM API to plot, you can search this forum, or browse AutoCAD VBA help document for details and sample code; for using AutoCAD .NET API, you can search the .NET forum and online AutoCAD developer guide. 

 

Without knowing your programming knowledge/skill on AutoCAD, I am going into more details. When you actually run into coding issue, feel free to post your code and ask comments/advises.

Norman Yuan

Drive CAD With Code

EESignature

メッセージ4/6

Anonymous
適用対象外

This works perfectly. Now i can customize my settings and this all i need. 
Furthermore you say there are more like these in the forums. Maybe i am blind. I must say i am new to Autocad.

I do not seem to find. You are the first to give me a clear answer.

0 件のいいね
メッセージ5/6

Anonymous
適用対象外

I am sorry but the title of the block is visual basic customization. I realise there is a .net. But I would accept both solutions. I guess i ll  edit my title for vba only.

0 件のいいね
メッセージ6/6

Anonymous
適用対象外

Do you have a way to batch plot?

You see if you go to this forum you will see the autocad code that i wrote. 

I have a problem with the plot because i want to be able to do this for more than one drawing.

Do you have any idea?

0 件のいいね