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.
Hi,
First of all thanks for this wonderful package. I almost cried when I saw it
I am trying to find some code fragment on how to create bsplines in 2D and 3D space. I am a very beginner and it would help me a lot.
An example like:
these are control points
these are knots
this is the degree
….and this is the bspline!
Thanks for everything
Luigi
I got it in the samples which previously I didn’t know:
BB = GeomConvert_CompBezierSurfacesToBSplineSurface(bezierarray)
if BB.IsDone():
poles = BB.Poles().GetObject().Array2()
uknots = BB.UKnots().GetObject().Array1()
vknots = BB.VKnots().GetObject().Array1()
umult = BB.UMultiplicities().GetObject().Array1()
vmult = BB.VMultiplicities().GetObject().Array1()
udeg = BB.UDegree()
vdeg = BB.VDegree()
BSPLSURF = Geom_BSplineSurface( poles, uknots, vknots, umult, vmult, udeg, vdeg, 0, 0 )
BSPLSURF.Translate(gp_Vec(0,0,2))
Thanks
@Luigi: thanks for your support. There is indeed a bspline example located in the /examples/src/Level1/geometry_demos.py script. Have fun!