NULL reference exception loading PLT

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
rsimpson
Posts: 2
Joined: 19 Dec 2008, 19:32

NULL reference exception loading PLT

Post by rsimpson » 19 Dec 2008, 19:46

The code is fairly straightforward:

CADImage img = new HPGL2.HPGLImage();
img.LoadFromFile(mypltfilename);

Error is: Object reference not set to an instance of an object.
CADImport.dll!..(System.Drawing.Color = "{Name=ff000000, ARGB=(255, 0, 0, 0)}", CADImport.CADLineType = null) + 0x6c bytes
CADImport.dll!..(CADImport.CADEntity = {CADImport.CADPolyLine}) + 0xd0 bytes
CADImport.dll!..() + 0x1057 bytes
CADImport.dll!..(ushort = 20549) + 0x366 bytes
CADImport.dll!..(string = "68.PLT") + 0x208 bytes
CADImport.dll!CADImport.HPGL2.HPGLImage.LoadFromFile(string path = "68.PLT") + 0x58 bytes

If I load this same PLT file into the viewer, or the EditorDemo application, it loads just fine. The same code loading a different filetype, such as a DWG using DWGImage() also loads just fine.

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

Re: NULL reference exception loading PLT

Post by support » 22 Dec 2008, 12:05

Hello!

We recommend to use the following code (it is based on Viewer demo):

Code: Select all

	this.cadImage = CADImage.CreateImageByExtension(@"c:\Test.plt");
	cadImage.LoadFromFile(@"c:\Test.plt");	
	this.cadPictBox.Invalidate();
Sergey.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

rsimpson
Posts: 2
Joined: 19 Dec 2008, 19:32

Re: NULL reference exception loading PLT

Post by rsimpson » 23 Dec 2008, 07:48

Same result. Furthermore, I'm not using a picturebox at all. Just the CADImage() object.

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

Re: NULL reference exception loading PLT

Post by support » 23 Dec 2008, 10:02

Please try the following code:

Code: Select all

	CADImport.HPGL2.HPGLImage img = new CADImport.HPGL2.HPGLImage();
	img.LoadFromFile(@"c:\Test.plt");
If this not help, please send us your PLT file to support@cadsofttools.com with a reference to this topic. We need to test your file.

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

Post Reply