For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Creating great curves number (> 10000). Error

Cherenkova Marina's picture
Forums: 

If i construct sufficiently great curves number (~ 10000 or > 10000 curves) by the next scenario:

Handle_Geom2d_Curve aNewCurve = GCE2d_MakeSegment( gp_Pnt2d(x1, y1), gp_Pnt2d(x2, y2) ).Value();

Handle(Sample2D_Curve) aCurve = new Sample2D_Curve(aNewCurve);

myAISInteractiveContext2D->Display( // object
aCurve,
// Redraw
Standard_False);

,then during dynamic zooming (redisplay 2d viewer) a critical error occur (2d viewer and dialogs don't redisplay correct etc.). Symptom remind of memory damage.
Please, comment this situation.

My work software configuration:
OS : Windows 2000 (SP4), Windows XP (SP2)
Compiler - MS Visual C++ 6.0 (SP6) (Graphic User Interface - MFC).

Error ocur on different modern computers (for example: Athlon 64 2800, Radeon 9800 Pro, 1024 Mb).

Stephane Routelous's picture

it is a *very* bad idea to create an interactive object per curve.
Try to create one intercative object holding all the curves
something like :

Handle_AIS2d_Curves holder = ....
for ( nbCurves )
{
Handle_Geom2d_Curve newCurve = CreateCurve(...);
holder->AddCurve(newCurve);
}

myAISContext2d->Display(holder);

(the implementation of "AIS2d_Curves" is left as an exercise for the reader ;-) )

Stephane

Cherenkova Marina's picture

I need WORK with 1,000,000 (or at least 50,000:-) curves in 2d context of my CAD system.
For every curve i need one text marker and two graphic markers. For every curve i need possibility to change their colors. And for every curve i need possibility interactive selection.
Maybe to create an interactive object per curve it is a "*very* bad idea" from the point of view of effectiveness. But this don't explain "memory damage".

Cherenkova Marina's picture

I need WORK with 1,000,000 (or at least 50,000:-) curves in 2d context of my CAD system.
For every curve i need one text marker and two graphic markers. For every curve i need possibility to change their colors. And for every curve i need possibility interactive selection.
Maybe to create an interactive object per curve it is a "*very* bad idea" from the point of view of effectiveness. But this don't explain "memory damage".

Alex Okun's picture

Hi Marina,
you might want to look into creating your own AIS_InteractiveObject derived class for displaying those lines. I had to create tool path display which in some cases had over 1,000,000 lines in it. The display performance is acceptable if you use your own AIS_InteractiveObject.

You might want to look at User_Cylinder.* files in OpenCASCADE5.2\samples\standard\Mfc\Common for ideas. I ended up stripping most of the stuff from those files since I don't need colors or selection.

I can send you source for my class that takes a pointer to a buffer of vertex locations (three doubles per vertex) and the number of vertex locations and generates an object displaying edges between those points. I didn't implement selection of this shape but you can figure it out from User_Cylinder and Opencascade documentation.

Alex

Alex Okun's picture

Opss, I think you need an AIS2D_InteractiveObject, my stuff is 3D. I would definitely try Stephane's solution first since it looks much easier than creating an interactive object.
Alex

Jeff's picture

Hi Alex,

Did you work on tool path based on OCC, I heard that the triangulation mesh quality is not good, do you other mesh?

Jeff's picture

Hi Alex,

Did you work on tool path based on OCC, I heard that the triangulation mesh quality is not good, do you other mesh?

Jeff's picture

Hi Alex,

Did you work on tool path based on OCC, I heard that the triangulation mesh quality is not good, do you use other mesh?

Alex Okun's picture

Hi Jeff,
I am not doing simulation of cutting operations yet if this is what you are asking. I am working on a cam program that allows you to specify operations to be performed with a mill that can directly translate into NC code, for example, I have drill hole, mill hole, chamfer hole, thread mill, contour w/tab, etc. operations.

To show the user what is going to be created after those operations are executed I build solid objects that represent solid 'chunks' that each operation cuts out of the starting material and subtract them from the starting material. I actually combine all those 'chunks' into a compound first which speeds up the process greatly.

Since each operation is easily translated into NC code it's fairly easy to also generate the 'chunks' and the approximation should actually be perfect assuming that my NC code generation is correct and that my 'chunk' solid generation is correct.

The toolpath display is just a series of lines and arcs that are generated when my NC code calls my 'base post-processor' class which supports things like G01/G02/G03 lines and arcs. The results of all the calls to the post-processor class are stored in a 'vertex buffer' which I then pass on to my AIS_InteractiveObject derived class that takes care of displaying the toolpath.

Let me know if you have any questions.
Alex

Jeff's picture

Hi Alex,

Thanks for your answers, and your cam operations look very interesting.

The operations in your cam program are mostly 2.5D tool path, and if you want to generate tool path for 3D operation, generally the mesh is needed for the toolpath calculation, a good quality mesh is required for a gouge-free 3D tool path.

Also, to simulate the cutting operations of material removal, probally the mesh boolean operations are to be used, I read from this forum that the speed of boolean operation is slow, but I do not know the speed of their commerical one.

Is your cam program a commerical one? I would be interested to see how your cam program works if a demo version is available.

Thanks,

Jeff

Alex Okun's picture

Hi Jeff,
yep, my application (at least currently) is 2.5D. I figured that I might as well switch to OpenCASCADE early on so that I will have more flexibility in the future.

I came to the same conclusion about simulating tool cutting, OpenCASCADE boolean operations are pretty slow.

My program is a sharware, you can take a look at www.alxcam.com. Please keep in mind that it's in very early stage of development. I haven't made any public announcements since there is quite a bit of work left to be done. You shouldn't have to download OpenCASCADE DLLs if you have the library already installed.

I would be definitely interested in hearing any comments you might have. You can email me at aokun at alxcam dott com or aokun2003 att yahoo

Thanks
Alex