Retrieving coordinates from bitmap...

Discuss and ask questions about CAD VCL (Delphi and C++ Builder).

Moderators: SDS, support, admin

Post Reply
Cliff
Posts: 2
Joined: 16 Nov 2011, 22:33

Retrieving coordinates from bitmap...

Post by Cliff » 16 Nov 2011, 22:44

Hi,

the topic is a little bit hard to understand. Didn't know how tro explain my question in short words.. ;-)

I need to do an animation on the cad- file (DXF). If i do this with the internal 'AddLine' usw. the whole drawing will be completely refreshed and the picture is flickering.
My idea is to assign the cad- file to a bitmap where i can do double- buffering and all the necessary stuff for a smooth animation.

My problem:
I like to attach the loaded cad- file to a bitmap- object using stretchdraw.
Now i need to know the bitmap- coordinates (If i want to draw anytthing using the canvas- methods) where the cad- internal things are located.
Example: I need a line on Cad- position X,Y -> What bitmap- coordinates i have to draw to?

Can you give me short example of getting the coordinates (Have tried some documnted methods, but always got weird coordinates)?

Regards Cliff

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

Re: Retrieving coordinates from bitmap...

Post by support » 17 Nov 2011, 11:44

Hello Cliff.
Bitmap as any other raster image is a set of pixels. DXF (vector) drawing converted to raster image will lose all entities information. Generally you can select raster width and height to provide easy calculation from CAD coordinates to raster coordinates. However this won't work with large DXF that includes many entities - size of bitmap can be too big or entities will interfere.
CAD Import VCL provides method to recalculate CAD coordinates to screen (control) coordinates. This is a bit different because currently visualized part only of CAD image recalculated.
Also TsgDrawingNavigator class that provided as graphics container for TsgCADImage includes DoubleBuffered property.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Cliff
Posts: 2
Joined: 16 Nov 2011, 22:33

Re: Retrieving coordinates from bitmap...

Post by Cliff » 17 Nov 2011, 20:47

Thanks for the quick reply!
Also TsgDrawingNavigator class that provided as graphics container for TsgCADImage includes DoubleBuffered property
I will give it a try.

My Task:
We are programming a huge cutting machine where we are cutting material- stripes of 400m length.
Within thes stripes there are very simple contours.
I'd like to visualize the current position of the cutting- knifes on the material (Speed of material is round about 2m/s). So the update rate is pretty fast...

Regards Cliff

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

Re: Retrieving coordinates from bitmap...

Post by support » 18 Nov 2011, 14:46

Hello Cliff.
The stripe drawing stored in CAD file and the width of stripe is much lesser than length, correct? As a possible solution for such task you can visualize a small section of stripe with TsgDrawingNavigator.ShowPoint method then move stripe visible area with TsgDrawingNavigator.MovePictureRect. In this case TsgCADImage.GetPoint method can be used to recalculate CAD coordinates to screen coordinates.

Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply