Simulation, Removal of material

Development Visual BASIC

  Version 0.0.21
Source file and executable (756 KB)
Achievable and installation: NC_Visu0021.exe (2887 KB)

Version 0.0.21

Some bug corrections, in particular on the definition part of tool holder and test of collision with this last.

Concerning the definition of the tool holder and more particularly for the definition of the profile.

The profile of the tool is created starting from a polyline. You must have in the graphic zone of the window an element of type polyline. Only this element will be taken into account.

When you press on the Ok button  to save  the data of the tool, you must see appearing profiles in tool holder in green in the graphic area.

The polyline curve can be obtained by several ways, but must always be created bottom towards the top.(Z0 towards Z+).
You can  use a file dxf to define the profile. The files dxf provided by manufacturing always represents the elements with horizontal also it is necessary to turn the drawing to 90° to be able to use it in our case (button  ). Then you can create a polyline with the button .
Or you can create several lines (button ) which will be then linked with the  button obviously to be selected by the button .

Not to forget to give the length of the tool in the field "Length Assembly" before saving the data .

The program

This is make  to simulate a removal of matter realized by milling 3 axes. The original idea comes from an image and a small sentence found on the Net: With new simulating model, based one the so-called MSN codes (Milling Simulation by Needles).

The idea is to define a field of vector and according to the geometry and the displacement of the tool, one will find the intersection of these lines with the volume of displacement of my tool in 3 axes. Then the tops of these lines will be used to materialize the grid representing our part.

 1ere Stage
Modeliser a small application allowing to set up the basic functions.
- Calculation of the Volume of displacement of the tool
- Calculation of the intersection Vector/Triangles
- Creation of the final grid.

Definition of the Blank
The blank must be positioned as on the following image with the origin in the corner of the block in bottom.

Its dimmensions are defined by its length (according to X), its width (according to Y) and its height (according to Z).
This item Zero will be him positioned in space by giving its coordinates in the zone "Origine Pièce".

The button  is used to update the new one gross.
 2nd  Stage
If the computing time on a simple course is valid, then optimization and reductions of calculations...
 3rd  Stage
Optimisaion of the grid obtained. Representation of the grids in multi color according to the tool used.

To test the program you must use  A) Fichier - > Ouvrir fichier ISO

  Menu to read an Iso file:   To regulate the precision of calculation of the grid (between 2 and 0.1):  BECAREFULL You must have a Pentium 4 to run correctly this program.
To simulate the Iso file: Simulation - > Simulation Depuis fichier After calculation you can transform calculation into a standard STL and especially exportable grid. Simulation - > Transformer en maillage With final it is possible Safeguards the grid visualized in the form of STL Ascii. Note: the option  checked is used  to visualize removal of matter at the same time as the calculation.

For graphic handling:

  Double click in the rendering area:  Use the prefered orientations and zoom
Zoom= Left Mouse button
  Translation = Right Mouse button
  left + Shift :  Rotation around XY
Right + shift :  Rotation around Z


  Version 0.0.2
Optimization of the computing times (75 %). but it is possible to still better do.
Posting of the colors for the tools.
  Version 0.0.3
Addition of an exact mode of calculation. In this case the intersection between the vectors and the volume of displacement is calculated with a model made up of sphere and cylinder: (in this version this mode is valid only for cutters swell).
The option  checked is used to switch to the other mode of calculation. This makes it possible to compare the computing times and the quality of the result.
One can already say that if times are longer with this method, the result is him better.
  Grid with Calculation on Triangle Grid with calculation on exact geometry
Total sight
Detail of the grid
  Version 0.0.5
Addition of a mode of calculation starting from the file directly and not in the control RICHTEXT (treatment much less long). Addition of a function "To remove" the remaining parts elements not attached to the main Part.
after supression of the parts 
  Version 0.0.6
New function allowing to recreate a mapping of calculation starting from a STL file.
  Version 0.0.7
New function to limit the zone of simulation, to refin the grid in order to obtain more precision in this area.
   Description of the bar of tool

Opening of an ISO file.
Save the ISO file.
Creation of a new ISO file.
Access to the dimension of the crude.
Post the library tool.
Post the ISO file.
Non functioning button 6 for the moment.
Non functioning  button 7 for the moment.
Non functioning  button 8 for the moment.
Simulation of the ISO file directly since the file.
(No run of code in the window text, faster method)
Simulation of the ISO file since the fenetre text. (Run of the treated code)
Conversion of the mapping of calculation into model STL.
Rebootstrapping of the mapping of calculation.
Activation of the selection of the triangles and suppression of the nondesired machined parts.
Activation of the mode of selection. The line of code which generated the geometry is selected in the window text. The whole of the facets having been generated by this line of code is visualized in red.
Activation of the mode of selection. After two points selected on the model posting of the zone of zoom via the posting of the envelope of new gross.
Restriction of the zone of simulation on the dimensions selected using the function precedente.

  Version 0.0.8
Integration of the simulation of the cutters plattes in exact mode. (Simulation of the toric cutters not yet integrated).
  Version 0.0.9
Integration of code in the ISO file (in the comments) poiur to fix the parameters of simulation automatically.
BLK FORM DIM : BLK FORM MAX X100.0 Y50.0 Z50.0 : Dimenssions of the crude.
ORIGIN : ORIGIN X0.0 Y0.0 Z0.0 : Co-ordinates of the lower point of the crude (Gross in unspecified position).
INCREMENT : INCREMENT 0.5 : Definition of the increment of mapping.
TOOL_LIB : TOOL_LIB conveys 4 : Definition of a new bookshop tool. To give the name of the file without extension (bat) and numbers it site in the store.
TOOL_DEF TOOL_DEF:|1|2|20|0|60|30|20|16744576|FP20|0|: Definition of a new tool.

FORMAT: TOOL_DEF:|Number tool|Type tool (1=boule 2=plat 3 = toric)|Diameter|Ray of corner|Length|Length of cut|Diameter of tail|Color|Name of the tool|Shift of the programming (0 = Center tool)|
INIT_LIB : INIT_LIB : Rebootstrapping of the bookshop after modification of the tools (essential apres code TOOL_DEF).

File example ISO (385 KB)

Example of result with three levels of tolerance.

View of the 3 superimposed results. 


Grid to 0.5 mm
Grid to 0.1 mm
Grid to 0.025 mm

 Version 0.0.10 & 0.0.11
I started developing this project of simulation for material removal in VB+Opengl. I already carried out the part of the project concerning the simulation of the cutters plattes and balls. But I have a problem now for the toric cutters:
I thought that the problem would be rather simple as for the other types of cutter. But there I try... To summarize: I thought that the "volume" of material removed consisted of geometrical basic which had as a generator the intersection of a plan and torus: - What would have given me an ellipse (Pink curve on the image) and still I am not even certain that it is an ellipse.
Except that after having dug a little more the question, it appears that the curve  is a little more complicated (green curve on the image). It could be not very clear, but for the moment the problem exceeds me a little. . Thus if somebody had an idea, a formula...
If you are interested by this project and if you think of being able to help me, your ideas or your knowledge are welcome.
  Version 0.0.11
Change to the functions glNewList and glCallList for the result display (Rendering is not recomputed any more for each redisplay).
 Version 0.0.12
The businesses begin again... After a small deactivation. And to the favour of rainy holidays I put again  the nose in the subject.
I added a toric simulation of tool based on calculation with the grid (nongeometrical calculation). I could find of the assistance for the calculation of the famous curve silhouette in particular thanks to an article of the university of Waterloo (Canada)
The calculation of the points of the curve is actually rather simple (see following image draw from the article previously quoted)

But my problems with the math are not finished...
To continue the project and add this time an exact calculation. I must now be able to solve this equation and there, that still wedges... do not despair. The problem in this case is: knowing point Pt XY which they are the co-ordinates of the point of intersection between the curve silhouette is the vertical plane passing by our point...

 Version 0.0.13
Optimizations on problem report. Change on calculation mode rendering (no more recalculation between fine and coarse mode)
 Version 0.0.14
Addition of the representation of the edges of the blank result. Addition of a control of returning the matter (machinings realized in G00 mode). Function available only in exact mode.
Addition of a view of the "Arborescent" type, to visualize various information.

This button now makes it possible to alternate between the posting of the contents of the ISO file and the tree structure of posting of information on files NC.

 Version 0.0.15
I worked on calculation in exact mode for the toric cutters. The result is not perfect because I still miss the resolution with my problem of angle according to Y: {
The points representing an anomaly in the representation opposite must with a problem on the calculation of the angle according to Y in the toric case of the cutters.
I use in this case a resolution according to the methode of Newton (Thank you to Gabriel gracin  for his  assistance). Unfortunately in the case  the vector of movement is close to  the horizontal the  result is very unpredictable. I am going to try to remedy this problem in the next version.

Version 0.0.16
Not badly of time passe on the resolution ofequation of the curve silhouette and of tired war, I folded back myself on a dichotomic methode   for the calculation of the angle according to Y. (see notes on version 0.010 a 0.015) It is longer in calculation, but simpler and especially a§a goes! Version 0.016 with calculation of toric in exact mode.
Version 0.0.17
Some small evolution on the project. This time, it's not any more the rain and the cold but a small heat wave which has forced me to stay on  the keyboard this Weekend. I used this time to integreate the  simulation of different tool: You will now find in the list  5 types of tool.
Ball Cutter/  Flat Cutter /  Torus Cutter /  Conical Tool/  Driller

Version 0.0.18
I have modify in this version the definition of the crude. as well as the mask of definition of the tools. It is possible since this new definition of the tools  to define the tool-holder by creation of a polyline in the graphic zone. The Functions are not yet documented… Be patient. It is also possible to read in a DXF to be used as support for the creation of the Tool holder.

Version 0.0.19
Version 0.019 you can test the collision with the tool holder (By cheking the following option).

Version 0.0.20
Few new features in this version. Just correction of small Bugs and a great cleaning of the sources (variable and useless functions) with a little more comments.


You can find a code to calculate the intersection of a line with triangles on the site of (code 27759)

Link to site


Please send your comments, bug carryforwards and others to:

Home   |  read me !