How to use the zencad.lazifier.lazy.lazy function in zencad

To help you get started, we’ve selected a few zencad examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mirmik / zencad / zencad / geom / ops3d.py View on Github external
@lazy.lazy(cls=shape_generator)
def pipe(proto, spine, frenet=False, mode="corrected_frenet", force_approx_c1=False, path=None):
	if path is not None:
		spine = path
		print("pipe: path option is renamed. use spine instead")

	if frenet is True:
		mode = "frenet"

	if isinstance(proto, pyservoce.SolidShape):
		proto = proto.outshell()

	return pyservoce.pipe(proto, spine, mode, force_approx_c1)
github mirmik / zencad / zencad / geom / ops3d.py View on Github external
@lazy.lazy(cls=shape_generator)
def chamfer(proto, r, refs=None):
	if refs is None:
		return pyservoce.chamfer(proto, r)
	else:
		return pyservoce.chamfer(proto, r, points(refs))
github mirmik / zencad / zencad / geom / prim2d.py View on Github external
@lazy.lazy(cls=nocached_shape_generator)
def square(a, center=False, wire=False):
    if wire:
        foo = pyservoce.square_wire
    else:
        foo = pyservoce.square

    return foo(a, center)
github mirmik / zencad / zencad / geom / prim1d.py View on Github external
@lazy.lazy(cls=shape_generator)
def rounded_polysegment(pnts, r, closed=False):
	pnts = points(pnts)

	# Для того, чтобы закрыть контур, не теряя скругления, перекрёстно добавляем две точки,
	# Две в начале, другую в конце.
	if closed:
		pnts.insert(0, pnts[-1])
		pnts.append(pnts[1])

	cpnts = pnts[1:-1]

	pairs = []
	pairs_tangs = []
	pairs.append((None, pnts[0]))

	for i in range(len(cpnts)):
github mirmik / zencad / zencad / geom / prim2d.py View on Github external
@lazy.lazy(cls=shape_generator)
def ruled(a, b):
    if a.shapetype()=="edge" and b.shapetype()=="edge":
        return pyservoce.ruled_face(a, b)

    else:
        return pyservoce.ruled_shell(a, b)
github mirmik / zencad / zencad / geom / prim2d.py View on Github external
@lazy.lazy(cls=nocached_shape_generator)
def circle(r, angle=None, wire=False):
    if wire:
        foo = pyservoce.circle_edge
    else:
        foo = pyservoce.circle

    if angle is not None:
        angle = angle_pair(angle)
        return foo(r, angle[0], angle[1])
    else:
        return foo(r)
github mirmik / zencad / zencad / geom / prim2d.py View on Github external
@lazy.lazy(cls=nocached_shape_generator)
def ngon(r, n, wire=False):
    if wire:
        foo = pyservoce.ngon_wire
    else:
        foo = pyservoce.ngon

    return foo(r, n)
github mirmik / zencad / zencad / geom / prim3d.py View on Github external
@lazy.lazy(cls=nocached_shape_generator)
def box(size, arg2=None, arg3=None, center=False, shell=False):
    if arg3 == None:
        if hasattr(size, "__getitem__"):
            m = pyservoce.box(size[0], size[1], size[2], center)
        else:
            m = pyservoce.box(size, size, size, center)
    else:
        m = pyservoce.box(size, arg2, arg3, center)

    if shell:
        return m.shells()[0]
    else:
        return m
github mirmik / zencad / zencad / geom / ops3d.py View on Github external
@lazy.lazy(cls=shape_generator)
def linear_extrude(proto, vec, center=False):
	if isinstance(vec, (int, float)):
		vec = vector3(0, 0, vec)
	return pyservoce.linear_extrude(proto, vector3(vec), center)
github mirmik / zencad / zencad / __init__.py View on Github external
@lazy.lazy(cls=shape_generator)
def near_face(shp, pnt):
    """Find near face to point `pnt` in shape `shp`"""
    return pyservoce.near_face(shp, pnt)