예제 #1
0
파일: base.py 프로젝트: tnakaicode/Motion
 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()
예제 #2
0
 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
예제 #3
0
def make_edges(pts):
    edg = []
    for i in range(len(pts) - 1):
        i0, i1 = i, i + 1
        edg.append(make_edge(pts[i0], pts[i1]))
    return make_wire(edg)
예제 #4
0
def set_wire(pts):
    edge = []
    for i in range(len(pts)):
        i0, i1 = i, (i + 1) % len(pts)
        edge.append(make_edge(pts[i0], pts[i1]))
    return make_wire(edge)