Ejemplo n.º 1
0
def face_normal(face):
    from OCC.BRepTools import breptools_UVBounds
    umin, umax, vmin, vmax = breptools_UVBounds(face)
    surf = BRep_Tool().Surface(face)
    props = GeomLProp_SLProps(surf, (umin+umax)/2., (vmin+vmax)/2., 1, TOLERANCE)
    norm = props.Normal()
    if face.Orientation() == TopAbs_REVERSED:
        norm.Reverse()
    return norm
Ejemplo n.º 2
0
def face_normal(face):
    from OCC.BRepTools import breptools_UVBounds
    umin, umax, vmin, vmax = breptools_UVBounds(face)
    surf = BRep_Tool().Surface(face)
    props = GeomLProp_SLProps(surf, (umin + umax) / 2., (vmin + vmax) / 2., 1,
                              TOLERANCE)
    norm = props.Normal()
    if face.Orientation() == TopAbs_REVERSED:
        norm.Reverse()
    return norm
Ejemplo n.º 3
0
def face_normal(face: TopoDS_Face) -> gp_Dir:
    """

    :param face:
    :return:
    """
    umin, umax, vmin, vmax = breptools_UVBounds(face)
    surf = BRep_Tool().Surface(face)
    props = GeomLProp_SLProps(surf, (umin + umax) / 2., (vmin + vmax) / 2., 1,
                              TOLERANCE)
    norm = props.Normal()
    if face.Orientation() == TopAbs_REVERSED:
        norm.Reverse()
    return norm
Ejemplo n.º 4
0
 def is_trimmed(self):
     """
     :return: True if the Wire delimiting the Face lies on the bounds
     of the surface
     if this is not the case, the wire represents a contour that delimits
     the face [ think cookie cutter ]
     and implies that the surface is trimmed
     """
     _round = lambda x: round(x, 3)
     a = map(_round, breptools_UVBounds(self))
     b = map(_round, self.adaptor.Surface().Surface().GetObject().Bounds())
     if a != b:
         print('a,b', a, b)
         return True
     return False
Ejemplo n.º 5
0
 def is_trimmed(self):
     """
     :return: True if the Wire delimiting the Face lies on the bounds
     of the surface
     if this is not the case, the wire represents a contour that delimits
     the face [ think cookie cutter ]
     and implies that the surface is trimmed
     """
     _round = lambda x: round(x, 3)
     a = map(_round, breptools_UVBounds(self))
     b = map(_round, self.adaptor.Surface().Surface().GetObject().Bounds())
     if a != b:
         print('a,b', a, b)
         return True
     return False
Ejemplo n.º 6
0
 def domain(self):
     '''the u,v domain of the curve
     :return: UMin, UMax, VMin, VMax
     '''
     return breptools_UVBounds(self)
Ejemplo n.º 7
0
 def domain(self):
     '''the u,v domain of the curve
     :return: UMin, UMax, VMin, VMax
     '''
     return breptools_UVBounds(self)
Ejemplo n.º 8
0
    def _uvBounds(self):

        return breptools_UVBounds(self.wrapped)
Ejemplo n.º 9
0
 def domain(self) -> Tuple[float, float, float, float]:
     """the u,v domain of the curve
     :return: UMin, UMax, VMin, VMax
     """
     return breptools_UVBounds(self)