def make_EllipWire(self, rxy=[1.0, 1.0], shft=0.0, skin=None, axs=gp_Ax3()): rx, ry = rxy if rx > ry: major_radi = rx minor_radi = ry axis = gp_Ax2() axis.SetXDirection(axis.XDirection()) else: major_radi = ry minor_radi = rx axis = gp_Ax2() axis.SetXDirection(axis.YDirection()) axis.Rotate(axis.Axis(), np.deg2rad(shft)) elip = make_edge(gp_Elips(axis, major_radi, minor_radi)) poly = make_wire(elip) poly.Location(set_loc(gp_Ax3(), axs)) if skin == None: return poly else: n_sided = BRepFill_Filling() for e in Topo(poly).edges(): n_sided.Add(e, GeomAbs_C0) n_sided.Build() face = n_sided.Face() if skin == 0: return face else: solid = BRepOffset_MakeOffset(face, skin, 1.0E-5, BRepOffset_Skin, False, True, GeomAbs_Arc, True, True) return solid.Shape()
def test_points_from_intersection(self): '''Test: points from intersection''' PL = gp_Pln(gp_Ax3(gp_XOY())) MinorRadius, MajorRadius = 5, 8 EL = gp_Elips(gp_YOZ(), MajorRadius, MinorRadius) ICQ = IntAna_IntConicQuad(EL, PL, precision_Angular(), precision_Confusion()) if ICQ.IsDone(): NbResults = ICQ.NbPoints() if NbResults > 0: for i in range(1, NbResults + 1): P = ICQ.Point(i) self.assertIsInstance(P, gp_Pnt) aPlane = GC_MakePlane(PL).Value() aSurface = Geom_RectangularTrimmedSurface(aPlane, -8., 8., -12., 12., True, True) self.assertIsNotNone(aSurface) self.assertFalse(aSurface.IsNull()) anEllips = GC_MakeEllipse(EL).Value() self.assertIsInstance(anEllips, Geom_Ellipse) if ICQ.IsDone(): NbResults = ICQ.NbPoints() if NbResults > 0: for i in range(1, NbResults + 1): P = ICQ.Point(i) self.assertIsInstance(P, gp_Pnt)
def points_from_intersection(): ''' @param display: ''' plane = gp_Pln(gp_Ax3(gp_XOY())) minor_radius, major_radius = 5., 8. ellips = gp_Elips(gp_YOZ(), major_radius, minor_radius) intersection = IntAna_IntConicQuad(ellips, plane, precision_Angular(), precision_Confusion()) a_plane = GC_MakePlane(plane).Value() a_surface = Geom_RectangularTrimmedSurface(a_plane, -8., 8., -12., 12., True, True) display.DisplayShape(a_surface, update=True) anEllips = GC_MakeEllipse(ellips).Value() display.DisplayShape(anEllips) if intersection.IsDone(): nb_results = intersection.NbPoints() if nb_results > 0: for i in range(1, nb_results + 1): P = intersection.Point(i) pstring = "P%i" % i display.DisplayShape(P) display.DisplayMessage(P, pstring)
def edge(event=None): # The blud edge BlueEdge = BRepBuilderAPI_MakeEdge(gp_Pnt(-80, -50, -20), gp_Pnt(-30, -60, -60)) V1 = BRepBuilderAPI_MakeVertex(gp_Pnt(-20, 10, -30)) V2 = BRepBuilderAPI_MakeVertex(gp_Pnt(10, 7, -25)) YellowEdge = BRepBuilderAPI_MakeEdge(V1.Vertex(), V2.Vertex()) #The white edge line = gp_Lin(gp_Ax1(gp_Pnt(10, 10, 10), gp_Dir(1, 0, 0))) WhiteEdge = BRepBuilderAPI_MakeEdge(line, -20, 10) #The red edge Elips = gp_Elips(gp_Ax2(gp_Pnt(10, 0, 0), gp_Dir(1, 1, 1)), 60, 30) RedEdge = BRepBuilderAPI_MakeEdge(Elips, 0, math.pi/2) # The green edge and the both extreme vertex P1 = gp_Pnt(-15, 200, 10) P2 = gp_Pnt(5, 204, 0) P3 = gp_Pnt(15, 200, 0) P4 = gp_Pnt(-15, 20, 15) P5 = gp_Pnt(-5, 20, 0) P6 = gp_Pnt(15, 20, 0) P7 = gp_Pnt(24, 120, 0) P8 = gp_Pnt(-24, 120, 12.5) array = TColgp_Array1OfPnt(1, 8) array.SetValue(1, P1) array.SetValue(2, P2) array.SetValue(3, P3) array.SetValue(4, P4) array.SetValue(5, P5) array.SetValue(6, P6) array.SetValue(7, P7) array.SetValue(8, P8) curve = Geom_BezierCurve(array) ME = BRepBuilderAPI_MakeEdge(curve) GreenEdge = ME V3 = ME.Vertex1() V4 = ME.Vertex2() display.DisplayColoredShape(BlueEdge.Edge(), 'BLUE') display.DisplayShape(V1.Vertex()) display.DisplayShape(V2.Vertex()) display.DisplayColoredShape(WhiteEdge.Edge(), 'WHITE') display.DisplayColoredShape(YellowEdge.Edge(), 'YELLOW') display.DisplayColoredShape(RedEdge.Edge(), 'RED') display.DisplayColoredShape(GreenEdge.Edge(), 'GREEN') display.DisplayShape(V3) display.DisplayShape(V4, update=True)
def make_Ellip(self, rxy=[1.0, 1.0], shft=0.0, axs=gp_Ax3()): rx, ry = rxy if rx > ry: major_radi = rx minor_radi = ry axis = axs.Ax2() axis.SetXDirection(axs.XDirection()) else: major_radi = ry minor_radi = rx axis = axs.Ax2() axis.SetXDirection(axs.YDirection()) axis.Rotate(axs.Axis(), np.deg2rad(shft)) elip = make_edge(gp_Elips(axis, major_radi, minor_radi)) poly = make_wire(elip) return poly
def test_points_from_intersection(self): '''Test: points from intersection''' PL = gp_Pln(gp_Ax3(gp_XOY())) MinorRadius, MajorRadius = 5, 8 EL = gp_Elips(gp_YOZ(), MajorRadius, MinorRadius) ICQ = IntAna_IntConicQuad(EL, PL, precision_Angular(), precision_Confusion()) if ICQ.IsDone(): NbResults = ICQ.NbPoints() if NbResults > 0: for i in range(1, NbResults + 1): P = ICQ.Point(i) self.assertIsInstance(P, gp_Pnt) aPlane = GC_MakePlane(PL).Value() aSurface = Geom_RectangularTrimmedSurface(aPlane, - 8., 8., - 12., 12., True, True) self.assertIsNotNone(aSurface) self.assertFalse(aSurface.IsNull()) anEllips = GC_MakeEllipse(EL).Value() self.assertIsInstance(anEllips, Geom_Ellipse) if ICQ.IsDone(): NbResults = ICQ.NbPoints() if NbResults > 0: for i in range(1, NbResults + 1): P = ICQ.Point(i) self.assertIsInstance(P, gp_Pnt)
def MakeEllipsFace(self, Major: float, Minor: float) -> TopoDS_Face: elip = gp_Elips( gp_XOY(), Major, Minor ) ed = make_edge( elip ) wire = make_wire( ed ) return make_face( wire )