How to use the zencad.libs.kinematic.rotator 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 / expers / rigidity2.py View on Github external
def __init__(self, l, N, ax):
		self.els = []
		for i in range(N):
			a = finite_element(l/N, i==N-1, ax)
			if i != 0:
				self.els[-1].connector.link(a)
			self.els.append(a)

		#self.els[-1].link(zencad.assemble.unit(shape = cylinder(r=5, h=20).rotate(rvec/nrvec, nrvec)))

		self.force_model = zencad.libs.rigidity.force_model_mass_point(self, 0.5, vec=(0,0,-9.81))
		self.rotator = kinematic.rotator(parent=self.els[-1].connector, ax=ax)

		self.input = self.els[0]
		self.output = self.rotator
github mirmik / zencad / expers / rigidity2.py View on Github external
self.input = self.els[0]
		self.output = self.rotator


class mass(zencad.assemble.unit):
	def __init__(self):
		super().__init__()
		self.add_shape(box(12, center=True))
		self.force_model = zencad.libs.rigidity.force_model_mass_point(self, 20, vec=(0,0,-9.81))

r0 = rod(200, 10, ax=(0,1,0))
r1 = rod(200, 10, ax=(0,0,1))
r2 = rod(200, 10, ax=(0,1,0))

mass = mass()
rot = kinematic.rotator(ax=(0,1,0))
rot.link(r0.input)
r0.output.link(r1.input)
r1.output.link(r2.input)
r2.output.link(mass)

rot.set_coord(deg(-25))
r0.output.set_coord(deg(0))
r1.output.set_coord(deg(0))
r2.output.set_coord(deg(0))

#els[0].relocate(rotateY(-deg(90)))

#zencad.libs.rigidity.attach_force_model(els[0])
base = rot
base.location_update()
github mirmik / zencad / expers / defiler.py View on Github external
self.arm_11 = self.arm()
		self.arm_12 = self.arm()
		self.arm_13 = self.arm()



		self.brot_00 = zencad.libs.kinematic.rotator(location=move( self.x/4,self.y/2,0), ax=(0,0,1))
		self.brot_01 = zencad.libs.kinematic.rotator(location=move(        0,self.y/2,0), ax=(0,0,1))
		self.brot_02 = zencad.libs.kinematic.rotator(location=move(-self.x/4,self.y/2,0), ax=(0,0,1))
		self.brot_03 = zencad.libs.kinematic.rotator(location=move(-self.x/4*2,self.y/2,0), ax=(0,0,1))
		self.brot_10 = zencad.libs.kinematic.rotator(location=move( self.x/4,-self.y/2,0), ax=(0,0,1))
		self.brot_11 = zencad.libs.kinematic.rotator(location=move(        0,-self.y/2,0), ax=(0,0,1))
		self.brot_12 = zencad.libs.kinematic.rotator(location=move(-self.x/4,-self.y/2,0), ax=(0,0,1))
		self.brot_13 = zencad.libs.kinematic.rotator(location=move(-self.x/4*2,-self.y/2,0), ax=(0,0,1))

		self.rot_00 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_01 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_02 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_03 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_10 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_11 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_12 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_13 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		
		self.arms = [self.arm_00, self.arm_01, self.arm_02, self.arm_03, self.arm_10, self.arm_11, self.arm_12, self.arm_13]
		self.rots = [self.rot_00, self.rot_01, self.rot_02, self.rot_03, self.rot_10, self.rot_11, self.rot_12, self.rot_13]
		self.brots = [self.brot_00, self.brot_01, self.brot_02, self.brot_03, self.brot_10, self.brot_11, self.brot_12, self.brot_13]

		#for rot in self.rots: rot.add_triedron()

		for i in range(len(self.arms)):
			self.link(self.brots[i])
github mirmik / zencad / expers / defiler.py View on Github external
self.add_shape(box(self.x, self.y, self.z, center=True).fillet(3))
		
		self.arm_00 = self.arm()
		self.arm_01 = self.arm()
		self.arm_02 = self.arm()
		self.arm_03 = self.arm()
		self.arm_10 = self.arm()
		self.arm_11 = self.arm()
		self.arm_12 = self.arm()
		self.arm_13 = self.arm()



		self.brot_00 = zencad.libs.kinematic.rotator(location=move( self.x/4,self.y/2,0), ax=(0,0,1))
		self.brot_01 = zencad.libs.kinematic.rotator(location=move(        0,self.y/2,0), ax=(0,0,1))
		self.brot_02 = zencad.libs.kinematic.rotator(location=move(-self.x/4,self.y/2,0), ax=(0,0,1))
		self.brot_03 = zencad.libs.kinematic.rotator(location=move(-self.x/4*2,self.y/2,0), ax=(0,0,1))
		self.brot_10 = zencad.libs.kinematic.rotator(location=move( self.x/4,-self.y/2,0), ax=(0,0,1))
		self.brot_11 = zencad.libs.kinematic.rotator(location=move(        0,-self.y/2,0), ax=(0,0,1))
		self.brot_12 = zencad.libs.kinematic.rotator(location=move(-self.x/4,-self.y/2,0), ax=(0,0,1))
		self.brot_13 = zencad.libs.kinematic.rotator(location=move(-self.x/4*2,-self.y/2,0), ax=(0,0,1))

		self.rot_00 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_01 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_02 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_03 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_10 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_11 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_12 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_13 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		
		self.arms = [self.arm_00, self.arm_01, self.arm_02, self.arm_03, self.arm_10, self.arm_11, self.arm_12, self.arm_13]
github mirmik / zencad / expers / defiler.py View on Github external
self.arm_00 = self.arm()
		self.arm_01 = self.arm()
		self.arm_02 = self.arm()
		self.arm_03 = self.arm()
		self.arm_10 = self.arm()
		self.arm_11 = self.arm()
		self.arm_12 = self.arm()
		self.arm_13 = self.arm()



		self.brot_00 = zencad.libs.kinematic.rotator(location=move( self.x/4,self.y/2,0), ax=(0,0,1))
		self.brot_01 = zencad.libs.kinematic.rotator(location=move(        0,self.y/2,0), ax=(0,0,1))
		self.brot_02 = zencad.libs.kinematic.rotator(location=move(-self.x/4,self.y/2,0), ax=(0,0,1))
		self.brot_03 = zencad.libs.kinematic.rotator(location=move(-self.x/4*2,self.y/2,0), ax=(0,0,1))
		self.brot_10 = zencad.libs.kinematic.rotator(location=move( self.x/4,-self.y/2,0), ax=(0,0,1))
		self.brot_11 = zencad.libs.kinematic.rotator(location=move(        0,-self.y/2,0), ax=(0,0,1))
		self.brot_12 = zencad.libs.kinematic.rotator(location=move(-self.x/4,-self.y/2,0), ax=(0,0,1))
		self.brot_13 = zencad.libs.kinematic.rotator(location=move(-self.x/4*2,-self.y/2,0), ax=(0,0,1))

		self.rot_00 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_01 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_02 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_03 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_10 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_11 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_12 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_13 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		
		self.arms = [self.arm_00, self.arm_01, self.arm_02, self.arm_03, self.arm_10, self.arm_11, self.arm_12, self.arm_13]
		self.rots = [self.rot_00, self.rot_01, self.rot_02, self.rot_03, self.rot_10, self.rot_11, self.rot_12, self.rot_13]
github mirmik / zencad / expers / defiler.py View on Github external
self.brot_01 = zencad.libs.kinematic.rotator(location=move(        0,self.y/2,0), ax=(0,0,1))
		self.brot_02 = zencad.libs.kinematic.rotator(location=move(-self.x/4,self.y/2,0), ax=(0,0,1))
		self.brot_03 = zencad.libs.kinematic.rotator(location=move(-self.x/4*2,self.y/2,0), ax=(0,0,1))
		self.brot_10 = zencad.libs.kinematic.rotator(location=move( self.x/4,-self.y/2,0), ax=(0,0,1))
		self.brot_11 = zencad.libs.kinematic.rotator(location=move(        0,-self.y/2,0), ax=(0,0,1))
		self.brot_12 = zencad.libs.kinematic.rotator(location=move(-self.x/4,-self.y/2,0), ax=(0,0,1))
		self.brot_13 = zencad.libs.kinematic.rotator(location=move(-self.x/4*2,-self.y/2,0), ax=(0,0,1))

		self.rot_00 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_01 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_02 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_03 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_10 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_11 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_12 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_13 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		
		self.arms = [self.arm_00, self.arm_01, self.arm_02, self.arm_03, self.arm_10, self.arm_11, self.arm_12, self.arm_13]
		self.rots = [self.rot_00, self.rot_01, self.rot_02, self.rot_03, self.rot_10, self.rot_11, self.rot_12, self.rot_13]
		self.brots = [self.brot_00, self.brot_01, self.brot_02, self.brot_03, self.brot_10, self.brot_11, self.brot_12, self.brot_13]

		#for rot in self.rots: rot.add_triedron()

		for i in range(len(self.arms)):
			self.link(self.brots[i])
			self.brots[i].link(self.rots[i])
			self.rots[i].link(self.arms[i])
			self.arms[i].baserot = self.brots[i]
			self.arms[i].baserot2 = self.rots[i]
			self.rots[i].set_coord(0)

		self.arm_chains = []
github mirmik / zencad / expers / defiler.py View on Github external
self.arm_12 = self.arm()
		self.arm_13 = self.arm()



		self.brot_00 = zencad.libs.kinematic.rotator(location=move( self.x/4,self.y/2,0), ax=(0,0,1))
		self.brot_01 = zencad.libs.kinematic.rotator(location=move(        0,self.y/2,0), ax=(0,0,1))
		self.brot_02 = zencad.libs.kinematic.rotator(location=move(-self.x/4,self.y/2,0), ax=(0,0,1))
		self.brot_03 = zencad.libs.kinematic.rotator(location=move(-self.x/4*2,self.y/2,0), ax=(0,0,1))
		self.brot_10 = zencad.libs.kinematic.rotator(location=move( self.x/4,-self.y/2,0), ax=(0,0,1))
		self.brot_11 = zencad.libs.kinematic.rotator(location=move(        0,-self.y/2,0), ax=(0,0,1))
		self.brot_12 = zencad.libs.kinematic.rotator(location=move(-self.x/4,-self.y/2,0), ax=(0,0,1))
		self.brot_13 = zencad.libs.kinematic.rotator(location=move(-self.x/4*2,-self.y/2,0), ax=(0,0,1))

		self.rot_00 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_01 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_02 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_03 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_10 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_11 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_12 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_13 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		
		self.arms = [self.arm_00, self.arm_01, self.arm_02, self.arm_03, self.arm_10, self.arm_11, self.arm_12, self.arm_13]
		self.rots = [self.rot_00, self.rot_01, self.rot_02, self.rot_03, self.rot_10, self.rot_11, self.rot_12, self.rot_13]
		self.brots = [self.brot_00, self.brot_01, self.brot_02, self.brot_03, self.brot_10, self.brot_11, self.brot_12, self.brot_13]

		#for rot in self.rots: rot.add_triedron()

		for i in range(len(self.arms)):
			self.link(self.brots[i])
			self.brots[i].link(self.rots[i])
github mirmik / zencad / expers / defiler.py View on Github external
self.arm_02 = self.arm()
		self.arm_03 = self.arm()
		self.arm_10 = self.arm()
		self.arm_11 = self.arm()
		self.arm_12 = self.arm()
		self.arm_13 = self.arm()



		self.brot_00 = zencad.libs.kinematic.rotator(location=move( self.x/4,self.y/2,0), ax=(0,0,1))
		self.brot_01 = zencad.libs.kinematic.rotator(location=move(        0,self.y/2,0), ax=(0,0,1))
		self.brot_02 = zencad.libs.kinematic.rotator(location=move(-self.x/4,self.y/2,0), ax=(0,0,1))
		self.brot_03 = zencad.libs.kinematic.rotator(location=move(-self.x/4*2,self.y/2,0), ax=(0,0,1))
		self.brot_10 = zencad.libs.kinematic.rotator(location=move( self.x/4,-self.y/2,0), ax=(0,0,1))
		self.brot_11 = zencad.libs.kinematic.rotator(location=move(        0,-self.y/2,0), ax=(0,0,1))
		self.brot_12 = zencad.libs.kinematic.rotator(location=move(-self.x/4,-self.y/2,0), ax=(0,0,1))
		self.brot_13 = zencad.libs.kinematic.rotator(location=move(-self.x/4*2,-self.y/2,0), ax=(0,0,1))

		self.rot_00 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_01 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_02 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_03 = zencad.libs.kinematic.rotator(ax=(1,0,0))
		self.rot_10 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_11 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_12 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		self.rot_13 = zencad.libs.kinematic.rotator(ax=(-1,0,0))
		
		self.arms = [self.arm_00, self.arm_01, self.arm_02, self.arm_03, self.arm_10, self.arm_11, self.arm_12, self.arm_13]
		self.rots = [self.rot_00, self.rot_01, self.rot_02, self.rot_03, self.rot_10, self.rot_11, self.rot_12, self.rot_13]
		self.brots = [self.brot_00, self.brot_01, self.brot_02, self.brot_03, self.brot_10, self.brot_11, self.brot_12, self.brot_13]

		#for rot in self.rots: rot.add_triedron()