def show_next_mate(event=None, mate=None): '''cycle through available options and display them with each keypress''' global opt display.EraseAll() display.DisplayColoredShape(current_brick.shapes[0], 'RED') conn=opts[opt] opt += 1 trsf = mate_connection(conn) display.DisplayShape(BRepBuilderAPI_Transform(conn.interface2.part.shapes[0], trsf, True).Shape()) display.DisplayShape(make_vertex(Point(conn.interface1.point).Transformed(trsf))) display.DisplayShape(make_vertex(Point(conn.interface2.point).Transformed(trsf)))
def draw_all_tangents(event=None): display.EraseAll() init_display() points = [] for i in range(5): point = gp_Pnt2d(random.randint(0, 10), random.randint(0, 10)) points += [point] make_text('P' + str(i), point, 6) display.DisplayShape(make_vertex(point)) C = GCE2d_MakeArcOfCircle(points[0], points[1], points[2]).Value() display.DisplayShape(make_edge2d(C)) C_gp = gce_MakeCirc2d(points[0], points[1], points[2]).Value( ) #ew. same thing; tangent solver wants a circle, not arc L = GCE2d_MakeSegment(points[3], points[4]).Value() #L = GccAna_Lin2d2Tan(points[3], points[4],Precision().Confusion()).ThisSolution(1) display.DisplayShape([make_edge2d(L)]) L_gp = gce_MakeLin2d(points[3], points[4]).Value( ) #yuck. same thing; tangent solver wants a line, not segment tangents(C_gp, L_gp, radius=2)
def clear(event=None, app=app): app.current_brick = None app.all_bricks = [] app.cgraph = FakeIGraph() display.EraseAll()
def show_bricks(): display.EraseAll() display.DisplayShape([brick.shapes[0] for brick in app.all_bricks])
def clear(event=None): display.EraseAll()