Ejemplo n.º 1
0
def solve_radius(event=None):
    display.EraseAll()
    p1 = gp_Pnt(0, 0, 0)
    p2 = gp_Pnt(0, 10, 0)
    p3 = gp_Pnt(0, 10, 10)
    p4 = gp_Pnt(0, 0, 10)
    p5 = gp_Pnt(5, 5, 5)
    poly = make_closed_polygon([p1, p2, p3, p4])
    for i in arange(0.1, 3., 0.2).tolist():
        rcs = RadiusConstrainedSurface(display, poly, p5, i)
        # face = rcs.solve()
        print('Goal: %s radius: %s' % (i, rcs.curr_radius))
        time.sleep(0.5)
Ejemplo n.º 2
0
def geom_plate(event=None):
    display.EraseAll()
    p1 = gp_Pnt(0, 0, 0)
    p2 = gp_Pnt(0, 10, 0)
    p3 = gp_Pnt(0, 10, 10)
    p4 = gp_Pnt(0, 0, 10)
    p5 = gp_Pnt(5, 5, 5)
    poly = make_closed_polygon([p1, p2, p3, p4])
    edges = [i for i in Topo(poly).edges()]
    face = make_n_sided(edges, [p5])
    display.DisplayShape(edges)
    display.DisplayShape(make_vertex(p5))
    display.DisplayShape(face, update=True)
Ejemplo n.º 3
0
def geom_plate(event=None):
    display.EraseAll()
    p1 = gp_Pnt(0, 0, 0)
    p2 = gp_Pnt(0, 10, 0)
    p3 = gp_Pnt(0, 10, 10)
    p4 = gp_Pnt(0, 0, 10)
    p5 = gp_Pnt(5, 5, 5)
    poly = make_closed_polygon([p1, p2, p3, p4])
    edges = [i for i in Topo(poly).edges()]
    face = make_n_sided(edges, [p5])
    display.DisplayShape(edges)
    display.DisplayShape(make_vertex(p5))
    display.DisplayShape(face, update=True)
Ejemplo n.º 4
0
def solve_radius(event=None):
    display.EraseAll()
    p1 = gp_Pnt(0, 0, 0)
    p2 = gp_Pnt(0, 10, 0)
    p3 = gp_Pnt(0, 10, 10)
    p4 = gp_Pnt(0, 0, 10)
    p5 = gp_Pnt(5, 5, 5)
    poly = make_closed_polygon([p1, p2, p3, p4])
    for i in arange(0.1, 3., 0.2).tolist():
        rcs = RadiusConstrainedSurface(display, poly, p5, i)
        # face = rcs.solve()
        print('Goal: %s radius: %s' % (i, rcs.curr_radius))
        time.sleep(0.5)
Ejemplo n.º 5
0
from OCC.gp import gp_Vec, gp_Ax2, gp_Pnt, gp_Dir, gp_Pln, gp_Trsf, gp_Circ
from OCC.BRep import BRep_Tool

from OCCUtils import Topo
from OCC.Bnd import Bnd_Box
import OCC
import OCCUtils
import time
from OCC.BRepOffsetAPI import BRepOffsetAPI_MakePipe

from OCCUtils.Construct import make_closed_polygon
p1 = gp_Pnt(0, 0, 0)
p2 = gp_Pnt(0, 10, 0)
p3 = gp_Pnt(10, 10, 0)
p4 = gp_Pnt(10, 0, 0)
rect = make_closed_polygon(p1, p2, p3, p3)

display, start_display, add_menu, add_function_to_menu = init_display()
#my_box = BRepPrimAPI_MakeBox(10., 20., 30.).Shape()

stl_reader = StlAPI_Reader()
stl_box = TopoDS_Shape()
stl_reader.Read(stl_box, './models/box.stl')

axe = gp_Ax2(gp_Pnt(-10, 1, 1), gp_Dir(0, 0, 1))
box = BRepPrimAPI_MakeBox(axe, 50, 15, 15).Shape()
CommonSurface = BRepAlgoAPI_Common(box, stl_box).Shape()

topo = Topo(CommonSurface)
display.EraseAll()
x_mid_max = -100