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
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
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
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
def domain(self): '''the u,v domain of the curve :return: UMin, UMax, VMin, VMax ''' return breptools_UVBounds(self)
def _uvBounds(self): return breptools_UVBounds(self.wrapped)
def domain(self) -> Tuple[float, float, float, float]: """the u,v domain of the curve :return: UMin, UMax, VMin, VMax """ return breptools_UVBounds(self)