-1

my problem is that I don´t have much experience with Autocad. Thus I don´t know how to save a project in a good quality image (png?) to insert in a latex document. Could you give me a hint?

Thank you

3 Answers3

0

Autocad's Publish to Web printers are pretty bad. What I would do is print using DWG to PDF printer or similar (there are a few in autocad's default printer list) then convert that pdf to raster images using a second software like Photoshop, GIMP, etc. There are even small software that convert pdf's to jpgs like TTRPDFToJPG3. If you have a specific idea of what kind of output you're looking for, please feel free to elaborate further. cheers!

Adl A
  • 183
  • 1
  • 8
0

If you're looking for a programmatic way to capture the screen, here it is:

using acApp = Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Runtime;
using System.Drawing.Imaging;
using System.Drawing;

namespace ScreenshotTest
{
  public class Commands
  {
    [CommandMethod("CSS")]
    static public void CaptureScreenShot()
    {
      ScreenShotToFile(
        acApp.Application.MainWindow,
        "c:\\main-window.png",
        0, 0, 0, 0
      );
      ScreenShotToFile(
        acApp.Application.DocumentManager.MdiActiveDocument.Window,
        "c:\\doc-window.png",
        30, 26, 10, 10
      );
    }

    private static void ScreenShotToFile(
      Autodesk.AutoCAD.Windows.Window wd,
      string filename,
      int top, int bottom, int left, int right
    )
    {
      Point pt = wd.Location;
      Size sz = wd.Size;

      pt.X += left;
      pt.Y += top;
      sz.Height -= top + bottom;
      sz.Width -= left + right;

      // Set the bitmap object to the size of the screen

      Bitmap bmp =
        new Bitmap(
          sz.Width,
          sz.Height,
          PixelFormat.Format32bppArgb
        );
      using (bmp)
      {
        // Create a graphics object from the bitmap

        using (Graphics gfx = Graphics.FromImage(bmp))
        {
          // Take a screenshot of our window

          gfx.CopyFromScreen(
            pt.X, pt.Y, 0,0, sz,
            CopyPixelOperation.SourceCopy
          );

          // Save the screenshot to the specified location

          bmp.Save(filename, ImageFormat.Png);
        }
      }
    }
  }
}

Source: Taking screenshots of AutoCAD’s main and drawing windows using .NET

Augusto Goncalves
  • 8,493
  • 2
  • 17
  • 44
0

Thanks to everyone. I am saving the files in pdf and after I´m using GIMP to convert them in PNG.