def test_r12_cubic_spline_closed(msp): spline = R12Spline(CONTROL_POINTS, degree=3, closed=True) polyline = spline.render(msp, segments=40) assert polyline.dxftype() == 'POLYLINE' assert polyline.dxf.layer == '0' assert len(polyline) == 41 + len(CONTROL_POINTS) assert polyline.is_closed is True
def test_r12_quadratic_spline(msp): spline = R12Spline(CONTROL_POINTS, degree=2, closed=False) polyline = spline.render(msp, segments=40) assert polyline.dxftype() == 'POLYLINE' assert polyline.dxf.layer == '0' assert len(polyline) == 41 + len(CONTROL_POINTS) assert polyline.is_closed is False
dxfattribs['extrusion'] = extrusion for point in points: msp.add_circle(radius=0.1, center=point, dxfattribs=dxfattribs) base_spline_points = [(8.55, 2.96), (8.55, -.03), (2.75, -.03), (2.76, 3.05), (4.29, 1.78), (6.79, 3.05)] spline_points = [Vector(p) for p in base_spline_points] # open quadratic b-spline draw(spline_points) msp.add_text("Open Quadratic R12Spline", dxfattribs={ 'height': .1 }).set_pos(spline_points[0]) R12Spline(spline_points, degree=2, closed=False).render(msp, segments=SEGMENTS, dxfattribs={'color': 3}) if dwg.dxfversion > 'AC1009': msp.add_open_spline(control_points=spline_points, degree=2, dxfattribs={'color': 4}) # open cubic b-spline spline_points = next_frame.transform_vectors(spline_points) draw(spline_points) msp.add_text("Open Cubic R12Spline", dxfattribs={ 'height': .1 }).set_pos(spline_points[0]) R12Spline(spline_points, degree=3, closed=False).render(msp, segments=SEGMENTS, dxfattribs={'color': 3}) if dwg.dxfversion > 'AC1009': msp.add_open_spline(control_points=spline_points,