def build_auto_wire_sanjiaoxing():
# 做第一条封闭曲线(四边形)
gp_n = [0, 1, 2, 3, 4]
gp_x = [40, 82.5, 42.5, 0, 8]
gp_y = [0, 25, 93, 68,22]
gp_z = [0, 0, 0, 0,22]
dict_gp_x = dict(zip(gp_n, gp_x))
dict_gp_y = dict(zip(gp_n, gp_y))
dict_gp_z = dict(zip(gp_n, gp_z))
dict_select_num = 3
aWire = BRepBuilderAPI_MakeWire() # Create a wire out of the edges
for i in range(0, dict_select_num):
if i < dict_select_num - 1:
aSegment = GC_MakeSegment(gp_Pnt(dict_gp_x[i], dict_gp_y[i], dict_gp_z[i]),
gp_Pnt(dict_gp_x[i + 1], dict_gp_y[i + 1], dict_gp_z[i + 1]))
anEdge = BRepBuilderAPI_MakeEdge(aSegment.Value())
aWire.Add(anEdge.Edge())
else:
aSegment = GC_MakeSegment(gp_Pnt(dict_gp_x[i], dict_gp_y[i], dict_gp_z[i]),
gp_Pnt(dict_gp_x[0], dict_gp_y[0], dict_gp_z[0]))
anEdge = BRepBuilderAPI_MakeEdge(aSegment.Value())
aWire.Add(anEdge.Edge())
display.DisplayShape(aWire.Shape(), update=True, color=rgb_color(0.1, 0.2, 1)) #