def _wideedge(spine, rad, last_p0, last_p1, circled_joints): # TODO: переимплементировать без сегмента import zencad if spine.shapetype() != "edge": raise Exception("argument 'curve' should be edge") ad0 = spine.endpoints()[0] ad1 = spine.endpoints()[1] d10 = spine.d1(spine.range()[0]).cross(vector3(0, 0, 1)).normalize() d11 = spine.d1(spine.range()[1]).cross(vector3(0, 0, 1)).normalize() #p0 = pyservoce.vertex((pt*rad/2).to_point3()) #p1 = pyservoce.vertex((-pt*rad/2).to_point3()) # начальные точки p00 = ad0 + (d10 * rad) p01 = ad0 - (d10 * rad) #конечные точки p10 = ad1 + (d11 * rad) p11 = ad1 - (d11 * rad) perp = pyservoce.segment(p00, p01) wc = pyservoce.pipe(profile=perp, spine=spine, mode="corrected_frenet") wc = wc.faces()[0] if circled_joints is False: if last_p1 is not None and last_p0 is not None: wc = wc + pyservoce.polygon([last_p0, p00, ad0]) wc = wc + pyservoce.polygon([last_p1, p01, ad0]) else: if last_p1 is not None and last_p0 is not None: wc += pyservoce.circle(r=rad).mov(vector3(ad0)) return wc, p10, p11 #union(edgs)
def polygon(pnts, wire=False): if wire: return pyservoce.polysegment(points(pnts), True) else: return pyservoce.polygon(points(pnts))