Wout Ware

September 10, 2010, 02:35:57 am *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Help using CreateAutoSizedBitmap  (Read 148 times)
dougriley
Member
*
Posts: 2


« on: March 09, 2010, 03:23:25 pm »

My objective is to read a CAD DWG/DXF file and produce an image file (PNG) which retains the scale of the original CAD document.  Also, I need to either set (preferrably) or find the scale of the resulting image.  So, for example, if I had a CAD drawing with the size of 100 Feet x 100 Feet and scale of 1:1 and I wanted a resulting image with a scale of 1 inch = 1 foot - how would I do that.  I don't see any examples using CreateAutoSizedBitmap that seem to fit what I am looking for.

Sorry if this is not properly worded - I am not very familiar with CAD. 
Logged
wout
Administrator
Member
*****
Posts: 837


« Reply #1 on: March 10, 2010, 02:32:40 pm »

Hi Doug,

You would have to define a pixel size first, i.e. how many inches does one pixel represent? Once you know that, and you know the scale you want to use, you can translate the drawing size to the bitmap size: bitmap size = drawing size * scale * <pixels per inch>.

Wout
Logged
dougriley
Member
*
Posts: 2


« Reply #2 on: March 10, 2010, 02:49:20 pm »

Thanks for the reply.  While I understand what you are saying at a conceptual level, I have no idea how to implement this via your toolset.  You documentation is focused at the class level with not much at the "how-to" level.  Can you provide an example?  We would even discuss contracting you to develop some functionality for us using your toolset, if that is possible.  My need is immediate.

Please advise.  Thanks!
Doug
Logged
wout
Administrator
Member
*****
Posts: 837


« Reply #3 on: March 10, 2010, 03:09:26 pm »

Hi Doug,

The drawing bounds you can get using class WW.Cad.Drawing.BoundsCalculator. The result of this is a WW.Math.Bounds3D object. The scale and pixel size is something that you need to decide on. So bitmap width would be something like:

Code:
    double bitmapWidth = bounds.Delta.X * scale * pixelsPerSomeUnit;
    double bitmapHeight = bounds.Delta.Y * scale * pixelsPerSomeUnit;

Hope this helps!

Wout
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!