def test_common_criteria(self): def foo(**kwargs): return kwargs self.assertEqual(foo(a=1), {'a': 1}) bar = common_criteria(b=2)(foo) self.assertEqual(bar(a=1), {'a': 1, 'b': 2})
""" Create solid to subtract from material to make way for the fastener's head (just the head) """ return cadquery.Workplane('XY') \ .circle(self.access_diameter / 2) \ .extrude(self.access_height) def get_face_offset(self): """ Returns the screw drive origin offset relative to bolt's origin """ return (0, 0, self.height) # ------ Registration from cqparts.search import ( find as _find, search as _search, register as _register, ) from cqparts.search import common_criteria module_criteria = { 'module': __name__, } register = common_criteria(**module_criteria)(_register) search = common_criteria(**module_criteria)(_search) find = common_criteria(**module_criteria)(_find)
Make a solid to subtract from an interfacing solid to bore a pilot-hole. """ # get pilothole ratio # note: not done in .initialize_parameters() because this would cause # the thread's profile to be created at initialisation (by default). pilothole_radius = self.pilothole_radius if pilothole_radius is None: (inner_radius, outer_radius) = self.get_radii() pilothole_radius = inner_radius + self.pilothole_ratio * (outer_radius - inner_radius) return cadquery.Workplane('XY') \ .circle(pilothole_radius) \ .extrude(self.length) # ------ Registration from cqparts.search import ( find as _find, search as _search, register as _register, ) from cqparts.search import common_criteria module_criteria = { 'module': __name__, } register = common_criteria(**module_criteria)(_register) search = common_criteria(**module_criteria)(_search) find = common_criteria(**module_criteria)(_find)
import cadquery import cqparts from cqparts.params import * from cqparts.search import register, common_criteria from cqparts.constraint import Mate from cqparts.utils import CoordSystem # basic.primatives registration utility module_criteria = { 'lib': 'basic', 'type': 'primative', 'module': __name__, } _register = common_criteria(**module_criteria)(register) # ------------- Primative Shapes ------------ @_register(shape='cube') class Cube(cqparts.Part): """ Cube centered on the XY plane """ size = PositiveFloat(1, doc="length of all sides") def make(self): return cadquery.Workplane('XY').box( self.size, self.size, self.size, )
import cadquery import cqparts from cqparts.params import * from cqparts.search import register, common_criteria from cqparts.constraint import Mate from cqparts.utils import CoordSystem # basic.primatives registration utility module_criteria = { 'lib': 'basic', 'type': 'primative', 'module': __name__, } _register = common_criteria(**module_criteria)(register) # ------------- Primative Shapes ------------ @_register(shape='cube') class Cube(cqparts.Part): """ Cube centered on the XY plane """ size = PositiveFloat(1, doc="length of all sides") def make(self): return cadquery.Workplane('XY').box( self.size, self.size, self.size, )