Page 1 of 1

Dwg to image without displaying

Posted: 07 Dec 2011, 14:37
by pfa
Hi,

I am trying to batch convert .dwg CAD images to PNG images in a ASP.NET WebService without displaying the images at all.

Tried something like that:

Code: Select all

 CADImage image = CADImage.CreateImageByExtension(inputFilePath);
 MemoryStream ms = new MemoryStream();
 image.SaveToStream(ms, ImageFormat.Png, new DRect(0.0, 0.0, 500.0, 200.0));
1) This results in an error (only white background). Why, what's wrong here? How to achieve my requirement?
2) The example above uses a fixed sized Rectangle for testing purposes. How to determine the right width/height of the complete loaded CADImage without using any UI logic/controls?


Best Regards
Andreas

Re: Dwg to image without displaying

Posted: 07 Dec 2011, 17:44
by support
Hello Andreas.
The newly created image is empty. Use CADImage.LoadFromFile or CADImage.LoadFromStream to import existing drawing. CADImage.PureExtents contains coordinates of drawing's extents.

Alexander.