Simple Usage

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
hairry_p0tter
Posts: 6
Joined: 18 Feb 2009, 01:50

Simple Usage

Post by hairry_p0tter » 18 Feb 2009, 01:57

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

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

Re: Simple Usage

Post by support » 18 Feb 2009, 15:44

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.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

hairry_p0tter
Posts: 6
Joined: 18 Feb 2009, 01:50

Re: Simple Usage

Post by hairry_p0tter » 18 Feb 2009, 22:20

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

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

Re: Simple Usage

Post by support » 24 Feb 2009, 14:28

Hello Harry,

We have received your demo. The matter is that your file has DWG 2007 format. It is not supported by current version of CAD Import .NET for Compact Framework. We will inform you when update is available.

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

Post Reply