Wednesday, May 6, 2009

Automatic test codes

Noticed a fact that when the mouse goes over and out of a drawn shape or over an item from the tree list the reported number of GDI objects increases with about 300 objects at every mouse over. When it reaches 10000 GDI objects the application crashes. This is a reason for some of the Extrude crashes but it is not related with the extrusion algorithm.

Verified the PropertyGrid for leaking, the TreeView and also the NamedShapeInterpreter.RegenerateShape(). Couldn't find the problem. In order to solve it, improved the descriptors that display the objects in the grid so they are reused instead of being created at each display.
To test the shape creation for leaking decided to make nUnit test codes for it: implemented a test framework that prepares the environment for testing OpenCascade objects, implemented a test that creates a shape, displays it and removes it 1000 times and it wasn't generating GDI object creation leaks, implemented another test that creates a rectangle in a Node from the data tree then displays the shape generated and selects/unselects it 1000 times, this also is not generating any GDI leaks.

Will continue investigating this problem improving and fixing the code while investigating.

2 comments:

entery said...

Hi again ;o)

Is it possible to define two surfaces and connect them to build a solid?

E.g. can I define two circles that have no point in common and then build a cone-like solid by connecting the circles? If yes, could you outline a strategy to do this?

Thanks a lot in advance.
-entery

bxtrx said...

Hi,

I am not sure which algorithm builds such a solid but I think I pointed you in the past to the documentation where the Features are described. I think you can make this using the Extrude feature. You can see an extrusion sample in the ExtrudeFunction class form NaroCad.
Another way would be to look at the make bottle sample code from OpenCascade that shows you how to build more complex solids.

Best regards,
Mihai