CamBam

FeedBack => Bug Reports => Topic started by: Bob La Londe on July 17, 2018, 02:14:22 am

Title: [V1-12] Buggy File (solved in V1 RC1)
Post by: Bob La Londe on July 17, 2018, 02:14:22 am
I don't know how to quantify this bug.  I start to do anything with this fairly simple file and I get a fatal error.  

Using latest release of 1.0.  


I was setting this up as a templeate file for engraving standard sizes of brass plates and when I went back to do anything with it I get the error quit or continue screen.  Continue clears it and the instant I do anything it comes back.  Quit of course quits.  Never experienced anything like it before.  



Title: Re: Buggy File
Post by: Bob La Londe on July 17, 2018, 02:19:20 am
Draw a straight line or measure are pretty consistent.  Tried select all convert to polyline and it locked up.  Had to use Task Manager to shut it down. 
Title: Re: Buggy File
Post by: Bob La Londe on July 17, 2018, 02:25:15 am
If it helps:  I was able to delete the text entries, and then the problem went away.

Title: Re: Buggy File
Post by: Bob La Londe on July 17, 2018, 02:28:45 am
Then I used CTRL Z to restore the text.  When all but one text field was restored CamBAm got slow and erratic.  When the last one was restored the error came back. 
Title: Re: Buggy File
Post by: dh42 on July 17, 2018, 02:36:59 am
Hello Bob

Problem with Text (14) ; the Text property is empty and cause an error when trying to convert to polyline (Object reference not set to an instance of an object.)

... I saw the same error with empty text a few time ago .. but I don't remember where ...

edit: here
http://www.cambam.co.uk/forum/index.php?topic=6790.msg59478#msg59478

++
David
Title: Re: Buggy File
Post by: Dragonfly on July 17, 2018, 08:20:32 am
Quote
... I saw the same error with empty text a few time ago .. but I don't remember where ...
It was in one of my files where you found the problem faster than me, as usual :)

It was connected to the 'Snappy' plugin when the mouse pointer hovered over the empty object and Eddy added a check to the plugin.
IIRC I then suggested that such check might be useful to add into CamBam itself when reading a file. And discard invalid objects.
Title: Re: Buggy File
Post by: 10bulls on July 17, 2018, 11:24:42 am
I have changed the MText.ToRegions() method to return an empty array, rather than a null value.

This prevents the error and should also be kinder on scripting and plugins.
This will be in the next update.

Thank you for pointing this out.
Title: Re: Buggy File
Post by: EddyCurrent on July 17, 2018, 12:05:26 pm
In the Snappy plugin I used this method to detect an invalid entity;

 // detect invalid entities
     Point3F cnt = ent1.GetCentroid();
     if (cnt.X.ToString() == "NaN") continue;

It uses 'continue' due to the code being in a loop

Title: Re: Buggy File
Post by: 10bulls on July 17, 2018, 12:38:29 pm
Points and vectors in CamBam provide a property 'IsUndefined'.
This returns true if any X,Y or Z properties are NaN.
You can use it like this...

Code: [Select]
Point3F cnt = ent1.GetCentroid();
     if (cnt.IsUndefined) continue;

There is also a .NET function double.IsNaN(...) which is useful to check numbers for NaNs without needing string compares.

If you want to set a point as undefined you can use the point and vector .Undefined static property, like this...

Code: [Select]
Point3F p = Point3F.Undefined;

Title: Re: Buggy File
Post by: Bob La Londe on July 17, 2018, 22:43:33 pm
http://www.cncmolds.com/webstore/custom-engraved-brass-plates-make-your-own-plaques.html

Here is some CamBam work I can show.  LOL.