drawing rectangles on dwg image

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
DataMike
Posts: 1
Joined: 27 Mar 2009, 00:03

drawing rectangles on dwg image

Post by DataMike » 27 Mar 2009, 00:56

I am trying to load a dwg image, draw rectangles on it, and save it with cadimport.dll in asp.net.
cadImage = CADImage.CreateImageByExtension(imagePath);
cadImage.LoadFromFile(imagePath);
cadImage.Draw(graphics, rectangleF); << is not working for me.
I need to be able to draw the rectangles on an existing cadimage. Perhaps I am way off, I need to be pointed in the right direction. Please help.
Thank you.

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

Re: drawing rectangles on dwg image

Post by support » 27 Mar 2009, 09:00

Hello!

We recommend to use the following code:

Code: Select all

private void btnAddPolyline_Click(object sender, System.EventArgs e)
{
	if(this.cadImage == null) 
	{
		this.cadImage = new CADImage();
		this.cadImage.InitialNewImage();
		this.cadImage.UseBufMetafile = false;
	}
	else
		this.cadImage.UseBufMetafile = false;

	CADPolyLine entPoly = new CADPolyLine();
	entPoly.Closed = true;
	entPoly.Color = CADConst.clNone;

	CADVertex entVertex = new CADVertex(); 
	entPoly.AddEntity(entVertex);
	entVertex.Point = new DPoint(0,0,0);			

	entVertex = new CADVertex();
	entPoly.AddEntity(entVertex);
	entVertex.Point = new DPoint(0,100,0);

	entVertex = new CADVertex(); 
	entPoly.AddEntity(entVertex);
	entVertex.Point = new DPoint(200,100,0);

	entVertex = new CADVertex(); 
	entPoly.AddEntity(entVertex);
	entVertex.Point = new DPoint(200,0,0);

	this.cadImage.Converter.OnCreate(entPoly);
	this.cadImage.Converter.Loads(entPoly);
	this.cadImage.Converter.Entities.Add(entPoly);

	this.cadImage.GetExtents();
	this.DoResize();	
	SaveAsDXF(@"c:\Rectangle.dxf");
}
Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply