How to use the zencad.mbody.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 / ldpendulum.py View on Github external
#!/usr/bin/env python3

import zencad
from zencad import *
import time
import zencad.libs.lagrange as lagrange
import zencad.libs.forces as forces
import zencad.libs.inertia as inertia
from zencad.libs.screw import screw
import zencad.mbody.kinematic as kinematic

L = 100
arot = kinematic.rotator(name="AROT",ax=(1,0,0))
brot = kinematic.rotator(name="BROT",ax=(1,0,0))
a = zencad.assemble.unit(name="A")
b = zencad.assemble.unit(name="B")
ma = zencad.assemble.unit(name="MA")
mb = zencad.assemble.unit(name="MB")

a.add_shape(cylinder(r=5, h=L))
b.add_shape(cylinder(r=5, h=L))

arot.link(a)
a.link(brot)
brot.link(b)

brot.relocate(up(L))

arot.set_coord(deg(90))
github mirmik / zencad / expers / ldpendulum.py View on Github external
#!/usr/bin/env python3

import zencad
from zencad import *
import time
import zencad.libs.lagrange as lagrange
import zencad.libs.forces as forces
import zencad.libs.inertia as inertia
from zencad.libs.screw import screw
import zencad.mbody.kinematic as kinematic

L = 100
arot = kinematic.rotator(name="AROT",ax=(1,0,0))
brot = kinematic.rotator(name="BROT",ax=(1,0,0))
a = zencad.assemble.unit(name="A")
b = zencad.assemble.unit(name="B")
ma = zencad.assemble.unit(name="MA")
mb = zencad.assemble.unit(name="MB")

a.add_shape(cylinder(r=5, h=L))
b.add_shape(cylinder(r=5, h=L))

arot.link(a)
a.link(brot)
brot.link(b)

brot.relocate(up(L))

arot.set_coord(deg(90))
github mirmik / zencad / expers / rigidity0.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 = zencad.mbody.kinematic.rotator(parent=self.els[-1].connector, ax=ax)

		self.input = self.els[0]
		self.output = self.rotator
github mirmik / zencad / expers / treedy.py View on Github external
inertia.attach_inertia(b, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aaa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aaaa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bbbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aaaaa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bbbbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))

rra = kinematic.rotator(name="RRA",ax=(0,0,1), location=translate(0,-20,0), parent=body)
rrb = kinematic.rotator(name="RRB",ax=(0,0,1), location=translate(0,20,0)*rotateZ(deg(180)), parent=body)
ra = kinematic.rotator(name="RA",ax=(1,0,0))
rb = kinematic.rotator(name="RB",ax=(1,0,0))
raa = kinematic.rotator(name="RAA",ax=(0,1,0))
rbb = kinematic.rotator(name="RBB",ax=(0,1,0))
raaa = kinematic.rotator(name="RAAA",ax=(0,1,0))
rbbb = kinematic.rotator(name="RBBB",ax=(0,1,0))
raaaa = kinematic.rotator(name="RAAAA",ax=(0,1,0))
rbbbb = kinematic.rotator(name="RBBBB",ax=(0,1,0))
raaaaa = kinematic.rotator(name="RAAAAA",ax=(0,1,0))
rbbbbb = kinematic.rotator(name="RBBBBB",ax=(0,1,0))

inertia.attach_inertia(rra.output, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(rrb.output, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))

raa.relocate(up(L))
rbb.relocate(up(L))
raaa.relocate(up(L))
rbbb.relocate(up(L))
raaaa.relocate(up(L))
rbbbb.relocate(up(L))
github mirmik / zencad / expers / treedy.py View on Github external
inertia.attach_inertia(rot.output, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(body, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(a, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(b, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aaa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aaaa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bbbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aaaaa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bbbbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))

rra = kinematic.rotator(name="RRA",ax=(0,0,1), location=translate(0,-20,0), parent=body)
rrb = kinematic.rotator(name="RRB",ax=(0,0,1), location=translate(0,20,0)*rotateZ(deg(180)), parent=body)
ra = kinematic.rotator(name="RA",ax=(1,0,0))
rb = kinematic.rotator(name="RB",ax=(1,0,0))
raa = kinematic.rotator(name="RAA",ax=(0,1,0))
rbb = kinematic.rotator(name="RBB",ax=(0,1,0))
raaa = kinematic.rotator(name="RAAA",ax=(0,1,0))
rbbb = kinematic.rotator(name="RBBB",ax=(0,1,0))
raaaa = kinematic.rotator(name="RAAAA",ax=(0,1,0))
rbbbb = kinematic.rotator(name="RBBBB",ax=(0,1,0))
raaaaa = kinematic.rotator(name="RAAAAA",ax=(0,1,0))
rbbbbb = kinematic.rotator(name="RBBBBB",ax=(0,1,0))

inertia.attach_inertia(rra.output, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(rrb.output, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))

raa.relocate(up(L))
rbb.relocate(up(L))
raaa.relocate(up(L))
github mirmik / zencad / expers / treedy.py View on Github external
inertia.attach_inertia(aaaa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bbbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aaaaa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bbbbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))

rra = kinematic.rotator(name="RRA",ax=(0,0,1), location=translate(0,-20,0), parent=body)
rrb = kinematic.rotator(name="RRB",ax=(0,0,1), location=translate(0,20,0)*rotateZ(deg(180)), parent=body)
ra = kinematic.rotator(name="RA",ax=(1,0,0))
rb = kinematic.rotator(name="RB",ax=(1,0,0))
raa = kinematic.rotator(name="RAA",ax=(0,1,0))
rbb = kinematic.rotator(name="RBB",ax=(0,1,0))
raaa = kinematic.rotator(name="RAAA",ax=(0,1,0))
rbbb = kinematic.rotator(name="RBBB",ax=(0,1,0))
raaaa = kinematic.rotator(name="RAAAA",ax=(0,1,0))
rbbbb = kinematic.rotator(name="RBBBB",ax=(0,1,0))
raaaaa = kinematic.rotator(name="RAAAAA",ax=(0,1,0))
rbbbbb = kinematic.rotator(name="RBBBBB",ax=(0,1,0))

inertia.attach_inertia(rra.output, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(rrb.output, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))

raa.relocate(up(L))
rbb.relocate(up(L))
raaa.relocate(up(L))
rbbb.relocate(up(L))
raaaa.relocate(up(L))
rbbbb.relocate(up(L))
raaaaa.relocate(up(L))
rbbbbb.relocate(up(L))


rra.link_directly(ra)
github mirmik / zencad / expers / treedy.py View on Github external
inertia.attach_inertia(bbbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aaaaa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bbbbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))

rra = kinematic.rotator(name="RRA",ax=(0,0,1), location=translate(0,-20,0), parent=body)
rrb = kinematic.rotator(name="RRB",ax=(0,0,1), location=translate(0,20,0)*rotateZ(deg(180)), parent=body)
ra = kinematic.rotator(name="RA",ax=(1,0,0))
rb = kinematic.rotator(name="RB",ax=(1,0,0))
raa = kinematic.rotator(name="RAA",ax=(0,1,0))
rbb = kinematic.rotator(name="RBB",ax=(0,1,0))
raaa = kinematic.rotator(name="RAAA",ax=(0,1,0))
rbbb = kinematic.rotator(name="RBBB",ax=(0,1,0))
raaaa = kinematic.rotator(name="RAAAA",ax=(0,1,0))
rbbbb = kinematic.rotator(name="RBBBB",ax=(0,1,0))
raaaaa = kinematic.rotator(name="RAAAAA",ax=(0,1,0))
rbbbbb = kinematic.rotator(name="RBBBBB",ax=(0,1,0))

inertia.attach_inertia(rra.output, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(rrb.output, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))

raa.relocate(up(L))
rbb.relocate(up(L))
raaa.relocate(up(L))
rbbb.relocate(up(L))
raaaa.relocate(up(L))
rbbbb.relocate(up(L))
raaaaa.relocate(up(L))
rbbbbb.relocate(up(L))


rra.link_directly(ra)
rrb.link_directly(rb)
github mirmik / zencad / expers / treedy.py View on Github external
inertia.attach_inertia(bbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aaaa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bbbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aaaaa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bbbbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))

rra = kinematic.rotator(name="RRA",ax=(0,0,1), location=translate(0,-20,0), parent=body)
rrb = kinematic.rotator(name="RRB",ax=(0,0,1), location=translate(0,20,0)*rotateZ(deg(180)), parent=body)
ra = kinematic.rotator(name="RA",ax=(1,0,0))
rb = kinematic.rotator(name="RB",ax=(1,0,0))
raa = kinematic.rotator(name="RAA",ax=(0,1,0))
rbb = kinematic.rotator(name="RBB",ax=(0,1,0))
raaa = kinematic.rotator(name="RAAA",ax=(0,1,0))
rbbb = kinematic.rotator(name="RBBB",ax=(0,1,0))
raaaa = kinematic.rotator(name="RAAAA",ax=(0,1,0))
rbbbb = kinematic.rotator(name="RBBBB",ax=(0,1,0))
raaaaa = kinematic.rotator(name="RAAAAA",ax=(0,1,0))
rbbbbb = kinematic.rotator(name="RBBBBB",ax=(0,1,0))

inertia.attach_inertia(rra.output, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(rrb.output, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))

raa.relocate(up(L))
rbb.relocate(up(L))
raaa.relocate(up(L))
rbbb.relocate(up(L))
raaaa.relocate(up(L))
rbbbb.relocate(up(L))
raaaaa.relocate(up(L))
rbbbbb.relocate(up(L))
github mirmik / zencad / expers / treedy.py View on Github external
inertia.attach_inertia(body, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(a, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(b, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aaa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aaaa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bbbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aaaaa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bbbbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))

rra = kinematic.rotator(name="RRA",ax=(0,0,1), location=translate(0,-20,0), parent=body)
rrb = kinematic.rotator(name="RRB",ax=(0,0,1), location=translate(0,20,0)*rotateZ(deg(180)), parent=body)
ra = kinematic.rotator(name="RA",ax=(1,0,0))
rb = kinematic.rotator(name="RB",ax=(1,0,0))
raa = kinematic.rotator(name="RAA",ax=(0,1,0))
rbb = kinematic.rotator(name="RBB",ax=(0,1,0))
raaa = kinematic.rotator(name="RAAA",ax=(0,1,0))
rbbb = kinematic.rotator(name="RBBB",ax=(0,1,0))
raaaa = kinematic.rotator(name="RAAAA",ax=(0,1,0))
rbbbb = kinematic.rotator(name="RBBBB",ax=(0,1,0))
raaaaa = kinematic.rotator(name="RAAAAA",ax=(0,1,0))
rbbbbb = kinematic.rotator(name="RBBBBB",ax=(0,1,0))

inertia.attach_inertia(rra.output, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(rrb.output, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))

raa.relocate(up(L))
rbb.relocate(up(L))
raaa.relocate(up(L))
rbbb.relocate(up(L))
github mirmik / zencad / expers / treedy.py View on Github external
inertia.attach_inertia(bb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aaa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aaaa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bbbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(aaaaa, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(bbbbb, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))

rra = kinematic.rotator(name="RRA",ax=(0,0,1), location=translate(0,-20,0), parent=body)
rrb = kinematic.rotator(name="RRB",ax=(0,0,1), location=translate(0,20,0)*rotateZ(deg(180)), parent=body)
ra = kinematic.rotator(name="RA",ax=(1,0,0))
rb = kinematic.rotator(name="RB",ax=(1,0,0))
raa = kinematic.rotator(name="RAA",ax=(0,1,0))
rbb = kinematic.rotator(name="RBB",ax=(0,1,0))
raaa = kinematic.rotator(name="RAAA",ax=(0,1,0))
rbbb = kinematic.rotator(name="RBBB",ax=(0,1,0))
raaaa = kinematic.rotator(name="RAAAA",ax=(0,1,0))
rbbbb = kinematic.rotator(name="RBBBB",ax=(0,1,0))
raaaaa = kinematic.rotator(name="RAAAAA",ax=(0,1,0))
rbbbbb = kinematic.rotator(name="RBBBBB",ax=(0,1,0))

inertia.attach_inertia(rra.output, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))
inertia.attach_inertia(rrb.output, mass=0.1, Ix=0.1, Iy=0.1, Iz=0.1, radius=pyservoce.vector3(0,0,L))

raa.relocate(up(L))
rbb.relocate(up(L))
raaa.relocate(up(L))
rbbb.relocate(up(L))
raaaa.relocate(up(L))
rbbbb.relocate(up(L))
raaaaa.relocate(up(L))
rbbbbb.relocate(up(L))