def test_brep_curve3d_values_serialization(curve, polyline, circle): brep = Brep() assert brep.Curve3D == None assert brep.Curve3DValues == None brep.Curve3D = [curve, polyline] assert brep.Curve3DValues == CurveArray.from_curves([curve, polyline]).data brep.Curve3DValues = CurveArray.from_curves([circle]).data assert len(brep.Curve3D) == 1 assert brep.Curve3D[0].get_id() == circle.get_id()
def test_brep_surfaces_value_serialization(surface): brep = Brep() assert brep.Surfaces == None assert brep.SurfacesValue == None brep.Surfaces = [surface, surface] assert brep.SurfacesValue == ObjectArray.from_objects([surface, surface]).data brep.SurfacesValue = ObjectArray.from_objects([surface]).data assert len(brep.Surfaces) == 1 assert brep.Surfaces[0].get_id() == surface.get_id()
def brep( mesh, box, surface, curve, polyline, circle, point, brep_edge, brep_loop, brep_trim, brep_face, ): return Brep( provenance="pytest", bbox=box, area=32, volume=54, displayValue=mesh, Surfaces=[surface, surface, surface], Curve3D=[curve, polyline], Curve2D=[circle], Vertices=[point, point, point, point], Edges=[brep_edge], Loops=[brep_loop, brep_loop], Trims=[brep_trim], Faces=[brep_face, brep_face], IsClosed=False, Orientation=3, )
def test_trims_value_serialization(): brep = Brep() brep.TrimsValue = [ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 2, 1, 0, ] brep.Trims[0].get_id() == BrepTrim( EdgeIndex=0, StartIndex=0, EndIndex=0, FaceIndex=0, LoopIndex=0, CurveIndex=0, IsoStatus=1, TrimType=BrepTrimTypeEnum.Boundary, IsReversed=False, ).get_id() brep.Trims[1].get_id() == BrepTrim( EdgeIndex=1, StartIndex=0, EndIndex=0, FaceIndex=0, LoopIndex=0, CurveIndex=1, IsoStatus=2, TrimType=BrepTrimTypeEnum.Boundary, IsReversed=True, ).get_id()
def test_brep_vertices_values_serialization(): brep = Brep() brep.VerticesValue = [1, 1, 1, 1, 2, 2, 2, 3, 3, 3] brep.Vertices[0].get_id() == Point(x=1, y=1, z=1, _units="mm").get_id() brep.Vertices[1].get_id() == Point(x=2, y=2, z=2, _units="mm").get_id() brep.Vertices[2].get_id() == Point(x=3, y=3, z=3, _units="mm").get_id()