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

getting and setting a knots sequence

a a's picture

Hi all,

My question in short:  how do you access a knot sequence and how do you update it?

My code so far (which is an adaptation of one script from PyGeM script):

from OCC.STEPControl import STEPControl_Reader

reader = STEPControl_Reader()

fileLocation = "pipe.step"

return_reader = reader.ReadFile(fileLocation)

return_transfer = reader.TransferRoots()

shape = reader.OneShape()

# Looping through the faces

facesExplorer = TopExp_Explorer(shape, TopAbs_FACE):

    face = topods_Face(faces_explorer.Current())

    nurbs_converter = BRepBuilderAPI_NurbsConvert(face)


    nurbs_face = nurbs_converter.Shape()

    face_aux = topods_Face(nurbs_face)

    brep_face = BRep_Tool.Surface(topods_Face(nurbs_face))

   bspline_face = geomconvert_SurfaceToBSplineSurface(brep_face)

   occ_face = bspline_face.GetObject()

   print("No Uknots", occ_face.NbUKnots())



   n_faces += 1


What I have: At this point I can easily access info such as: occ_face.NbUKnots(), occ_face.VDegree() and many more.  I have already another code which updates the pole and weight values.

Specific question: Now I have surface which has 2 knots along both U and V directions. What I'd like to do is to increase that number to 10 in both U and V directions and set their values (I know them).

Proposed action: Using python dir(occ_face) I can see all the methods available on the occ_face object to access the knots info. I am sure I can get the sequence via UKnotSequence () and then update their value via SetUKnot() or SetUKnots(), but reading the online API is not helping me, meaning I am not sure on the syntax.


Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.