CADImage: Create JPEG of part of image

Discuss and ask questions about CAD DLL (CAD Image DLL, CAD Importer DLL).

Moderators: SDS, support, admin

Post Reply
chylus
Posts: 3
Joined: 04 Oct 2005, 20:28

CADImage: Create JPEG of part of image

Post by chylus » 04 Oct 2005, 20:39

Hi there

So far, I created a command line tool to export hpgl files to jpg. Now, I want to extend the tool to provide the export of regions of the file. The coordinates should be specified via command arguments (eg. two corner points of a region).

I tried to use SetDrawingBoxCAD to set the coordinates but the whole image will be exported to jpg and not only the desired region.

Hope somebody can help. Thanks

david

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

Post by support » 05 Oct 2005, 17:38

Dear David,

SetDrawingBoxCAD sets drawing's coordinates in absolute coordinates. The cause of the problem perhaps in incorrect coordinate's setting when calling SetDrawingBoxCAD.

It is possible to find out whether the problem is in coordinates as we've described above by demoVC available in CADImage package (http://www.cadsofttools.com/download/CADImage.zip) in CADImage\DemoVC folder.
It is possible using this demo to check if mouse coordinates coincide with those that you set.

Sergey.

please post questions to the forum or write to support@cadsofttools.com

chylus
Posts: 3
Joined: 04 Oct 2005, 20:28

Post by chylus » 05 Oct 2005, 18:35

Dear Sergey

Thanks for your reply.

If I'm using the demoVC application to save a drawing to the jpg format, the same occures: when I changed the scale, the coordinates of the drawing box are set correctly. But if I want to save the content of the drwaing box to a raster image, the whole drawing will be saved and not only the content of the box.

Let's say, there is a drawing with the following coordinates:
upper left corner (0,0), lower right corner (2000,2000).

Now I want to get a jpg image containing a region of the drawing only, e.g. with the two corners (500,500) and (1000,1000).

Might be my question was not precisly enough.

Thank you
david

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

Post by support » 05 Oct 2005, 20:24

Dear David,

We have renewed CADImage.zip package (http://www.cadsofttools.com/download/CADImage.zip).

Selecting in DemoVС [Options -> On/Off drawingbox] menu command calls SetDrawingBoxCAD and cuts off a half of the drawing.

MainWindow.cpp includes this function:

Code: Select all

void CMainWindow::SetDrawingBox()
{
	optionsCAD.IsDrawingBox = true;
	<b>if</b> ((CADImage != NULL) && !bIsRotated)
	{		
		rectDrawingBox.Points.Left = (frectExtentsCAD.Points.Left + frectExtentsCAD.Points.Right)/2;
		rectDrawingBox.Points.Top =  frectExtentsCAD.Points.Top;
		rectDrawingBox.Points.Z1 = 0;  
		rectDrawingBox.Points.Right = frectExtentsCAD.Points.Right; 
		rectDrawingBox.Points.Bottom = frectExtentsCAD.Points.Bottom; 
		rectDrawingBox.Points.Z2 = 0; 		
		SetDrawingBoxCAD(CADImage, &rectDrawingBox);
		RecalculateExtents();		
		RePaint();
	}	
}
Please try renewed CADImage package. It must be Ok!

Sergey.

please post questions to the forum or write to support@cadsofttools.com

chylus
Posts: 3
Joined: 04 Oct 2005, 20:28

Post by chylus » 06 Oct 2005, 00:06

It's working perfectly. Thanks a lot.

David

Post Reply