Skip to content

Commit

Permalink
primitive primitives and geometries for part mating
Browse files Browse the repository at this point in the history
  • Loading branch information
kanzure committed Jul 17, 2009
1 parent e049fd2 commit 7cc204e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pymates/geom.py
@@ -0,0 +1,21 @@
#!/usr/bin/python

import yaml
import numpy
import primitives

class Circle(primitives.PrimitiveShape):
'''generic circle. units are meters.'''
yaml_tag = '!circle'
def __init__(self,radius=1,x=0,y=0,z=0,i=numpy.array([0,0,0]),j=numpy.array([0,0,0]),k=numpy.array([0,0,0])):
'''xyz are positions. ijk are unit vectors describing the local coordinate frame.'''
super(x=x,y=y,z=z,i=i,j=j,k=k)
self.radius = radius

class Square(primitives.PrimitiveShape):
'''generic square. units are meters.'''
yaml_tag = '!square'
def __init__(self,width=1,height=1,x=0,y=0,z=0,i=numpy.array([0,0,0]),j=numpy.array([0,0,0]),k=numpy.array([0,0,0])):
super(x=x,y=y,z=z,i=i,j=j,k=k)
self.width = width
self.height = height
15 changes: 15 additions & 0 deletions pymates/primitives.py
@@ -0,0 +1,15 @@
#!/usr/bin/python

import yaml
import numpy

class PrimitiveShape(yaml.YAMLObject):
'''generic primitive shape wrapper for pythonOCC/OpenCASCADE and friends'''
yaml_tag = '!PrimitiveShape' #not this matters much
def __init__(self,x=0,y=0,z=0,i=numpy.array([0,0,0]),j=numpy.array([0,0,0]),k=numpy.array([0,0,0])):
self.x = x
self.y = y
self.z = z
self.i = i
self.j = j
self.k = k
5 changes: 5 additions & 0 deletions pymates/pymates.py
@@ -1,12 +1,17 @@
#!/usr/bin/python
#pymates

import yaml
import geom

# the following aren't our responsibility, actually (pythonOCC?)
#class Circle(yaml.YAMLObject)
#class Cylinder(yaml.YAMLObject)
#class InterfaceGeom(yaml.YAMLObject):

class Part(yaml.YAMLObject):
'''used for part mating. argh I hope OCC doesn't already implement this and I just don't know it.'''
yaml_tag='!part'
pass

class Interface(yaml.YAMLObject):
Expand Down

0 comments on commit 7cc204e

Please sign in to comment.