Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def to_point(arg):
return zencad.util.point3(arg)
def scale(factor, center):
if factor is list or factor is tuple:
return pyservoce.scaleXYZ(factor[0], factor[1], factor[2])
return pyservoce.scale(factor, point3(center).to_servoce())
def restart(self, pnt, y=None, z=None):
pnt = self.collect_point(pnt, y, z)
self.edges = []
self.current = point3(pnt)
self.start = self.current
return self
def circle_arc(p1, p2, p3):
"""Построение дуги круга по трем точкам"""
return pyservoce.circle_arc(point3(p1), point3(p2), point3(p3))
def arrow(pnt, vec, clr=zencad.color.white, arrlen=5, width=1, scene=None):
if scene is None: scene = zencad.default_scene()
intobj = pyservoce.draw_arrow(zencad.util.point3(pnt), zencad.util.vector3(vec), clr, arrlen, width)
if scene:
scene.add(intobj)
return intobj
def line(apnt, bpnt, clr=zencad.color.white, width=1, scene=None):
if scene is None: scene = zencad.default_scene()
intobj = pyservoce.draw_line(zencad.util.point3(apnt), zencad.util.point3(bpnt), clr=clr, width=width)
if scene:
scene.add(intobj)
return intobj
def plane_circle_arc(self, r, angle, large, sweep, x, y):
centers = zencad.gutil.restore_circle_centers(self.current, point3(x,y), r)
target = point3(x,y)
cent = None
if centers[0].early(centers[1]):
cent = centers[0]
if sweep:
self.arc(cent, r, deg(180))
else:
self.arc(cent, r, -deg(180))
else:
for c in centers:
cv = self.current - c