Page 1 of 1
Simple Usage
Posted: 18 Feb 2009, 01:58
by hairry_p0tter
Hi,
i have downloaded the CAD Import .NET for Compact Framework and have been able to run the Poclet PC CAD Viewer.
I checked through the documentation and found only the api help.
Is there a simple example / code to just DISPLAY a sample .dwg file ONLY instead of all the code and functionality found in the viewer.
I prefer to start simple and then add more code and complexity.
Thanks,
Harry
Re: Simple Usage
Posted: 18 Feb 2009, 15:12
by support
Hello Harry,
Here goes the code of a simple application with the only "Open file..." button:
Code: Select all
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CADImport;
namespace SamplePocketPC2003
{
public partial class Form1 : Form
{
CADImage FCADImage;
Rectangle curClRect;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
FCADImage = new CADImage();
FCADImage.LoadFromFile(dlg.FileName);
}
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
if (FCADImage != null)
FCADImage.Draw(e.Graphics, new RectangleF(0, 0, (float)FCADImage.AbsWidth, (float)FCADImage.AbsHeight), this.ClientRectangle);
}
}
}
Sergey.
Re: Simple Usage
Posted: 18 Feb 2009, 22:24
by hairry_p0tter
Hi Sergey,
Thanks for your response. If it works i do intend purchasing the product.
But the problem is getting it to work as simple as possible:
Your code does not factor my problem statement. I had clearly mentioned that i need to "DISPLAY a sample .dwg file ONLY".
Hence I have made the changes to your code: FCADImage = new DWG.DWGImage();
But your code is still unable to display the same CAD files your viewer is able to display. All i get is a black form.
I have attached the URL to my VS2008 project with your code embedded. Hope you can help.
http://rapidshare.com/files/199691178/z ... 1.rar.html
Regards,
Harry
Re: Simple Usage
Posted: 18 Feb 2009, 22:26
by hairry_p0tter
Re: Simple Usage
Posted: 19 Feb 2009, 11:39
by support
Hello Harry,
There is no need to replace FCADImage = new CADImage(); by FCADImage = new DWG.DWGImage();. It is necessary just to set a filter for the openFileDialog: "DWG Files (*.dwg) |*.dwg".
Sergey.
Re: Simple Usage
Posted: 19 Feb 2009, 13:53
by hairry_p0tter
Sergey,
If i do not replace FCADImage = new CADImage(); by FCADImage = new DWG.DWGImage(); the i get an error "incompatible file type".
But that is not the problem.
Your code is unable to display the same CAD files your viewer is able to display. All i get is a black form.
I have attached the sample project with your source code. Let me know if it runs at your end.
Harry
Re: Simple Usage
Posted: 19 Feb 2009, 14:24
by support
Hello Harry,
Please send us the package to
support@cadsofttools.com.
Sergey.