The new release (0.4) of pythonOCC comes with the Parametric Application Framework (known as PAF) as well as a meshing suite (SMESH). Here is a small demo that shows how to use both these tools to achieve a parametric mesh.
On the screencast below, a simple box is drilled with a hole of diameter 10mm. The box is parametrized with its with, height, depth, and the whole with two parameters: R1 (the radius) and Angle1 (the angle of the revolution, by default set to 0). In the PAF, each time a parameter is modified, the geometry is re-computed and displayed. It’s also possible to register customized callbacks: they are called each time a paramater is updated. In the following demo, we just added a ‘Mesh’ callback: whenever the parameter R1 or Angle1 is modified, the mesh is re-computed and displayed (using the MEFISTO2 mesher).
The source code of this sample can be found in the samples/Level2/PAF directory.