Dwg to image without displaying

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
pfa
Posts: 1
Joined: 07 Dec 2011, 14:28

Dwg to image without displaying

Post by pfa » 07 Dec 2011, 14:37

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

support
Posts: 3272
Joined: 30 Mar 2005, 11:36
Contact:

Re: Dwg to image without displaying

Post by support » 07 Dec 2011, 17:44

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.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply